-
Notifications
You must be signed in to change notification settings - Fork 230
Allow preprocessing on dicts of recordings #3711
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
Allow preprocessing on dicts of recordings #3711
Conversation
Also I think this was Sam who liked keeping this around right @alejoe91 ? I only ever use the function version of all the classes. And I remember a discussion somewhere on the repo about removing classes from init and only exposing the functions moving forward. |
|
Had another go and it feels more beautiful! Added the |
zm711
left a comment
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.
A couple naming things to think about while you wait for Alessio and Sam.
| return preprocessed_recordings_dict | ||
|
|
||
|
|
||
| def define_rec_or_dict_function(source_class, name): |
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.
same for symmetry maybe define_rec_or_dict_function_from_class so that we see that this function is the same as below function but to have a dict_function.
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.
How about: define_function_or_dict_from_class, which is the same as below, but I think is more accurate?
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.
Works for me. I guess the real full name would be define_function_or_dict_of_function_from_class but at some point the name is just too long :P.
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 think we can keep tho original name qnd explain what it does on the docstting for simplicity :)
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 think Zach is right: it's nice to have the same grammar as define_function_from_class. Also added docstrings to both new functions
src/spikeinterface/preprocessing/tests/test_grouped_preprocessing.py
Outdated
Show resolved
Hide resolved
|
This looks good. |
I think we should limit it to recordings or dicts of recordings. It encourages the user to label groups of recordings. Also, if we use lists, we'd probably add a key when we save to keep track of things. But when a user loads it, they'd expect a list. To me, it complexifies the saving/loading. Anyone have a good use case for lists? |
|
This is OK for me. Alessio did a renaming. |
|
All looks good: I corrected the spelling on Thanks for adding it to all the preprocessors @alejoe91 ! Since there's a lot of new preprocessing stuff in the works, the plan is to do a major docs rewrite once some more features are added. |
|
Perfect! As part of this PR, can you modify this doc page to show both strategies? |
|
Oops! |
Hello, this shows how to split, preprocess then aggregate so the user can then sort. So I think we need to get something like #3767 merged before updating the docs and suggesting users use this. |
|
Oups! I merged the absolute imports and a bunch of small conflicts showed up... |
…ow/spikeinterface into group-splitting-in-pp
…rishalcrow/spikeinterface into group-splitting-in-pp" This reverts commit 3c40783, reversing changes made to 5c2c7a3. I did something weird
This reverts commit 5c2c7a3.
This reverts commit c50a773.
|
Ughhh, got a new machine and have made a mess... gimme a minute... |
|
I made too much of a git mess. See new PR here: #3773 |
|
Favorite commit message maybe ever. |
This PR would allow user to pass dicts of recordings to all preprocessing classes (for now: just common reference!)
This would allow for the following syntax:
which can be chained without problem. Also allows for users to take in two sessions from e.g. different days and ensure the same preprocessing steps are applied to them. Or helpful if you want to split your recording in half and sort seperately (UnitMatch almost do this).
This would certainly remove a few annoying for loops from our labs' pipeline.
We agreed to not touch the
BaseRecordingclass. I made thedefine_function_or_dict_from_class, which looks through theargsandkwargsfor a recording or dict of recordings, then applies either the normal function (e.g.CommonReferenceRecording) or produces a dict, where each recording has had the normal function applied to it, keeping the original keys. I've copied the signature, doc and set a new name in the function, rather than calling another decorator (alaspikeinterface/spikeinterface/core/core_tools.py
Line 25 in c837b3b
Also, note that this only works for the functions. So
common_reference(dict_of_recs)is good butCommonReferenceRecording(dict_of_recs)does not work. This seems ok from the user point of view, but maybe there's some deeper issue with loading that I'm not thinking of??