From b3e465739ba3397ff4263d7b7873470459874a72 Mon Sep 17 00:00:00 2001 From: Maximilian Linhoff Date: Mon, 2 Oct 2023 15:52:41 +0000 Subject: [PATCH] Set DVR bits to stored if DVR was obviously not applied but pixel_status is wrong --- src/ctapipe_io_zfits/dl0.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ctapipe_io_zfits/dl0.py b/src/ctapipe_io_zfits/dl0.py index a603828..de3853d 100644 --- a/src/ctapipe_io_zfits/dl0.py +++ b/src/ctapipe_io_zfits/dl0.py @@ -87,7 +87,12 @@ def _fill_dl0_container(tel_event, data_stream, camera_config, camera_geometry): zfits_waveform = waveform.astype(np.float32) / scale - offset - pixel_stored = PixelStatus.get_dvr_status(tel_event.pixel_status) != 0 + pixel_status = tel_event.pixel_status + # FIXME: seems ACADA doesn't set pixels to "stored" when no DVR is applied + if n_pixels_stored == camera_config.num_pixels and np.all(PixelStatus.get_dvr_status(pixel_status) == 0): + pixel_status = pixel_status | PixelStatus.DVR_STORED_AS_SIGNAL + + pixel_stored = PixelStatus.get_dvr_status(pixel_status) != 0 n_pixels_nominal = camera_geometry.n_pixels # fill not readout pixels with 0, reorder pixels, use 2d array when gain reduced @@ -100,7 +105,8 @@ def _fill_dl0_container(tel_event, data_stream, camera_config, camera_geometry): # reorder to nominal pixel order pixel_status = np.zeros(n_pixels_nominal, dtype=tel_event.pixel_status.dtype) - pixel_status[camera_config.pixel_id_map] = tel_event.pixel_status + pixel_status[camera_config.pixel_id_map] = pixel_status + channel_info = PixelStatus.get_channel_info(pixel_status) if n_channels == 1: