You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically, my interpretation is that zeros(a.shape, dtype=foo) == zeros_like(a, dtype=foo).
This does not seem to be the case for Quantity from astropy (and maybe other array libraries sharing some specific mechanism).
(Which caused some issue in Astropy, see astropy/astropy#13276, from a change in Matplotlib, see matplotlib/matplotlib#22929. But more importantly, zeros_like does not appear to work as stated in the documentation. Not sure if this is a numpy or astropy issue though, but it is the numpy documentation that seems wrong.)
After checking the code a bit, I realize that maybe the like in zeros_like is similar to the like keyword in zeros? In that case, I guess that the documentation should be clarified to reflect that.
After checking the code a bit, I realize that maybe the like in zeros_like is similar to the like keyword in zeros?
Yes it is. I expect this is fully in astropy's domain. The only thing is that like= is slightly restrictive, because like=[1, 2, 3] will not work (must already be an "array" and not something that would be converted to a NumPy array, like a list; Although that could be modified).
Describe the issue:
According to the documentation of
zeros_like
(and related functions), providingdtype
will override the provided data type: https://numpy.org/doc/stable/reference/generated/numpy.zeros_like.htmlBasically, my interpretation is that
zeros(a.shape, dtype=foo) == zeros_like(a, dtype=foo)
.This does not seem to be the case for
Quantity
fromastropy
(and maybe other array libraries sharing some specific mechanism).(Which caused some issue in Astropy, see astropy/astropy#13276, from a change in Matplotlib, see matplotlib/matplotlib#22929. But more importantly,
zeros_like
does not appear to work as stated in the documentation. Not sure if this is a numpy or astropy issue though, but it is the numpy documentation that seems wrong.)Reproduce the code example:
Error message:
No response
NumPy/Python version information:
1.22.3 3.9.12 | packaged by conda-forge | (main, Mar 24 2022, 23:17:03) [MSC v.1929 64 bit (AMD64)]
The text was updated successfully, but these errors were encountered: