[docs]classBaseCoordinateFrame(abc.ABC):""" API Definition for a Coordinate frame """_prop:FrameProperties""" The FrameProperties object holding properties in native frame order. """@property@abc.abstractmethoddefnaxes(self)->int:""" The number of axes described by this frame. """@property@abc.abstractmethoddefname(self)->str:""" The name of the coordinate frame. """@property@abc.abstractmethoddefunit(self)->tuple[u.Unit,...]:""" The units of the axes in this frame. """@property@abc.abstractmethoddefaxes_names(self)->tuple[str,...]:""" Names describing the axes of the frame. """@property@abc.abstractmethoddefaxes_order(self)->tuple[int,...]:""" The position of the axes in the frame in the transform. """@property@abc.abstractmethoddefreference_frame(self):""" The reference frame of the coordinates described by this frame. This is usually an Astropy object such as ``SkyCoord`` or ``Time``. """@property@abc.abstractmethoddefaxes_type(self):""" An upcase string describing the type of the axis. Known values are ``"SPATIAL", "TEMPORAL", "STOKES", "SPECTRAL", "PIXEL"``. """@property@abc.abstractmethoddefaxis_physical_types(self):""" The UCD 1+ physical types for the axes, in frame order. """@property@abc.abstractmethoddefworld_axis_object_classes(self):""" The APE 14 object classes for this frame. See Also -------- astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_classes """@propertydefworld_axis_object_components(self):""" The APE 14 object components for this frame. See Also -------- astropy.wcs.wcsapi.BaseLowLevelWCS.world_axis_object_components """ifself.naxes==1:returnself._native_world_axis_object_components# If we have more than one axis then we should sort the native# components by the axes_order.ordered=np.array(self._native_world_axis_object_components,dtype=object)[np.argsort(self.axes_order)]returnlist(map(tuple,ordered))@property@abc.abstractmethoddef_native_world_axis_object_components(self):""" This property holds the "native" frame order of the components. The native order of the components is the order the frame assumes the axes are in when creating the high level objects, for example ``CelestialFrame`` creates ``SkyCoord`` objects which are in lon, lat order (in their positional args). This property is used both to construct the ordered ``world_axis_object_components`` property as well as by `CompositeFrame` to be able to get the components in their native order. """
[docs]defadd_units(self,arrays:u.Quantity|np.ndarray|float)->tuple[u.Quantity]:""" Add units to the arrays """returntuple(u.Quantity(array,unit=unit)forarray,unitinzip(arrays,self.unit,strict=True))
[docs]defremove_units(self,arrays:u.Quantity|np.ndarray|float)->tuple[np.ndarray]:""" Remove units from the input arrays """ifself.naxes==1:arrays=(arrays,)returntuple(array.to_value(unit)ifisinstance(array,u.Quantity)elsearrayforarray,unitinzip(arrays,self.unit,strict=True))