You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Writing NIRS files to FIF is surprisingly slow #7744
I am reading NIRX NIRS files and writing them to fif files. This process takes longer than I expected.
It may be that this is how long writing takes. But I want to make sure there is nothing wrong with how we have written the read_raw_nirx function that is causing a slowdown.
Or perhaps fif is not the correct format I should be using? I selected fif as I know that it should work as its being tested here (called here).
IIRC during initial implementation we expected it to be slow. Looking at the implementation now, it actually reads every line until it finds the correct one(s), reads them, then breaks.
You could see if switching to the pandas implementation is faster. But maybe what would be even better (should be faster than pandas even) is to traverse the entire file exactly once during __init__ to learn where the line breaks (sample numbers) are, then when on demand reads are called do a fid.seek to the proper starting position and then read just the required number of lines.
@kuziekj and I just moved the read_raw_boxy PR #7717 away from pandas
Indeed it's better not to require it, at least to start. If there ends up being a performance bottleneck and we need to make an (optional!) requirement to read it to boost performance we can do that. But having the non-Pandas reader is still helpful.
Thank you all for the feedback and suggestions on where the code can be improved.
It seems the current implementation is correct but slow. I will leave this issue open as a reminder to address this in the future. But it does not seem urgent.
Good afternoon, I apologize for my poor English. Not so long ago I started working in a laboratory where fNIRS data is analyzed.
The question is this. I processed raw data, did filtering, deleted bad channels. Please tell me how I can save the result now - in the future, these processed data will be sent back to NIRS Sport. Can I use the save() method to save this. So that the equipment then correctly reads the processed data. My idea is to use .save("data.fif") will it work?
Activity
agramfort commentedon May 7, 2020
rob-luke commentedon May 7, 2020
I was using
preload=falseas that's what's used in MNE-BIDS which I was starting to implement.Great pointer. I will look here for efficiency gains.
larsoner commentedon May 7, 2020
IIRC during initial implementation we expected it to be slow. Looking at the implementation now, it actually reads every line until it finds the correct one(s), reads them, then breaks.
You could see if switching to the
pandasimplementation is faster. But maybe what would be even better (should be faster than pandas even) is to traverse the entire file exactly once during__init__to learn where the line breaks (sample numbers) are, then when on demand reads are called do afid.seekto the proper starting position and then read just the required number of lines.kylemath commentedon May 7, 2020
@kuziekj and I just moved the read_raw_boxy PR #7717 away from pandas
larsoner commentedon May 7, 2020
Indeed it's better not to require it, at least to start. If there ends up being a performance bottleneck and we need to make an (optional!) requirement to read it to boost performance we can do that. But having the non-Pandas reader is still helpful.
rob-luke commentedon May 7, 2020
Thank you all for the feedback and suggestions on where the code can be improved.
It seems the current implementation is correct but slow. I will leave this issue open as a reminder to address this in the future. But it does not seem urgent.
G21R commentedon Mar 27, 2022
Good afternoon, I apologize for my poor English. Not so long ago I started working in a laboratory where fNIRS data is analyzed.
The question is this. I processed raw data, did filtering, deleted bad channels. Please tell me how I can save the result now - in the future, these processed data will be sent back to NIRS Sport. Can I use the save() method to save this. So that the equipment then correctly reads the processed data.
My idea is to use .save("data.fif") will it work?