Skip to content

return_scaled to return_in_uV #3794

Merged
samuelgarcia merged 13 commits into
SpikeInterface:mainfrom
h-mayorquin:scale_to_scale_to_uV
Jun 3, 2025
Merged

return_scaled to return_in_uV #3794
samuelgarcia merged 13 commits into
SpikeInterface:mainfrom
h-mayorquin:scale_to_scale_to_uV

Conversation

@h-mayorquin
Copy link
Copy Markdown
Collaborator

@h-mayorquin h-mayorquin commented Mar 21, 2025

OK, so I open this PR for two reasons:

  1. As you can see this will be a massive change and I think that someone (cc @samuelgarcia) really dislikes dealing with merge conflicts so maybe we could just change this in BaseRecording and co get_traces and deal with annoying deprecation messages for a while. That is, we fix the deprecations piecewise here and there.

  2. The named proposed on the meeting, scale_to_uV, will clash with the preprocessing class of the same name. I have chosen return_in_UV as the interpolation of return_scaled and the discussed scale_to_uV but I am happy to change this. return_in_UV is regex-friendly so it should be easy to change if so we decide.

My own preference of course is to merge this as it is and get done with it.

@h-mayorquin h-mayorquin added the deprecations Related to code deprecation label Mar 21, 2025
@h-mayorquin h-mayorquin self-assigned this Mar 21, 2025
@h-mayorquin
Copy link
Copy Markdown
Collaborator Author

h-mayorquin commented Apr 3, 2025

We are going for the way it is now, return_in_uV and we are gonna merge this with all the changes in one go.

@h-mayorquin h-mayorquin marked this pull request as ready for review April 3, 2025 15:13
@yger
Copy link
Copy Markdown
Collaborator

yger commented Apr 4, 2025

Templates has also a field is_scaled. Should it be changed also ? If yes, sortingcomponents needs quite a lot of changes, because we are heavily using return_scaled and is_scaled

@zm711
Copy link
Copy Markdown
Member

zm711 commented Apr 4, 2025

Templates has also a field is_scaled. Should it be changed also ? If yes, sortingcomponents needs quite a lot of changes, because we are heavily using return_scaled and is_scaled

I guess the better named attribute is is_in_uV. But is this suppose to be a private attribute or a public one (in the dev sense). We all know what is_scaled means so do you and Sam hope that some day people will use Template objects to make their own sorters? If so we should be consistent. If this is private and never should be used by others than it is less important to change.

@h-mayorquin
Copy link
Copy Markdown
Collaborator Author

I saw the template thing and I wanted to discussed on the previous maintenance meeting but I forgot. In any case, I think that changes should be its own PR.

Comment on lines +30 to +44
RX1 : BaseRecording
First recording
RX2 : BaseRecording
Second recording
return_scaled : bool | None, default: None
DEPRECATED. Use return_in_uV instead.
If True, compare scaled traces
return_in_uV : bool, default: True
If True, compare scaled traces.
force_dtype : dtype, default: None
If not None, force the dtype of the traces before comparison
check_annotations : bool, default: False
If True, check annotations
check_properties : bool, default: False
If True, check properties
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are passing and I know a lot of like to use keyword, but others on the team tend toward using positional arguments internally. So we risk:

check_recordings_equal(rec1, rec2, True, 'float32', True, False)

which would raise errors rather then putting the deprecation at the end which would allow things to work with positional as well and raise the error if using the wrong keyword. How are you thinking about this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But my point is deprecating across multiple functions and I just took this one as an example.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can move the old parameter to the end if you want.

@samuelgarcia
Copy link
Copy Markdown
Member

Genial. Merci infiniment.
Lets merge this no ?

@yger Lets make another PR after the merge for Templates.is_scaled > Templates.is_in_uV

@samuelgarcia samuelgarcia merged commit 0b69fec into SpikeInterface:main Jun 3, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deprecations Related to code deprecation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants