Skip to content

SkyCoord/BaseFrame.represent_as does not treat differentials very logically #11477

Closed

Description

@mhvk

Right now, things get transformed a bit too eagerly to having all velocity components present, while really we should not make up numbers:

from astropy.coordinates import SkyCoord
from astropy import units as u

sc = SkyCoord(10*u.deg, 10*u.deg, radial_velocity=-10*u.km/u.s)
sc
<SkyCoord (ICRS): (ra, dec) in deg
    (10., 10.)
 (radial_velocity) in km / s
    (-10.,)>

sc.data.differentials
{'s': <RadialDifferential (d_distance) in km / s
     (-10.,)>}

sc.represent_as('spherical')
<SphericalRepresentation (lon, lat, distance) in (rad, rad, )
    (0.17453293, 0.17453293, 1.)
 (has differentials w.r.t.: 's')>

sc.represent_as('spherical').differentials
{'s': <SphericalDifferential (d_lon, d_lat, d_distance) in (km rad / s, km rad / s, km / s)
     (2.22044605e-16, -2.22044605e-16, -10.)>}

Here, there is no reason to move to a SphericalDifferential and set the proper motions to zero - rather, just stick with the RadialDifferential since that is compatible with SphericalRepresentation. Needs some adjustment in BaseFrame.represent_as (and perhaps in _get_repr_classes).

p.s. The current process is blocking #11467.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions