File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -398,7 +398,9 @@ def data_counts(self, labelled=True):
398398
399399 if labelled :
400400 import pandas as pd
401- return pd .Series (counts , index = train_ids )
401+ res = pd .Series (0 , index = self .train_ids )
402+ res .loc [train_ids ] = counts
403+ return res
402404 else :
403405 all_tids_arr = np .array (self .train_ids )
404406 res = np .zeros (len (all_tids_arr ), dtype = np .uint64 )
Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ def test_get_train_keep_dims(mock_jungfrau_run):
170170 assert val .shape == (1 , 16 , 512 , 1024 )
171171
172172
173- def test_data_counts (mock_reduced_spb_proc_run ):
173+ def test_data_counts (mock_reduced_spb_proc_run , mock_jungfrau_run ):
174174 run = RunDirectory (mock_reduced_spb_proc_run )
175175
176176 # control data
@@ -189,6 +189,14 @@ def test_data_counts(mock_reduced_spb_proc_run):
189189 assert count .index .tolist () == mod .train_ids
190190 assert count .values .sum () == mod .shape [0 ]
191191
192+ # Combine data with more train IDs than our original sources, and
193+ # ensure that the data counts now cover these additional train IDs
194+ # as well with 0.
195+ multi_run = run .union (RunDirectory (mock_jungfrau_run ))
196+ mod = multi_run ['SPB_DET_AGIPD1M-1/DET/0CH0:xtdf' , 'image.data' ]
197+ count = mod .data_counts ()
198+ assert count .index .tolist () == mod .train_ids
199+
192200
193201def test_data_counts_empty (mock_fxe_raw_run ):
194202 run = RunDirectory (mock_fxe_raw_run )
You can’t perform that action at this time.
0 commit comments