-
Notifications
You must be signed in to change notification settings - Fork 59
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
ASDF handling of numpy scalar values (and scalar precision) #1519
Comments
Some guidance is already provided in the standard for integers: One thought, which I think is in partial agreement with what @perrygreenfield described would be to say that scalars in the tree can be:
|
Copying from: #1605 (comment) """ |
Linking this to asdf-format/asdf-standard#396, which is a proposal to add a |
I wonder if this is another instance of trying to do too much with ASDF, similar to the argument I made about tuples previously. What sense is there in storing float16 scalars in an ASDF file? I am leaning towards thinking that if people want to deal with these in a consistent way, it is for them to address it specifically rather than add things like dtypes to scalar floats. Can we just assume they are doubles and leave it at that? |
Based off discussions in recent PRs:
#1474 (comment)
#1475 (comment)
ASDF (and the ASDF standard) should likely clarify how to handle scalar values.
For a short example of what should be clarified. Suppose a user adds a scalar (non-array) 'numpy.uint8' to the tree, then saves, then loads the tree. Should the value be a 'numpy.uint8', int?
To summarize the discussion so far based off contributions by @perrygreenfield
What should the standard require?
Perhaps support for "The greatest common types for integers, floats and complex values across standard platforms... int64, float64 and complex128". With larger types possibly supported with associated metadata.
What is required for round-tripping?
"Up to the library", so for python:
How should numpy scalars that fit within the standard scalar?
The library will return the largest (standard) type which can violate round-tripping. Any user that expects a 'numpy.uint8' to stay a 'numpy.uint8' (and not be promoted to an int) should convert the value separately.
The text was updated successfully, but these errors were encountered: