Ejemplo n.º 1
0
    def compute(self, records_nv, start, end):
        hits = strax.find_hits(records_nv, min_amplitude=self.config['hit_min_amplitude_nv'])
        hits = remove_switched_off_channels(hits, self.to_pe)

        temp_hitlets = strax.create_hitlets_from_hits(hits,
                                                      self.config['save_outside_hits_nv'],
                                                      self.channel_range,
                                                      chunk_start=start,
                                                      chunk_end=end)
        del hits

        # Get hitlet data and split hitlets:
        temp_hitlets = strax.get_hitlets_data(temp_hitlets, records_nv, to_pe=self.to_pe)

        temp_hitlets = strax.split_peaks(temp_hitlets,
                                         records_nv,
                                         self.to_pe,
                                         data_type='hitlets',
                                         algorithm='local_minimum',
                                         min_height=self.config['min_split_nv'],
                                         min_ratio=self.config['min_split_ratio_nv']
                                         )

        # Compute other hitlet properties:
        # We have to loop here 3 times over all hitlets...
        strax.hitlet_properties(temp_hitlets)
        entropy = strax.conditional_entropy(temp_hitlets, template='flat', square_data=False)
        temp_hitlets['entropy'][:] = entropy

        # Remove data field:
        hitlets = np.zeros(len(temp_hitlets), dtype=strax.hitlet_dtype())
        strax.copy_to_buffer(temp_hitlets, hitlets, '_copy_hitlets')
        return hitlets
Ejemplo n.º 2
0
 def make_records_and_hitlets(self, dummy_records):
     records = self._make_fake_records(dummy_records)
     hits = strax.find_hits(records, min_amplitude=2)
     hitlets = strax.create_hitlets_from_hits(hits, (1, 1), (0, 1), 0,
                                              float('inf'))
     return records, hitlets
Ejemplo n.º 3
0
def test_create_hits_from_hitlets_empty_hits():
    hits = np.zeros(0, dtype=strax.hit_dtype)
    hitlets = strax.create_hitlets_from_hits(hits, (1, 1), (0, 1))
    assert len(hitlets) == 0, 'Hitlets should be empty'