5353 DATA_MONO_SUMT_TRIGGER_PATTERN ,
5454 PEDESTAL_TRIGGER_PATTERN ,
5555 DATA_STEREO_TRIGGER_PATTERN ,
56- N_SAMPLES ,
5756)
5857
5958__all__ = [
@@ -668,12 +667,28 @@ def prepare_subarray_info(self):
668667 f"Invalid focal length choice: { self .focal_length_choice } "
669668 )
670669
671-
672670 # camera info from MAGICCam.camgeom.fits.gz file
673671 camera_geom = load_camera_geometry ()
674672
675673 n_pixels = camera_geom .n_pixels
676674
675+ n_samples_array_list = ["MRawRunHeader.fNumSamplesHiGain" ]
676+ n_samples_list = []
677+
678+ for rootf in self .files_ :
679+ nsample_info = rootf ['RunHeaders' ].arrays (n_samples_array_list , library = "np" )
680+ n_samples_file = int (nsample_info ['MRawRunHeader.fNumSamplesHiGain' ][0 ])
681+ n_samples_list .append (n_samples_file )
682+
683+ n_samples_list = np .unique (n_samples_list ).tolist ()
684+
685+ if len (n_samples_list ) > 1 :
686+ raise ValueError (
687+ "Loaded files contain different number of readout samples. \
688+ Please load files with the same readout configuration." )
689+
690+ n_samples = n_samples_list [0 ]
691+
677692 pulse_shape_lo_gain = np .array ([0. , 1. , 2. , 1. , 0. ])
678693 pulse_shape_hi_gain = np .array ([1. , 2. , 3. , 2. , 1. ])
679694 pulse_shape = np .vstack ((pulse_shape_lo_gain , pulse_shape_hi_gain ))
@@ -688,7 +703,7 @@ def prepare_subarray_info(self):
688703 reference_pulse_sample_width = u .Quantity (0.5 , u .ns ),
689704 n_channels = 1 ,
690705 n_pixels = n_pixels ,
691- n_samples = N_SAMPLES ,
706+ n_samples = n_samples ,
692707 )
693708
694709 camera = CameraDescription ('MAGICCam' , camera_geom , camera_readout )
0 commit comments