-
Notifications
You must be signed in to change notification settings - Fork 216
Remove classes from extractor and preprocessing __init__
#3898
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
I'll fix the other imports :) I should have know we were using classes internally rather than the functions.... I just tested locally with importing extractors and preprocessors. But let me know if people are okay with this before I make a million more tweaks :) |
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 are many things that I don't remember about the importing system so my comments are questions more than requests.
Suggestions:
I think if we want to make change easier for people that relied on the class names we can create something like the extractor_list
but with a more explicit names
extractor_classees
?
So instead of:
from spikeinterface.extractors import AnExtractror`
they do:
from spikeinterface.extractors.extractor_classes import AnExtractor
Seems like an easy change to make that would also allow us to keep the privilege naming that you guys want (the read_extractor
functions) as the unique access at spikeinterface.extractors
.
|
||
# NWB sorting/recording/event | ||
from .nwbextractors import ( | ||
NwbRecordingExtractor, | ||
NwbSortingExtractor, | ||
NwbTimeSeriesExtractor, | ||
NwbTimeSeriesExtractor, # @Heberto/Alessio what do we do with this |
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.
make a class read_nwb_timeseries
or something like that?
Or what is the question?
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 never use these functions so I just wasn't sure if I should make a read_nwb_timeseries
so that answers that question. The other question was is that an event extractor or something else? and should I just list read_nwb
for all of them or should I give each one separately?
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.
no, is a recording extractor for different type of data.
Also, do not listen read_nwb, I don't think it behaves like all those other functions and is not well maintained.
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.
Should I not be using read_nwb
?? It's what I use to test that our labs nwb files are working as expected.
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.
sounds good from my end. I'll expose read_nwb
but won't preference. :) Best of luck Chris :)
I like this. I would be happy to change the file name and switch to extractor classes to make this clear as long as @alejoe91 and @samuelgarcia are okay with that :) |
* Heberto discussion for nwb_timeseries * Alessio for how the full_dict should work
for more information, see https://pre-commit.ci
hopefully I fixed all the files, but the CI will tell me.
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.
missing extractor class change
src/spikeinterface/extractors/tests/test_cbin_ibl_extractors.py
Outdated
Show resolved
Hide resolved
src/spikeinterface/extractors/tests/test_nwbextractors_streaming.py
Outdated
Show resolved
Hide resolved
src/spikeinterface/extractors/tests/test_whitematterrecordingextractor.py
Outdated
Show resolved
Hide resolved
for more information, see https://pre-commit.ci
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 ran the tests suite on neuroconv and it is working. Let me know when it is ready so I can run them again.
# the warning and then returns the "function" version which will look the same | ||
# to the end-user | ||
# to be removed after version 0.105.0 | ||
def __getattr__(extractor_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.
Amazing, you are doing very sophisticated stuff. Maybe too much for me but I really admire.
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.
It was a pain to get working. But Heberto makes a great point that we don't want to pull the rug out from under our devs who build off of spikeinterface. So we warn them for a couple versions then wee can clean this all up.
Vous êtes tous incroyables! |
Been using the preprocessing imports from this PR when developing #3438 and they work a treat. So all good from me :) |
Last thing we need is for @h-mayorquin to run neuroconv testing suite one more time to make sure I didn't make a mistake when converting the nested dict. Then once testing is fixed I think I'm done with this! |
LGTM! You can merge when you want @h-mayorquin @zm711 |
OK, for me. |
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.
LGTM
I went with the hard ones to start with hahah. I figured a lot of the other ones would be easier to do. Let me know what you think about this strategy.
For preprocessors this changes nothing-- it just ensures that the class and function are lined up and then only imports the functions. Example here:

For extractors this is much harder and makes one potentially controversial change. When we convert from class to function we were keeping the name of the class (in the python sense not in a class attribute sense, but to make this work we need to change the class name to be the
read_function
name. Since we want our users to only see the function I think this should be fine, but maybe someone is super against this. Or maybe we make the wrapper function a bit more complex like for the dict example that @chrishalcrow did? I think keeping the name is probably better for provenance actually.Small example here:
