Skip to content

Can't specify differential class in frame init #6314

@adrn

Description

@adrn

One of the nice things about the frame classes is that you can specify a representation class, and the expected kwarg names change accordingly:

>>> icrs = coord.ICRS(x=1*u.pc, y=2*u.pc, z=3*u.pc, 
...                   representation=coord.CartesianRepresentation)
>>> icrs
<ICRS Coordinate: (x, y, z) in pc
    ( 1.,  2.,  3.)>

I had originally made it so that this would work with a differential class as well, but that no longer seems to be the case (because of some changes @mhvk made in #6219). An implication of this is that the velocity components always have to be specified with the component names corresponding to the default differential. For most frame classes, this is SphericalCosLatDifferential, so proper motions always have to be coslat. However, it would be nice to be able to do something this:

icrs = coord.ICRS(ra=8.67*u.degree, dec=53.09*u.degree,
                  pm_ra=4.8*u.mas/u.yr, pm_dec=-15.16*u.mas/u.yr,
                  differential_cls={'s': coord.SphericalDifferential})

when someone doesn't want to include the cos(dec).

Or, for cartesian components:

icrs = coord.ICRS(x=1*u.pc, y=2*u.pc, z=3*u.pc, 
                  v_x=10*u.km/u.s, v_y=11*u.km/u.s, v_z=12*u.km/u.s,
                  representation=coord.CartesianRepresentation,
                  differential_cls={'s': coord.CartesianDifferential})

cc @eteq @mhvk

Metadata

Metadata

Assignees

No one assigned

    Labels

    Affects-devPRs and issues that do not impact an existing Astropy releaseBugcoordinates

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions