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
fromastropy.timeimportTimefromastropyimportcoordinatesascoordnow=Time.now()
# create a tuple of CartesianRepresentations with different unitsearth=coord.get_body_barycentric_posvel("earth", now)
print(earth)
(<CartesianRepresentation (x, y, z) inAU
(0.86689474, -0.47190455, -0.2046662)>,
<CartesianRepresentation (x, y, z) inAU/d
(0.00857658, 0.01346705, 0.00583879)>)
bad_units=coord.SkyCoord(earth)
print(bad_units)
<SkyCoord (ICRS): (ra, dec, distance) in (deg, deg, AU/d)
[(331.43780716, -11.7147513 , 1.00801222),
( 57.50870768, 20.08731918, 0.01700031)]>
Notably, the resulting SkyCoord splits the difference in terms of units, giving the angular components units of degrees and the radial component units of velocity. I'd suggest that initialization of the SkyCoord should fail rather than silently produce a inconsistent result if given inconsistent units.
I'm using astropy version 3.0.4 and numpy version 1.15.0 with python 3.7 under archlinux.
The text was updated successfully, but these errors were encountered:
Ah, here this specific issue is because the second object returned by earth is a velocity. But it's strange that it's returned as a separate object instead of as a differential attached to the position...
Yes, returning a tuple predates us having the ability of storing velocities as part of a representation. I don't know that we can trivially change that, but at least we should give the option of including it as a derivative (either via an argument or another function; e.g., it could use get_body, which already returns a SkyCoord of the position).
Separately, though, the example should really error since (I think) the result is interpreted as a stack of two coordinates, but those have inconsistent units. So, it is definitely a bug from that perspective.
Indeed, thinking that it should return a differential attached to a position is how I discovered this bug!
You can see the discussion and my subsequent enlightenment here: #7743
Here's a MWE:
Notably, the resulting SkyCoord splits the difference in terms of units, giving the angular components units of degrees and the radial component units of velocity. I'd suggest that initialization of the SkyCoord should fail rather than silently produce a inconsistent result if given inconsistent units.
I'm using astropy version 3.0.4 and numpy version 1.15.0 with python 3.7 under archlinux.
The text was updated successfully, but these errors were encountered: