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
SkyCoord.transform_to(other) ignores other.equinox if default #5722
Transforming from one frame to another acts differently depending on whether the destination frame's equinox was its default value or explicitly passed to the constructor.
The frame attributes (e.g. equinox or obstime) for the returned object depend on the corresponding attributes of SkyCoord object and the supplied frame, with the following precedence:
Non-default value in the supplied frame
Non-default value in the SkyCoord instance
Default value in the supplied frame
So how can I deal with this and transform from original to other and get something in the other frame? Is there a function that yields a frame with default values made explicit?
Should we add a flag to transform_to(...,taking_destination_defaults=) or make a new function transform_to_taking_destination_defaults() (names to be discussed)?
So how can I deal with this and transform from original to other and get something in the other frame? Is there a function that yields a frame with default values made explicit?
The simple solution is to explicitly specify the attributes you care about. But doing this is a generic way is not possible with an existing method, but is straightforward with access to private attributes:
In [48]: c = SkyCoord(1 * u.deg, 0 * u.deg, frame='fk5')
In [49]: print(c._equinox)
None
In [50]: for attr in c.frame_attributes:
...: setattr(c, '_' + attr, getattr(c, attr))
...:
In [51]: print(c._equinox)
J2000.000
In [52]: print(c.equinox)
J2000.000
So maybe we could add a method like harden_attributes which does the simple loop above and has the effect of making "soft attributes" that derive from defaults turn into "hard attributes" which were explicitly set by the user.
Activity
dmopalmer commentedon Jan 22, 2017
This seems to be related to #3106 where @eteq @taldcroft @cdeil @astrofrog agreed that this behavior is what it should be. It is in the
transform_to()documentation.So how can I deal with this and transform from original to other and get something in the other frame? Is there a function that yields a frame with default values made explicit?
Should we add a flag to
transform_to(...,taking_destination_defaults=)or make a new functiontransform_to_taking_destination_defaults()(names to be discussed)?As it is now:
will sometimes fail.
dmopalmer commentedon Jan 22, 2017
Also, the documentation block from the
SkyCoord.transform_to()documentation should be replicated in theBaseCoordinateFrame.transform_to()documentation.SkyCoord.position_angle bug fix
Merge pull request astropy#5715 from larrybradley/sigclip
taldcroft commentedon Jan 23, 2017
The simple solution is to explicitly specify the attributes you care about. But doing this is a generic way is not possible with an existing method, but is straightforward with access to private attributes:
So maybe we could add a method like
harden_attributeswhich does the simple loop above and has the effect of making "soft attributes" that derive from defaults turn into "hard attributes" which were explicitly set by the user.SkyCoord.position_angle bug fix
SkyCoord.position_angle bug fix
mhvk commentedon Mar 4, 2017
fixed by #5723