-
Notifications
You must be signed in to change notification settings - Fork 216
WhiteMatterRecordingExtractor #3849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @pauladkisson
See comments
@staticmethod | ||
def write_recording(recording, file_paths, **job_kwargs): | ||
""" | ||
Save the traces of a recording extractor in binary .dat format. | ||
|
||
Parameters | ||
---------- | ||
recording : RecordingExtractor | ||
The recording extractor object to be saved in .dat format | ||
file_paths : str | ||
The path to the file. | ||
""" | ||
job_kwargs["byte_offset"] = 8 | ||
BinaryRecordingExtractor.write_recording(recording, file_paths=file_paths, dtype="int16", **job_kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this and just write it in the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
src/spikeinterface/core/tests/test_whitematterrecordingextractor.py
Outdated
Show resolved
Hide resolved
@staticmethod | ||
def write_recording(recording, file_paths, **job_kwargs): | ||
""" | ||
Save the traces of a recording extractor in binary .dat format. | ||
|
||
Parameters | ||
---------- | ||
recording : RecordingExtractor | ||
The recording extractor object to be saved in .dat format | ||
file_paths : str | ||
The path to the file. | ||
""" | ||
job_kwargs["byte_offset"] = 8 | ||
BinaryRecordingExtractor.write_recording(recording, file_paths=file_paths, dtype="int16", **job_kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM.
I think the read small traces test should be removed. No need to test here was is tested already.
I would like to have testing data on gin for this but I think @alejoe91 should make the call if this is necessary or not for this for merging.
Otherwise this has my +1.
src/spikeinterface/core/tests/test_whitematterrecordingextractor.py
Outdated
Show resolved
Hide resolved
from spikeinterface.core.numpyextractors import NumpyRecording | ||
|
||
|
||
def test_round_trip(tmp_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is OK but I would prefer testing data. Can we add something to gin? This should be easy to stub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this is awaiting gin access. Should be up in a day or two.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GIN PR is merged :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, waiting for the test and should be good to go after that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, waiting for the test and should be good to go after that.
Done!
Two minor comments unrelated to the PR content.
|
I'm sorry I didn't follow the recommended forking workflow. I just defaulted to the branching workflow that we use with neuroconv, but I can be more diligent about it in the future.
@h-mayorquin and I decided against including this in neo since there is no header to parse, so it seemed like it wouldn't naturally lend itself to the neo structure. Also worth noting that BinaryRecordingExtractor (the parent of this class) does not depend on neo. |
I agree it's not worth including in NEO at this point! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple comments :)
@@ -0,0 +1,62 @@ | |||
from pathlib import Path | |||
from typing import List, Union, Optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are far enough along in python that we can use the built-in list, but since you're pulling in Union and Optional if you want to use List it doesn't cost extra I suppose.
Co-authored-by: Zach McKenzie <[email protected]>
Any other issues holding up this PR? |
Data and removing of unnecessary test for me. Either Alessio and Sam should take a look as well. |
Not sure why the file is not being found... |
I think our tests do not update the ephy_cache all the time. So I'm wondering if your specific file changes aren't triggering a cache check and so you're not getting the updated version. GIN is down this weekend for maintenance, but if this still isn't working Monday after a cache refresh from the cron job then I think we should explore this more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make the test work and this should be ready to go.
src/spikeinterface/core/tests/test_whitematterrecordingextractor.py
Outdated
Show resolved
Hide resolved
|
||
|
||
file_path = ( | ||
get_global_dataset_folder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not meant to work this way.
You need to use download_dataset
:
See an use here in the common test suite:
And we should check that the data gets in the cache.
Tests are passing now! (minus linux which should be fixed by #3877) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am OK with this.
Fixes #3848
Pretty minimal wrapper around BinaryRecordingExtractor with a specified file_offset, dtype, and gain. As far as I know these should be constant for WhiteMatter files, but I only have one example, and no formal spec from WhiteMatter (so far). So, I think we should keep an eye out for WhiteMatter files in future conversions and be prepared to update this extractor as necessary.