-
Notifications
You must be signed in to change notification settings - Fork 191
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 int
type to num_samples
on InjectTemplatesRecording
.
#3229
Add int
type to num_samples
on InjectTemplatesRecording
.
#3229
Conversation
Yes, we have been using |
Also we have switched to all native typing rather than the typing module types. So all the uses of |
Great thanks both I'll make some changes to this module then request review |
One consideration, |
It'll be the sixth republic before Sam let's us do static type checking. So we've worked under the |
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.
numpydoc standard requires a space before the colon after an argument. So the final format is:
arg : float, default: 5.0
we put a space before the first colon since it is required for the linter, but not for the second one. This is Chris's project, but I figure we can help him out a little ;)
src/spikeinterface/core/generate.py
Outdated
The recording over which to add the templates. | ||
If None, will default to traces containing all 0. | ||
num_samples: list[int] | int | None | ||
num_samples: list[int] | int | None, default: None |
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.
num_samples: list[int] | int | None, default: None | |
num_samples : list[int] | int | None, default: None |
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 it not be optional in the case of None?
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.
As in the default: None
part? I'm not sure on this @zm711 may know, happy to make any changes as required
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.
Yeah, this is an issue where we had previously agreed that None would be default: None
so much of the code base has been transitioning over to that style. But more recently we had a discussion about using num_samples : list[int] | int | None, optional
as an alternative style. Maybe we should add this to a maintenance meeting that way we can all discuss this in person and make sure we are all on the same page with the style. We could do a quick vote to make sure everyone agrees on which of the two styles.
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.
Nice this sounds good, I think I prefer default: None
for consistency and it is clearer than optional
if you don't know much about typing. If most of the code is default: None
shall I leave this for now and we can discuss at the meeting?
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'm fine with that for now :)
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.
All right if you find those semantics clearer.
int
type to num_samples
on InjectTemplatesRecording
.
Co-authored-by: Zach McKenzie <[email protected]>
Co-authored-by: Zach McKenzie <[email protected]>
Co-authored-by: Zach McKenzie <[email protected]>
Co-authored-by: Zach McKenzie <[email protected]>
Co-authored-by: Zach McKenzie <[email protected]>
Co-authored-by: Zach McKenzie <[email protected]>
Co-authored-by: Zach McKenzie <[email protected]>
Co-authored-by: Zach McKenzie <[email protected]>
Co-authored-by: Zach McKenzie <[email protected]>
Co-authored-by: Zach McKenzie <[email protected]>
Co-authored-by: Zach McKenzie <[email protected]>
Co-authored-by: Zach McKenzie <[email protected]>
Co-authored-by: Zach McKenzie <[email protected]>
Co-authored-by: Zach McKenzie <[email protected]>
Co-authored-by: Zach McKenzie <[email protected]>
for more information, see https://pre-commit.ci
…interface into fix_type_hint_generate
Thanks both! I've applied changes and made some further changes to docstrings, re-requested review |
src/spikeinterface/core/generate.py
Outdated
Number of units. | ||
sampling_frequency : float | ||
sampling_frequency : float, default: 30000.0 (in Hz) |
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.
For these sampling frequency default values I don't know if they should be (in Hz) vs having the (in Hz) down in the actual description. So for me I would prefer:
sampling_frequency : float, default: 30000.0
The sampling rate entered in Hz. (or samples/second)
opinions @chrishalcrow @h-mayorquin ?
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'd personally prefer the Hz to be in the description, so that a user can copy and paste the default value and it would work.
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.
Agree I prefer in the description I will make the change
@JoeZiminski one more discussion point and then a couple of typos :) |
Co-authored-by: Zach McKenzie <[email protected]>
Co-authored-by: Zach McKenzie <[email protected]>
Co-authored-by: Zach McKenzie <[email protected]>
Thanks @zm711! After all that talk of codespell I should actually remember to run it locally 😆 |
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
Adds a missing case for the
num_samples
parameter type hint onInjectTemplatesRecording
. @zm711 @h-mayorquin was the consensus to changeUnion
andOptional
to|
in type hints? If so should these be changed in this module?