@@ -248,6 +248,33 @@ def test_data_counts_missing_train(fxe_run_module_offset):
248248 np .testing .assert_array_equal (arr , 128 )
249249
250250
251+ @pytest .mark .parametrize ('labelled' , [True , False ])
252+ def test_train_index_bounds (mock_spb_raw_run , labelled ):
253+ run = RunDirectory (mock_spb_raw_run )
254+
255+ agipd_m0 = run ['SPB_DET_AGIPD1M-1/DET/0CH0:xtdf' , 'image.pulseId' ]
256+ bounds = agipd_m0 .train_index_bounds (labelled )
257+
258+ if labelled :
259+ start , stop = bounds ['start' ], bounds ['stop' ]
260+ else :
261+ start , stop = bounds
262+
263+ np .testing .assert_array_equal (start , np .arange (0 , 4032 + 1 , 64 ))
264+ np .testing .assert_array_equal (stop , start + 64 )
265+
266+ xgm = run ['SPB_XTD9_XGM/DOOCS/MAIN' , 'pulseEnergy.photonFlux' ]
267+ bounds = xgm .train_index_bounds (labelled )
268+
269+ if labelled :
270+ start , stop = bounds ['start' ], bounds ['stop' ]
271+ else :
272+ start , stop = bounds
273+
274+ np .testing .assert_array_equal (start , np .arange (len (start )))
275+ np .testing .assert_array_equal (stop , start + 1 )
276+
277+
251278def test_select_by (mock_spb_raw_run ):
252279 run = RunDirectory (mock_spb_raw_run )
253280 am0 = run ['SPB_DET_AGIPD1M-1/DET/0CH0:xtdf' , 'image.data' ]
0 commit comments