-
Notifications
You must be signed in to change notification settings - Fork 189
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
Add Template class #1982
Add Template class #1982
Conversation
…' into add_template_data_class
@alejoe91 @samuelgarcia The only thorny issue for me is mismatch between passing a templates_array that is dense but a sparsity mask. We have some options:
I prefer the first but knowing that you like permisive methods and flexibility we have 3. |
@h-mayorquin I agree that in that case we should throw an error in the post_init |
@h-mayorquin we reached the deprecation deadline!! Fixed here: #2048 |
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.
One question for the docstring. Is there a design reason why you wouldn't want nbefore
and nafter
next to each other in the docstring? I'm not super used to data classes in general so maybe the docstring is enforced in this way, but at least from an ease of reading for me it would make sense to have the related concepts together.
src/spikeinterface/core/template.py
Outdated
from .sparsity import ChannelSparsity | ||
|
||
|
||
@dataclass(kw_only=True) |
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.
One other comment based on my googling kw_only
is a 3.10+ ( I think 3.8 and 3.9 are suppose to be supported).
https://docs.python.org/3/library/dataclasses.html
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.
@h-mayorquin can you remove it then?
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.
Yes.
This is another shortcoming of only having tests for python 3.10 only.
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.
Very minor docstring changes, then it's good to go for me! Thanks @h-mayorquin
|
||
# If any channel is non-zero outside of the active channels, then the waveforms are not sparse | ||
excess_zeros = waveforms[..., num_active_channels:].sum() | ||
|
||
return int(excess_zeros) == 0 |
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.
Not sure to be happy with this.
This is computationaly costy. For me the shape is enough.
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 for now. If this becomes problematic later we'll fix it.
NOTE: this assumes that the extra channels are zero-padded!
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.
Added a boolean to deactivate this.
Thanks for the comments about the docstrings @zm711 . I drop this for a bit but I am back to it and will change them. |
Co-authored-by: Alessio Buccino <[email protected]>
…' into add_template_data_class
@zm711 |
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 dividing the parameters like you have looks nice and clears up the confusion of having related parameters so spread about (for me at least). Thanks @h-mayorquin
Co-authored-by: Zach McKenzie <[email protected]>
Co-authored-by: Zach McKenzie <[email protected]>
This is should be ready btw @alejoe91 @samuelgarcia |
Co-authored-by: Zach McKenzie <[email protected]>
First draft. I am putting this out early to get feedback.
Right now the class implements two functionalities.
np.mean
). For this see the test.