Skip to content
Snippets Groups Projects

[AGIPD] [Correct] error out only if all sources are empty

Merged Karim Ahmed requested to merge fix/error_out_all_modules_empty into master
1 file
+ 7
3
Compare changes
  • Side-by-side
  • Inline
``` python
``` python
run_dc = RunDirectory(in_folder / f"r{run:04d}")
run_dc = RunDirectory(in_folder / f"r{run:04d}")
instrument_src = instrument_source_template.format(karabo_id, receiver_template)
instrument_src = instrument_source_template.format(karabo_id, receiver_template)
instr_dc = run_dc.select(instrument_src.format("*"), require_all=True)
instr_dc = run_dc.select(instrument_src.format("*"))
 
 
for m in modules:
 
# Remove empty sources from `instr_dc`
 
if instr_dc[instrument_src.format(m), 'image.data'].shape[0] == 0:
 
instr_dc = instr_dc.deselect(instrument_src.format(m))
if not instr_dc.train_ids:
if not instr_dc.all_sources:
raise ValueError(f"No images found for {in_folder / f'r{run:04d}'}")
raise ValueError(f"No images found for {in_folder / f'r{run:04d}'}")
Loading