Beispiel #1
0
 def test_multi_detectors(self):
     """Test the efficient looping in subspace."""
     templates = copy.deepcopy(self.templates)
     detector1 = subspace.Detector()
     detector1.construct(streams=templates,
                         lowcut=2,
                         highcut=9,
                         filt_order=4,
                         sampling_rate=20,
                         multiplex=False,
                         name=str('Tester1'),
                         align=True,
                         shift_len=6,
                         reject=0.2).partition(9)
     templates = copy.deepcopy(self.templates)
     detector2 = subspace.Detector()
     detector2.construct(streams=templates[0:20],
                         lowcut=2,
                         highcut=9,
                         filt_order=4,
                         sampling_rate=20,
                         multiplex=False,
                         name=str('Tester2'),
                         align=True,
                         shift_len=6,
                         reject=0.2).partition(9)
     detections = subspace.subspace_detect(detectors=[detector1, detector2],
                                           stream=self.st.copy(),
                                           threshold=0.05,
                                           trig_int=10,
                                           moveout=5,
                                           min_trig=5,
                                           parallel=False,
                                           num_cores=2)
     print(detections)
     self.assertEqual(len(detections), 5)
     detections = subspace.subspace_detect(detectors=[detector1, detector2],
                                           stream=self.st.copy(),
                                           threshold=0.05,
                                           trig_int=10,
                                           moveout=5,
                                           min_trig=5,
                                           parallel=True,
                                           num_cores=2)
     print(detections)
     self.assertEqual(len(detections), 5)
Beispiel #2
0
                                     highcut=20.0,
                                     filt_order=3,
                                     samp_rate=50.0,
                                     starttime=dto,
                                     debug=2,
                                     parallel=True)
        del st
        proc_stp = timer()
        print('Pre-processing took %.3f seconds' % (proc_stp - proc_strt))
        # RUN MATCH FILTER (looping through chunks of templates due to RAM)
        print('Running detectors: ' + ' '.join(detector_names))
        detections = subspace.subspace_detect(detector_names,
                                              detector_list,
                                              st1,
                                              threshold=8.0,
                                              threshold_type='MAD',
                                              trig_int=6.0,
                                              plotvar=False,
                                              cores='all',
                                              debug=3)
        # Write detections to a file to check later
        for detection in detections:
            det_writer.writerow([
                detection.template_name, detection.detect_time,
                detection.detect_val, detection.threshold, detection.no_chans
            ])
        del detections
#Print out runtime
script_end = timer()
print('Instance took %.3f seconds' % (script_end - script_start))