@@ -479,12 +479,9 @@ def fill_from_cta_r1(self, array_event, zfits_event):
479
479
offset = self .data_stream .waveform_offset
480
480
pixel_id_map = self .camera_config .pixel_id_map
481
481
482
- # FIXME: missing modules / pixels
483
- # FIXME: DVR? should not happen in r1 but dl0, but our own converter uses the old R1
484
-
485
482
# reorder to nominal pixel order
486
483
pixel_status = _reorder_pixel_status (
487
- zfits_event .pixel_status , pixel_id_map , set_dvr_bits = True
484
+ zfits_event .pixel_status , pixel_id_map , set_dvr_bits = not self . dvr_applied ,
488
485
)
489
486
490
487
n_channels = zfits_event .num_channels
@@ -495,11 +492,16 @@ def fill_from_cta_r1(self, array_event, zfits_event):
495
492
raw_waveform = zfits_event .waveform .reshape (readout_shape )
496
493
waveform = raw_waveform .astype (np .float32 ) / scale - offset
497
494
495
+ if self .dvr_applied :
496
+ stored_pixels = (zfits_event .pixel_status & PixelStatus .DVR_STATUS ) > 0
497
+ else :
498
+ stored_pixels = slice (None ) # all pixels stored
499
+
498
500
reordered_waveform = np .full ((n_channels , N_PIXELS , n_samples ), 0.0 , dtype = np .float32 )
499
- reordered_waveform [:, pixel_id_map ] = waveform
501
+ reordered_waveform [:, pixel_id_map [ stored_pixels ] ] = waveform
500
502
waveform = reordered_waveform
501
503
502
- # FIXME, check using evb_preprocessing and make ctapipe support 2 gains
504
+
503
505
if zfits_event .num_channels == 2 :
504
506
selected_gain_channel = None
505
507
else :
@@ -535,16 +537,17 @@ def fill_from_cta_r1(self, array_event, zfits_event):
535
537
)
536
538
537
539
def fill_lst_from_ctar1 (self , zfits_event ):
540
+ pixel_status = _reorder_pixel_status (
541
+ zfits_event .pixel_status ,
542
+ self .pixel_id_map ,
543
+ set_dvr_bits = not self .dvr_applied ,
544
+ )
538
545
evt = LSTEventContainer (
539
- pixel_status = zfits_event . pixel_status . copy () ,
546
+ pixel_status = pixel_status ,
540
547
first_capacitor_id = zfits_event .first_cell_id ,
541
548
calibration_monitoring_id = zfits_event .calibration_monitoring_id ,
542
549
local_clock_counter = zfits_event .module_hires_local_clock_counter ,
543
550
)
544
- # set bits for dvr if not already set
545
- if not self .dvr_applied :
546
- not_broken = get_channel_info (evt .pixel_status ) != 0
547
- evt .pixel_status [not_broken ] |= PixelStatus .DVR_STATUS_0
548
551
549
552
if zfits_event .debug is not None :
550
553
debug = zfits_event .debug
@@ -971,7 +974,7 @@ def tag_flatfield_events(self, array_event):
971
974
'''
972
975
tel_id = self .tel_id
973
976
waveform = array_event .r1 .tel [tel_id ].waveform
974
-
977
+
975
978
if waveform .ndim == 3 :
976
979
image = waveform [HIGH_GAIN ].sum (axis = 1 )
977
980
else :
@@ -981,7 +984,7 @@ def tag_flatfield_events(self, array_event):
981
984
n_in_range = np .count_nonzero (in_range )
982
985
983
986
looks_like_ff = n_in_range >= self .min_flatfield_pixel_fraction * image .size
984
-
987
+
985
988
if looks_like_ff :
986
989
# Tag as FF only events with 2-gains waveforms: both gains are needed for calibration
987
990
if waveform .ndim == 3 :
@@ -1091,7 +1094,7 @@ def fill_r0r1_camera_container(self, zfits_event):
1091
1094
if CTAPIPE_0_20 :
1092
1095
# reorder to nominal pixel order
1093
1096
pixel_status = _reorder_pixel_status (
1094
- zfits_event .pixel_status , pixel_id_map , set_dvr_bits = True
1097
+ zfits_event .pixel_status , pixel_id_map , set_dvr_bits = not self . dvr_applied
1095
1098
)
1096
1099
r1 .pixel_status = pixel_status
1097
1100
r1 .event_time = cta_high_res_to_time (
0 commit comments