python-neo icon indicating copy to clipboard operation
python-neo copied to clipboard

EDF blocks access when io is opened.

Open h-mayorquin opened this issue 1 year ago • 8 comments

This is coming from here in Spikeinterface:

https://github.com/SpikeInterface/spikeinterface/issues/1228

Here, basically this format can't only be opened once per file-system.

from pathlib import Path

from spikeinterface.extractors import EDFRecordingExtractor
from spikeinterface.core.base import _load_extractor_from_dict

file_path = Path("/home/heberto/neuroconv_testing_data/ephy_testing_data/edf/edf+C.edf")

recorder = EDFRecordingExtractor(file_path=file_path)
recorder_dict = recorder.to_dict()
recorder_from_dict = _load_extractor_from_dict(recorder_dict)


  File "/home/heberto/miniconda3/envs/spikeinterface_env/lib/python3.10/site-packages/neo/rawio/edfrawio.py", line 70, in _parse_header
    self.edf_reader = EdfReader(self.filename)
  File "pyedflib/_extensions/_pyedflib.pyx", line 146, in pyedflib._extensions._pyedflib.CyEdfReader.__init__
  File "pyedflib/_extensions/_pyedflib.pyx", line 209, in pyedflib._extensions._pyedflib.CyEdfReader.open
  File "pyedflib/_extensions/_pyedflib.pyx", line 181, in pyedflib._extensions._pyedflib.CyEdfReader.check_open_ok
OSError: /home/heberto/neuroconv_testing_data/ephy_testing_data/edf/edf+C.edf: file has already been opened

h-mayorquin avatar Sep 18 '24 02:09 h-mayorquin

Wasn't this a long term issue. I have no clue how to fix. Since you have some data from somewhere are you okay trying to make a fix?

zm711 avatar Sep 18 '24 14:09 zm711

Yeah, unfortunately, the fix would be to redo the IO entirely as we use a library for this one and is blocking. I don't think it would be too hard but I would be more weary about testing it.

h-mayorquin avatar Sep 18 '24 15:09 h-mayorquin

Mmm now that I think about it, we could use MNE. That should be easier.

h-mayorquin avatar Sep 18 '24 15:09 h-mayorquin

Yeah if it's possible. That'd be cool.

zm711 avatar Sep 18 '24 15:09 zm711

@zm711 can you re-open this? I don't think this is fully solved fully yet and the IO is just restricted to get_analogsignal... but it is still blocked.

The solution will be to either use mne or roll this into our own memmaps.

h-mayorquin avatar Oct 21 '24 15:10 h-mayorquin

I think it autoclosed when I merged. happy to reopen.

zm711 avatar Oct 21 '24 15:10 zm711

Should I also modify the milestone to future in this case?

zm711 avatar Oct 21 '24 15:10 zm711

Yes, please do.

h-mayorquin avatar Oct 21 '24 15:10 h-mayorquin