@@ -71,27 +71,42 @@ def get_module_and_pixel_id_map(n_modules, n_pixels_module, missing_modules=None
7171 return module_id_map , pixel_id_map
7272
7373
74- # we parametrize the dummy dl0 for a couple of different scenarios.
75- # Tests using this fixture will be run under all scenarios automatically
76- @pytest .fixture (
77- scope = "session" ,
78- params = [
74+ test_configurations = [
75+ pytest .param (
76+ {
77+ "obs_start" : Time ("2025-02-04T20:45:31" ),
78+ "sb_creator_id" : 2 ,
79+ "sb_id" : 124 ,
80+ "obs_id" : 789 ,
81+ },
82+ id = "standard" ,
83+ ),
84+ pytest .param (
7985 {
80- "missing_modules" : True ,
86+ "missing_modules" : [ 50 , 200 ] ,
8187 "obs_start" : Time ("2023-08-02T02:15:31" ),
8288 "sb_creator_id" : 2 ,
8389 "sb_id" : 123 ,
8490 "obs_id" : 456 ,
8591 },
92+ id = "missing-modules" ,
93+ ),
94+ pytest .param (
8695 {
87- "missing_modules " : False ,
96+ "tel_ids_with_data " : False ,
8897 "obs_start" : Time ("2025-02-04T20:45:31" ),
8998 "sb_creator_id" : 2 ,
90- "sb_id" : 124 ,
91- "obs_id" : 789 ,
99+ "sb_id" : 125 ,
100+ "obs_id" : 126 ,
92101 },
93- ],
94- )
102+ id = "no_tel_ids_with_data" ,
103+ ),
104+ ]
105+
106+
107+ # we parametrize the dummy dl0 for a couple of different scenarios.
108+ # Tests using this fixture will be run under all scenarios automatically
109+ @pytest .fixture (scope = "session" , params = test_configurations )
95110def dummy_dl0 (dl0_base , request ):
96111 rng = np .random .default_rng (0 )
97112
@@ -136,7 +151,7 @@ def dummy_dl0(dl0_base, request):
136151 sb_creator_id = sb_creator_id ,
137152 )
138153
139- missing_modules = [ 50 , 200 ] if config [ "missing_modules" ] else None
154+ missing_modules = config . get ( "missing_modules" )
140155 module_id_map , pixel_id_map = get_module_and_pixel_id_map (
141156 n_modules = 265 , n_pixels_module = 7 , missing_modules = missing_modules
142157 )
@@ -207,6 +222,11 @@ def convert_waveform(waveform):
207222 event_id = i + 1
208223 time_s , time_qns = time_to_cta_high_res (time )
209224
225+ # simulate old data without tel_ids_with_data if asked
226+ kwargs = {}
227+ if config .get ("tel_ids_with_data" , True ):
228+ kwargs ["tel_ids_with_data" ] = numpy_to_any_array (np .array ([1 ]))
229+
210230 trigger_file .write_message (
211231 DL0_Subarray .Event (
212232 event_id = event_id ,
@@ -217,7 +237,7 @@ def convert_waveform(waveform):
217237 event_time_qns = int (time_qns ),
218238 trigger_ids = numpy_to_any_array (np .array ([event_id ])),
219239 tel_ids_with_trigger = numpy_to_any_array (np .array ([1 ])),
220- tel_ids_with_data = numpy_to_any_array ( np . array ([ 1 ])) ,
240+ ** kwargs ,
221241 )
222242 )
223243
0 commit comments