BaseRepresentationOrDifferential

class astropy.coordinates.BaseRepresentationOrDifferential(*args, **kwargs)[source] [edit on github]

Bases: astropy.utils.misc.ShapedLikeNDArray

3D coordinate representations and differentials.

Parameters:
comp1, comp2, comp3 : Quantity or subclass

The components of the 3D point or differential. The names are the keys and the subclasses the values of the attr_classes attribute.

copy : bool, optional

If True (default), arrays will be copied rather than referenced.

Attributes Summary

components A tuple with the in-order names of the coordinate components.
shape 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.
to_cartesian() Convert the representation to its Cartesian form.

Attributes Documentation

components

A tuple with the in-order names of the coordinate components.

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 the reshape method.

Raises:
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

classmethod from_cartesian(other)[source] [edit on github]

Create a representation of this class from a supplied Cartesian one.

Parameters:
other : CartesianRepresentation

The representation to turn into this class

Returns:
representation : object of this class

A new representation of this class’s type.

classmethod get_name()[source] [edit on github]

Name of the representation or differential.

In lower case, with any trailing ‘representation’ or ‘differential’ removed. (E.g., ‘spherical’ for SphericalRepresentation or SphericalDifferential.)

to_cartesian()[source] [edit on github]

Convert the representation to its Cartesian form.

Note that any differentials get dropped.

Returns:
cartrepr : CartesianRepresentation

The representation in Cartesian form.