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
Commit 8acef8e
Browse filesBrowse the repository at this point in the historyBrowse files
Add in_frame_units kwarg and move unit shifting into frame represent_as()
Two coupled but significant changes. BaseCoordinateFrame.represent_as() is
now capable of returning a representation that has the frame units which
are specified in the representation_attrs[<ReprClass>]['frame_units'] dict.
In other words the returned representation is in the frame units (e.g.
degrees for ra,dec) instead of the native units (e.g. rad for Spherical).
This unit shifting functionality was moved out of __repr__ into
represent_as().
To achieve this a new "in_frame_units" kwarg was added which defaults to
False (reproducing the previous behavior). Along with that the repr. cache
is now keyed by the tuple (Repr class name, in_frame_units).
This change solves a latent problem that was not apparent previously because
all built-in frames have a default SphericalRepresentation. If instead you
start from a CartesianRepresentation there is an issue::
>>> c = ICRS(x, y, z, representation=CartesianRepresentation)
>>> c.spherical
# Output is in radians, not degrees, giving a non-useful view
# of the spherical representation
With this commit the `spherical` property calls represent_as with
in_frame_units=True and the desired units of degrees are returned.
0 commit comments