Skip to content

Fix a check if run_num is in the user's statistics file.

Oleksii Turkot requested to merge fix_KTH_check_statistics into main

When for KTH data reduction a user's statistics file is provided but run number is not there there was an error:

WARNING:spi_reduction.user_frames_select.SPIFrameSelectKTH:No data for run 660 in statistics csv file.
Traceback (most recent call last):
  File "/gpfs/exfel/sw/software/exfel_environments/exdf-tools/bin/exdf-reduce", line 8, in <module>
    sys.exit(main())
  File "/gpfs/exfel/sw/software/exfel_environments/exdf-tools/lib/python3.9/site-packages/exdf/cli/reduce.py", line 211, in main
    method = ep.load()(inp_data, args)
  File "/gpfs/exfel/sw/software/exfel_environments/exdf-tools/lib/python3.9/site-packages/spi_reduction/exdf_entry.py", line 114, in __init__
    xfel_select = frame_selector.get_xfel_select_for_run_data(data)
  File "/gpfs/exfel/sw/software/exfel_environments/exdf-tools/lib/python3.9/site-packages/spi_reduction/user_frames_select.py", line 353, in get_xfel_select_for_run_data
    self.check_statistics(run_num, class_stats)
  File "/gpfs/exfel/sw/software/exfel_environments/exdf-tools/lib/python3.9/site-packages/spi_reduction/user_frames_select.py", line 322, in check_statistics
    csv_stats_data = self.stats_df.loc[csv_sel_run].iloc[0]
  File "/gpfs/exfel/sw/software/exfel_environments/exdf-tools/lib/python3.9/site-packages/pandas/core/indexing.py", line 1103, in __getitem__
    return self._getitem_axis(maybe_callable, axis=axis)
  File "/gpfs/exfel/sw/software/exfel_environments/exdf-tools/lib/python3.9/site-packages/pandas/core/indexing.py", line 1656, in _getitem_axis
    self._validate_integer(key, axis)
  File "/gpfs/exfel/sw/software/exfel_environments/exdf-tools/lib/python3.9/site-packages/pandas/core/indexing.py", line 1589, in _validate_integer
    raise IndexError("single positional indexer is out-of-bounds")
IndexError: single positional indexer is out-of-bounds

Merge request reports