-
Notifications
You must be signed in to change notification settings - Fork 6
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
Zero-dimensional arrays should be accepted as scalars #14
Labels
Comments
I agree, it would be nice for this to work. Would you be interested in contributing a patch? |
I have to admit that the validation code looks quite complicated to me (does it have to be that complicated?), so I do not want to mess too much with it. I think I have a fix that works though... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, zero-dimensional arrays get rejected on
NumericalTrait(ndim=0)
, as the latter requires the value to benp.isscalar
. Unfortunatelynp.isscalar(np.array(1)) == False
. The error is particularly annoying in conjunction with quantities, asquantities.Quantity
is a subclass ofnp.ndarray
and thus it's instances are not numpy array scalars.The text was updated successfully, but these errors were encountered: