-
Notifications
You must be signed in to change notification settings - Fork 67
477 n-dimensional tuning curves #478
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
also changed f0 -> feature0
sjvenditto
reviewed
Jul 18, 2025
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've left a few final comments that are more inconsequential, so let me know your thoughts on if you want to put in these small changes -- otherwise, this one's just about done!
sjvenditto
approved these changes
Jul 21, 2025
gviejo
reviewed
Jul 21, 2025
gviejo
approved these changes
Jul 30, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This combines:
compute_1d_tuning_curves
compute_1d_tuning_curves_continuous
compute_2d_tuning_curves
compute_2d_tuning_curves_continuous
into a generalised n-dimensional
compute_tuning_curves
, which now returns anxarray.DataArray
(new dependency).The old functions are still available, but they call the new one under the hood and show a
DeprecationWarning
.A couple of notes (these clarify why I had to make some changes to the old tuning curve function tests):
for
compute_1d_tuning_curves
, we were usingfeatures.rate
to scale the tuning curves to Hz, but if one passesepochs
that are bigger than that of the input features, this results in an incorrect computation of the rate and thus incorrect tuning curves.FIXES: we now compute the rate as
1/np.mean(features.time_diff(epochs))
.There further is an optional
fs
argument, for if you want to pass the exact sampling rate yourself.for
compute_1d_tuning_curves_continuous
andcompute_2d_tuning_curves_continuous
, we were usingnp.digitize
to bin, but this does not include the rightmost edge , unlikenp.histogram
.FIXES: we now use
np.histogram
for all tuning curves.Hence, the new function is more consistent, as all tuning curves will now include the rightmost edge.
I have further updated all the notebooks and docs to use the generalised function.
The new
xarray.DataArray
output allows for some more concise plotting in a lot of the notebooks.At the moment, the decoding is still separated into 1D and 2D, generalising that will be another PR.
For now, I am transforming the
xarray.DataArrays
into the respective old formats, such that the decoding functions still work.