BaseRepresentationOrDifferential¶
- class astropy.coordinates.BaseRepresentationOrDifferential(*args, **kwargs)[source]¶
Bases:
ShapedLikeNDArray
3D coordinate representations and differentials.
- Parameters:
Attributes Summary
A tuple with the in-order names of the coordinate components.
Container for meta information like name, description, format.
The shape of the instance and underlying arrays.
Methods Summary
from_cartesian
(other)Create a representation of this class from a supplied Cartesian one.
get_name
()Name of the representation or differential.
Convert the representation to its Cartesian form.
Attributes Documentation
- components¶
A tuple with the in-order names of the coordinate components.
- info¶
Container for meta information like name, description, format. This is required when the object is used as a mixin column within a table, but can be used as a general way to store meta information.
- shape¶
The shape of the instance and underlying arrays.
Like
shape
, can be set to a new shape by assigning a tuple. Note that if different instances share some but not all underlying data, setting the shape of one instance can make the other instance unusable. Hence, it is strongly recommended to get new, reshaped instances with thereshape
method.- Raises:
ValueError
If the new shape has the wrong total number of elements.
AttributeError
If the shape of any of the components cannot be changed without the arrays being copied. For these cases, use the
reshape
method (which copies any arrays that cannot be reshaped in-place).
Methods Documentation
- abstract classmethod from_cartesian(other)[source]¶
Create a representation of this class from a supplied Cartesian one.
- Parameters:
- other
CartesianRepresentation
The representation to turn into this class
- other
- Returns:
- representation
BaseRepresentation
subclass instance A new representation of this class’s type.
- representation
- classmethod get_name()[source]¶
Name of the representation or differential.
In lower case, with any trailing ‘representation’ or ‘differential’ removed. (E.g., ‘spherical’ for
SphericalRepresentation
orSphericalDifferential
.)
- abstract to_cartesian()[source]¶
Convert the representation to its Cartesian form.
Note that any differentials get dropped. Also note that orientation information at the origin is not preserved by conversions through Cartesian coordinates. For example, transforming an angular position defined at distance=0 through cartesian coordinates and back will lose the original angular coordinates:
>>> import astropy.units as u >>> import astropy.coordinates as coord >>> rep = coord.SphericalRepresentation( ... lon=15*u.deg, ... lat=-11*u.deg, ... distance=0*u.pc) >>> rep.to_cartesian().represent_as(coord.SphericalRepresentation) <SphericalRepresentation (lon, lat, distance) in (rad, rad, pc) (0., 0., 0.)>
- Returns:
- cartrepr
CartesianRepresentation
The representation in Cartesian form.
- cartrepr