BUG: Frame attributes in sky coordinates do not obey Numpy broadcasting rules
See original GitHub issueOriginally prompted by @mhvk in https://github.com/astropy/astropy/pull/8805#discussion_r291744415.
The crux of the issue is this: this doesn’t work:
from astropy import units as u
from astropy.coordinates import FK5
from astropy.time import Time
FK5(0*u.deg, 0*u.deg, equinox=time.Time(['J2000', 'J2001']))
whereas this does:
FK5([0]*2*u.deg, [0]*2*u.deg, equinox=Time(['J2000', 'J2001']))
The latter proves that there’s nothing in the machinery to prevent this all working the way you’d want, but the fact that the former fails is a sign that the broadcasting is not working the way you’d expect - e.g. 1 + np.random.randn(2)
works just fine so it seems like the former example here should.
I consider this a bug because it was always the intent for broadcasting to work naturally in places like this.
cc @adrn
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Broadcasting — NumPy v1.24 Manual
When the trailing dimensions of the arrays are unequal, broadcasting fails because it is impossible to align the values in the rows of...
Read more >astropy/CHANGES.rst at main - GitHub
Fixed a bug due to which naxis , pixel_shape , and pixel_bounds attributes of astropy.wcs.WCS were not restored when an astropy.wcs.WCS object was...
Read more >pyuvdata.utils — pyuvdata 2.2.9 documentation - Read the Docs
List standard FITS header items that are still should not be included in ... of float numpy array, shape (Npts, 3), with ECEF...
Read more >Tutorial maputils module — Kapteyn Package 2.3b6 ...
Module maputils provides methods to draw a graticule in a plot showing the world coordinates in the given projection and sky system. One...
Read more >Astropy Documentation - The University of Texas at Austin
If Numpy is not already installed in your Python environment, ... celestial coordinates, see the astropy.coordinates package.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I agree with that.
See also discussion following https://github.com/astropy/astropy/pull/13398#discussion_r929752132, which showed that even the person who wrote the initial code continues to think that broadcasting works, when it at present does not. EDIT: see in particular some failures described in https://github.com/astropy/astropy/pull/13398#discussion_r931151751