Skip to content

Commit

Permalink
Make broken pixels check only in case of non-dvred pixels
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Dec 5, 2023
1 parent 17dd75b commit ef6e174
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ctapipe_io_lst/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ def fill_r0r1_camera_container(self, zfits_event):
# the code here works for both cases but not for the hypothetical
# case of broken pixels marked as broken (so camera config as 1855 pixels)
# and 1855 pixel_status entries but broken pixels not contained in `waveform`
if np.any(broken_pixels) and len(waveform) < n_pixels:
if not self.dvr_applied and np.any(broken_pixels) and len(waveform) < n_pixels:
raise NotImplementedError(
"Case of broken pixels not contained in waveform is not implemented."
"If you encounter this error, open an issue in ctapipe_io_lst noting"
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

0 comments on commit ef6e174

Please sign in to comment.