-
Notifications
You must be signed in to change notification settings - Fork 8
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
require sample axis to be axis=0 #254
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## development #254 +/- ##
===============================================
+ Coverage 97.09% 97.15% +0.06%
===============================================
Files 20 20
Lines 1857 1863 +6
===============================================
+ Hits 1803 1810 +7
+ Misses 54 53 -1 ☔ View full report in Codecov by Sentry. |
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.
My vote would be to have axis just not be allowed at all. Since the behavior cannot be modified, it feels a bit confusing to set it.
Co-authored-by: William F. Broderick <[email protected]>
…ute/nemos into bug_fix_sample_axis_basis
This PR fixes a corner-case bug related to basis in
mode="conv"
.Issue
Before this PR, one could pass at basis initialization any kwargs from
nemos.convolve.create_convolutional_predictor
. This includedaxis
meaning that one could specify what's the axis along which the convolution is applied.What happened in
basis.compute_features
is that the axis is transposed to the first, and the rest of the axis are flattened to the second axis, so that the compute_features returns an 2darray. However, when the basis is composite, the we check that the number of samples matches for all input, and this check relied on the fact that the sample axis isaxis=0
.This caused the following corner case:
Solution
Instead of complicating the check logic, or move it after the transposition happens for all 1D basis, I simplified our life and enforced that the sample axis is always the first one. This is always true for pynapple, and requires the user to transpose an array if the data are organized differently;
Now the initialization would raise an error if axis different from 0 is passed.