Skip to content

Fix exception on empty trains in lit-frame selection

Egor Sobolev requested to merge fix/litfrm-empty-mask into master

This fixes an issue with empty masks from lit-frame selection method

LitFrames reduction method may sent an empty mask to select the frames in empty trains. It raises exception

Traceback (most recent call last):
  File "/home/xred/.venv/bin/exdf-reduce", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/xred/exdf-tools/src/exdf/cli/reduce.py", line 243, in main
    writer = ReduceWriter(inp_data, methods, args.output_scope,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xred/exdf-tools/src/exdf/data_reduction/red_writer.py", line 157, in __init__
    self._handle_select_xtdf()
  File "/home/xred/exdf-tools/src/exdf/data_reduction/red_writer.py", line 51, in op_handler
    if op_func(self, source, *args) is False:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xred/exdf-tools/src/exdf/data_reduction/red_writer.py", line 524, in _handle_select_xtdf
    new_masks = self._get_entry_masks(
                ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xred/exdf-tools/src/exdf/data_reduction/red_writer.py", line 211, in _get_entry_masks
    elif np.issubdtype(type(entry_sel[0]), np.integer):
                            ~~~~~~~~~^^^
IndexError: index 0 is out of bounds for axis 0 with size 0

@schmidtp @kluyvert

Merge request reports

Loading