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
{{ message }}
Repository navigation
Creating a PhysicsSphericalRepresentation with NaNs raises RuntimeWarning #11558
This is not exactly a bug, but inconsistent behavior between the different spherical representations. For example, the following code will raise a RuntimeWarning (and thus error in pytest) if the representation is PhysicsSpherical, but not Spherical.
fromastropy.coordinatesimportPhysicsSphericalRepresentationfromastropy.coordinates.matrix_utilitiesimportrotation_matriximportastropy.unitsasuimportnumpyasnps1=PhysicsSphericalRepresentation(
phi=[1, 2] *u.deg, theta=[3, 4] *u.deg, r=[5, np.nan] *u.kpc)
matrix=rotation_matrix(-10, "z", u.deg)
# THIS PART RAISES THE WARNINGexpected= (s1.to_cartesian().transform(matrix).represent_as(PhysicsSphericalRepresentation))
The reason for this is in the initialization of PhysicsSphericalRepresentation
As discussed in #11568, on numpy < 1.19, it is not just the wrapping that causes a warning, but also the comparison of the inclination (as noted on top).
Activity
mhvk commentedon Apr 14, 2021
the problem is actually a line above, in
.wrap_at, and the simpler example should bethe basic warning is raised by
mhvk commentedon Apr 14, 2021
Oddly, in
Longitude._wrap_internalthere is anwith np.errstate(invalid='ignore')for this, but not inAngle.wrap_at.mhvk commentedon Apr 15, 2021
As discussed in #11568, on numpy < 1.19, it is not just the wrapping that causes a warning, but also the comparison of the inclination (as noted on top).