BlueBrain / BluePyEfe

BluePyEfe: Blue Brain Python E-feature extraction
https://bluepyefe.readthedocs.io/en/latest/
Other
15 stars 13 forks source link

Fail gracefully if stimulus trace does not exist in _nwb_reader_BBP #88

Open lvsltz opened 2 years ago

lvsltz commented 2 years ago

_nwb_reader_BBP on BPE2 branch assumes current trace exists, but this is not always the case and fails with

warning: tag '2.0.0' is really '2.0' here
Traceback (most recent call last):
   File "/home/sol/Documents/git/BluePyEfe/bluepyefe/cell.py", line 108, in read_recordings
    for reader_data in self.reader(config_data, recording_reader):
  File "/home/sol/Documents/git/BluePyEfe/bluepyefe/cell.py", line 67, in reader
    return nwb_reader(config_data)
  File "/home/sol/Documents/git/BluePyEfe/bluepyefe/reader.py", line 331, in nwb_reader
    return _nwb_reader_BBP(content, target_protocols, in_data.get("repetition", None))
  File "/home/sol/Documents/git/BluePyEfe/bluepyefe/reader.py", line 297, in _nwb_reader_BBP
    current=content["stimulus"]["presentation"][key_current]["data"],
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "/home/sol/miniconda3/envs/etype/lib/python3.10/site-packages/h5py/_hl/group.py", line 328, in __getitem__
    oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py/h5o.pyx", line 190, in h5py.h5o.open
KeyError: "Unable to open object (object 'ics__IDRest__038' doesn't exist)"

A graceful exit should be provided instead.

DrTaDa commented 2 years ago

Thank you for the report, I am on it.

DrTaDa commented 2 years ago

@lvsltz Would you prefer if to crash or to skip this recording ?

lvsltz commented 2 years ago

I am not sure. It should behave in line with the other BPE scenarios when ton, toff and other important params are missing.

DrTaDa commented 2 years ago

Could you try https://github.com/BlueBrain/BluePyEfe/pull/89/ ?