Skip to content

Inconsistent size of trigger_pattern in NectarCAMEventContainer #80

@jlenain

Description

@jlenain

Bug description

While exploring the possibility to produce DL1/DL2 data with ctapipe v0.24, I came across a problem with the size of the NectarCAMEventContainer.trigger_pattern size.

Take the example of run 6219, which has missing drawers in the outer ring of the camera, ctapipe-process fails with the error:

Traceback (most recent call last):
  File "/data/users/jlenain/local/opt/conda/envs/ctapipe-0.23/lib/python3.14/site-packages/ctapipe/core/tool.py", line 439, in run
    self.start()
    ~~~~~~~~~~^^
  File "/data/users/jlenain/local/opt/conda/envs/ctapipe-0.23/lib/python3.14/site-packages/ctapipe/tools/process.py", line 286, in start
    for event in tqdm(
                 ~~~~^
        self.event_source,
        ^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        disable=not self.progress_bar,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ):
    ^
  File "/data/users/jlenain/local/opt/conda/envs/ctapipe-0.23/lib/python3.14/site-packages/tqdm/std.py", line 1181, in __iter__
    for obj in iterable:
               ^^^^^^^^
  File "/data/users/jlenain/local/opt/conda/envs/ctapipe-0.23/lib/python3.14/site-packages/ctapipe/io/eventsource.py", line 318, in __iter__
    for event in self._generator():
                 ~~~~~~~~~~~~~~~^^
  File "/data/users/jlenain/local/opt/conda/envs/ctapipe-0.23/lib/python3.14/site-packages/ctapipe_io_nectarcam/__init__.py", line 760, in _generator
    self.fill_nectarcam_event_container_from_zfile(array_event, event)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/data/users/jlenain/local/opt/conda/envs/ctapipe-0.23/lib/python3.14/site-packages/ctapipe_io_nectarcam/__init__.py", line 1019, in fill_nectarcam_event_container_from_zfile
    event_container.pixel_status[tpat] | PixelStatus.PIXEL_TRIGGER_1
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
IndexError: boolean index did not match indexed array along axis 0; size of axis is 1554 but size of corresponding boolean axis is 1855

at https://github.com/cta-observatory/ctapipe_io_nectarcam/blob/main/src/ctapipe_io_nectarcam/__init__.py#L1019.

NectarCAMEventContainer.trigger_pattern is initialized such that it is always expected to be of size 1855 (see https://github.com/cta-observatory/ctapipe_io_nectarcam/blob/main/src/ctapipe_io_nectarcam/__init__.py#L1121), if I understand correctly.

How to reproduce

First, enable gain selection in ctapipe_io_nectarcam, by setting select_gain to True in https://github.com/cta-observatory/ctapipe_io_nectarcam/blob/main/src/ctapipe_io_nectarcam/calibration.py#L51, and run:

dget /ctao/nectarcam/NectarCAMQM/2025/20250429/NectarCAM.Run6219.0000.fits.fz
ctapipe-quickstart
ctapipe-process --config base_config.yaml --config stage1_config.yaml --input file://NectarCAM.Run6219.0000.fits.fz --output events.h5 --progress --log-level=INFO --overwrite

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions