Skip to content

Commit

Permalink
Fill r1 event type also for old data
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Nov 21, 2023
1 parent 17dd75b commit 34968e4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/ctapipe_io_lst/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,9 @@ def fill_trigger_info(self, array_event):
if trigger.event_type == EventType.UNKNOWN:
self.log.warning(f'Event {array_event.index.event_id} has unknown event type, trigger: {trigger_bits:08b}')

if CTAPIPE_0_20:
array_event.r1.tel[tel_id].event_type = trigger.event_type

def tag_flatfield_events(self, array_event):
'''
Use a heuristic based on R1 waveforms to recognize flat field events
Expand Down
25 changes: 25 additions & 0 deletions src/ctapipe_io_lst/pixels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import numpy as np
from astropy.table import Table
from .constants import N_PIXELS_MODULE

def get_pixel_table(pixel_id_map, module_id_map):
"""
Construct a table of pixel / module ids from the mappings in CameraConfiguration
"""
module_index = np.repeat(np.arange(len(module_id_map)), N_PIXELS_MODULE)
pixel_index = np.arange(len(pixel_id_map))

local_pixel_index = pixel_index % N_PIXELS_MODULE
hardware_pixel_id = module_id_map * N_PIXELS_MODULE + local_pixel_index

table = Table(dict(
pixel_id=pixel_id_map,
pixel_index=pixel_index,
hardware_pixel_id=hardware_pixel_id,
module_id=module_id_map,
local_pixel_index=local_pixel_index,
module_index=module_index,
))

table.sort("pixel_id")
return table
3 changes: 1 addition & 2 deletions src/ctapipe_io_lst/tests/test_lsteventsource.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,7 @@ def test_pedestal_events(tmp_path):
assert event.trigger.event_type == EventType.SKY_PEDESTAL
else:
assert event.trigger.event_type != EventType.SKY_PEDESTAL


assert event.r1.tel[1].event_type == event.trigger.event_type


@pytest.mark.parametrize(
Expand Down

0 comments on commit 34968e4

Please sign in to comment.