Пример #1
0
def create_veto_intervals(events,
                          min_area,
                          min_hits,
                          min_contributing_channels,
                          left_extension,
                          right_extension, ):
    """
    Function which creates veto regions.

    :param events: nveto events
    :param min_area: min area in pe required to create a veto region.
    :param min_hits: same but with hitlets
    :param min_contributing_channels: Minimal number of contributing
        channels.
    :param left_extension: Left extension of the event to define veto
        region in ns.
    :param right_extension: Same but right hand side after.

    :returns: numpy.structured.array containing the veto regions.
    """
    res = np.zeros(len(events),
                   dtype=strax.time_fields)

    res = _create_veto_intervals(events,
                                 min_area,
                                 min_hits,
                                 min_contributing_channels,
                                 left_extension,
                                 right_extension,
                                 res, )
    res = straxen.merge_intervals(res)

    return res
Пример #2
0
    def test_merge_overlapping_intervals(self):
        intervals = straxen.merge_intervals(self.intervals)

        assert len(intervals) == 2, 'Got the wrong number of intervals!'

        time_is_correct = intervals[0]['time'] == self.intervals['time'][0]
        assert time_is_correct, 'First interval has the wrong time!'
        time_is_correct = intervals[0]['endtime'] == self.intervals['endtime'][
            -2]
        assert time_is_correct, 'First interval has the wrong endtime!'

        time_is_correct = intervals[-1]['time'] == self.intervals['time'][-1]
        assert time_is_correct, 'Second interval has the wrong time!'
        time_is_correct = intervals[-1]['endtime'] == self.intervals[
            'endtime'][-1]
        assert time_is_correct, 'Second interval has the wrong endtime!'
Пример #3
0
 def test_empty_intervals(self):
     intervals = np.zeros(0, dtype=strax.time_fields)
     intervals = straxen.merge_intervals(intervals)
     assert len(
         intervals) == 0, 'Empty input should return empty intervals!'