def __init__(self, template_name, detect_time, no_chans, detect_val,<EOL>threshold, typeofdet, threshold_type, threshold_input,<EOL>chans=None, event=None, id=None):
self.template_name = template_name<EOL>self.detect_time = detect_time<EOL>self.no_chans = int(no_chans)<EOL>if not isinstance(chans, list):<EOL><INDENT>self.chans = [chans]<EOL><DEDENT>else:<EOL><INDENT>self.chans = chans<EOL><DEDENT>self.detect_val = np.float32(detect_val)<EOL>self.threshold = np.float32(threshold)<EOL>self.typeofdet = typeofdet<EOL>self.threshold_type = threshold_type<EOL>self.threshold_input = threshold_input<EOL>self.event = event<EOL>if id is not None:<EOL><INDENT>self.id = id<EOL><DEDENT>else:<EOL><INDENT>self.id = ('<STR_LIT>'.join(template_name.split('<STR_LIT:U+0020>')) + '<STR_LIT:_>' +<EOL>detect_time.strftime('<STR_LIT>'))<EOL><DEDENT>if event is not None:<EOL><INDENT>event.resource_id = self.id<EOL><DEDENT>if self.typeofdet == '<STR_LIT>':<EOL><INDENT>assert abs(self.detect_val) <= self.no_chans<EOL><DEDENT>
Main class of Detection.