Beispiel #1
0
    def _test_coincidence(self, resolving_time, coincidence, pre_trigger,
                          n_concidences_truth, times_truth, endtime_truth):
        coincidence = straxen.find_coincidence(self.intervals,
                                               nfold=coincidence,
                                               resolving_time=resolving_time,
                                               pre_trigger=pre_trigger)
        number_coincidence_correct = len(coincidence) == n_concidences_truth
        assert number_coincidence_correct, 'Have not found the correct number of coincidences'

        time_is_correct = np.all(coincidence['time'] == times_truth)
        assert time_is_correct, 'Coincidence does not have the correct time'

        endtime_is_correct = np.all(coincidence['endtime'] == endtime_truth)
        print(coincidence['endtime'], endtime_truth)
        assert endtime_is_correct, 'Coincidence does not have the correct endtime'
Beispiel #2
0
 def test_empty_inputs(self):
     intervals = np.zeros(0, dtype=strax.time_fields)
     intervals = straxen.find_coincidence(intervals)
     assert len(
         intervals) == 0, 'Empty input should return empty intervals!'