-
Notifications
You must be signed in to change notification settings - Fork 0
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
Constrain shape to 3D to avoid inconsistency in usage #4
Comments
This makes sense. |
Right now main has the constrained version. I also wanted to implement your other comment which I think was a great idea!
BUT, doing this turned out harder than I thought and I am not please with the result, see #7 where this is done. The problem with it is that docval checks the shape of the argument BEFORE the ndx-binned-spikes/src/pynwb/ndx_binned_spikes/__init__.py Lines 64 to 69 in 68a1dc1
In #7 we guarantee that the data will always be Maybe we will be able to do it once this happens: Or do you know other way? I am leaning to just accept |
Though I dislike them as general practice, you could decorate the |
That's if you feel that strongly about it. Otherwise strict input typing to match strict output typing. I'm still not convinced a single unit recording would be that common for this case |
This is clever. Thanks for suggesting it, it did not occur to me before. That said, I think I believe you on this:
And I would go with just not accepting that case. |
OK, I will close this. As this is the way that is already in main and I don't intend to change it. |
related to similar conversations on ndx-microscopy
The ability for an object to have multiple shapes can often be confusing to users and their scripts written to analyze data, which expects it to follow certain consistencies
It also magnifies the complexity of any NWB Inspector checks that need to be written on such objects
Example: a user writes a script to meta-analyze every TwoPhotonSeries on DANDI - they prototyped it on one Dandiset that used a 3D shape - then it errors when they hit a file that uses a 4D convention
The current extension at line https://github.com/catalystneuro/ndx-binned-spikes/blob/main/spec/ndx-binned-spikes.extensions.yaml#L28-L29 allows for a 'single-unit' case for a 2D
data
shape. I would argue that this case is both somewhat rare and could be informative covered by the 3D case with a singleton dimension to cover that single unit case.From discussion, you had reservations about a user writing their data that is single-unit and how they might be confused about why they must add the singleton - but you could always setup the PyNWB based class
__init__
to accept 2D data as a duck type and fill this singleton behind the scenes. This effort to avoid confusion is largely for the consumers of dataAnother alternative, which might be more effort than its worth, would be to make two separate objects for the 2D and 3D cases to be really explicit
The text was updated successfully, but these errors were encountered: