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
For Quantity and Time, an implicit conversion can be made during initialization:
In [1]: fromastropyimportunitsasuIn [2]: q=3*u.mIn [3]: u.Quantity(q, u.km)
Out[3]: <Quantity0.003km>
In [8]: fromastropy.timeimportTimeIn [9]: t=Time.now()
In [10]: tOut[10]: <Timeobject: scale='utc'format='datetime'value=2018-07-2910:19:22.232158>In [11]: Time(t, scale='tai')
Out[11]: <Timeobject: scale='tai'format='datetime'value=2018-07-2910:19:59.232158>
However, this is not the case for SkyCoord:
In [4]: fromastropy.coordinatesimportSkyCoordIn [5]: c=SkyCoord.from_name('m31')
In [6]: cOut[6]:
<SkyCoord (ICRS): (ra, dec) indeg
(10.6847083, 41.26875)>In [7]: SkyCoord(c, frame='galactic')
---------------------------------------------------------------------------ValueErrorTraceback (mostrecentcalllast)
<ipython-input-7-785076b7254e>in<module>()
---->1SkyCoord(c, frame='galactic')
~/Dropbox/Code/Astropy/astropy/astropy/coordinates/sky_coordinate.pyin__init__(self, copy, *args, **kwargs)
223# creating the internal self._sky_coord_frame object224args=list(args) # Make it mutable-->225kwargs=self._parse_inputs(args, kwargs)
226227frame=kwargs['frame']
~/Dropbox/Code/Astropy/astropy/astropy/coordinates/sky_coordinate.pyin_parse_inputs(self, args, kwargs)
358# by keyword args or else get a None default. Pop them off of kwargs359# in the process.-->360frame=valid_kwargs['frame'] =_get_frame(args, kwargs)
361362# TODO: possibly remove the below. The representation/differential~/Dropbox/Code/Astropy/astropy/astropy/coordinates/sky_coordinate.pyin_get_frame(args, kwargs)
1823raiseValueError("Cannot override frame='{0}' of input coordinate with "1824"new frame='{1}'. Instead transform the coordinate."->1825 .format(coord_frame_cls.__name__, frame_cls.__name__))
18261827frame_cls_kwargs= {}
ValueError: Cannotoverrideframe='ICRS'ofinputcoordinatewithnewframe='Galactic'. Insteadtransformthecoordinate.
Is there any reason not to allow this? It would be nice if this worked for consistency with Quantity and Time, and would avoid special-casing SkyCoord in the APE14 implementation of celestial coordinates.
The text was updated successfully, but these errors were encountered:
For
Quantity
andTime
, an implicit conversion can be made during initialization:However, this is not the case for SkyCoord:
Is there any reason not to allow this? It would be nice if this worked for consistency with Quantity and Time, and would avoid special-casing SkyCoord in the APE14 implementation of celestial coordinates.
The text was updated successfully, but these errors were encountered: