Closed h-mayorquin closed 1 month ago
This seems to be a problem coming to neo through pyedflib
. The following throws an assertion:
from pathlib import Path
from pyedflib import EdfReader
file_path = Path("/home/heberto/neuroconv_testing_data/ephy_testing_data/edf/edf+C.edf")
reader = EdfReader(str(file_path))
reader2 = EDFRecordingExtractor(file_path=file_path)
Note that this works well in separate process though. The following does not throw an assertion:
from pathlib import Path
from pyedflib import EdfReader
file_path = Path("/home/heberto/neuroconv_testing_data/ephy_testing_data/edf/edf+C.edf")
from concurrent.futures import ProcessPoolExecutor
n_jobs = 8
file_path_list = [(i, file_path) for i in range(n_jobs)]
def initializer(file_path):
number, file_path = file_path
print(number, file_path)
reader = EdfReader(str(file_path))
print(reader)
with ProcessPoolExecutor(max_workers=n_jobs // 2) as executor:
results = executor.map(initializer, file_path_list)
Thanks for this. This is something known. pyedflib have a problem to open twice the same file. @JuliaSprenger do you have more comments on this ?
@h-mayorquin can we close this and in case move to NEO?
Yes, I will be fine with this. We should open first the issue in neo and then close this though so we don't forget.
OK, I opened the issue in neo:
https://github.com/NeuralEnsemble/python-neo/issues/1557
Let's close this.
I discovered this while working on #1227. The following code throws an assertion:
So it seems that this extractor can not mantain two open references to the same file. I wonder what should we do in this cases? Should the recorder at neo or spikeinterface throw an assertion if the file is already open informing the user that they have to close the old one?