-
Notifications
You must be signed in to change notification settings - Fork 84
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
Allow arbitrary precision for generic numeric types #1631
Comments
Makes sense to me if the validation for "int" would be "any precision". Often these numbers are small like a TTL so int8 would be sufficient. Or, at very least, the error should be specific and say what is required (int32) because "int" is ambiguous (and does not exist in Matlab, it has int8, int16, int32, single etc). |
Yes, that is my preference as well. I can't find the reference right now, the closest I could find was #698 (comment). But we have that defined somewhere in the schema. @bendichter Does the file really contain |
Decision from meeting: map "int" to "int8" in the language and in the HDMF library, effectively allowing any precision of integer for anything labeled "int". It will also require a change to the PyNWB validator.
@rly am I missing anything? |
"int"
and "float"
As a note, if the id columns of a I am OK with changing the meaning of "int" to int8, implemented here: hdmf-dev/hdmf-schema-language#38 But note that the only areas where "int" is used nowadays is in |
What would you like to see added to PyNWB?
I just got this question from @urut
The answer is
int32
, but I think this brings up a good point, and this is a common hurdle users producing NWB files outside of PyNWB.IMO, specifying type precision this way has two problems:
int
can be shorthand forint32
, but that isn't always the case: MATLAB does not have a default integer precision (int64(5)
works butint(5)
does not) and the default precision for floats is double (64). Of course when you are creating a variable you must choose a precision, but when used in a schema to me it's more natural to interpret this anint
of any precision in this case.Is your feature request related to a problem?
No response
What solution would you like?
My most preferred solution would be to map "int" to "int8", "uint" to "uint8", and "float" to "float8". I'm pretty sure this would not invalidate any currently valid NWB files and would not break any tools.
If there is some reason why keeping single-precision is important, then my next favorite solution would be to change the schema to make the data requirement explicit, changing all instances of "int" to "int32".
If that is too big of a lift, then another solution that would at least move us in the right direction would be to enhance the messages produced by the validator to be explicit about the precision requirement.
Do you have any interest in helping implement the feature?
Yes.
Code of Conduct
The text was updated successfully, but these errors were encountered: