BaseDifferential

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

Bases: astropy.coordinates.BaseRepresentationOrDifferential

A base class representing differentials of representations.

These represent differences or derivatives along each component. E.g., for physics spherical coordinates, these would be \(\delta r, \delta \theta, \delta \phi\).

Parameters:
d_comp1, d_comp2, d_comp3 : Quantity or subclass

The components of the 3D differentials. 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.

Notes

All differential representation classes should subclass this base class, and define an base_representation attribute with the class of the regular BaseRepresentation for which differential coordinates are provided. This will set up a default attr_classes instance with names equal to the base component names prefixed by d_, and all classes set to Quantity, plus properties to access those, and a default __init__ for initialization.

Attributes Summary

recommended_units

Deprecated since version 3.0.

Methods Summary

from_cartesian(other, base) Convert the differential from 3D rectangular cartesian coordinates to the desired class.
from_representation(representation, base) Create a new instance of this representation from another one.
norm([base]) Vector norm.
represent_as(other_class, base) Convert coordinates to another representation.
to_cartesian(base) Convert the differential to 3D rectangular cartesian coordinates.

Attributes Documentation

recommended_units

Deprecated since version 3.0: The recommended_units attribute is deprecated and may be removed in a future version.

Methods Documentation

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

Convert the differential from 3D rectangular cartesian coordinates to the desired class.

Parameters:
other :

The object to convert into this differential.

base : instance of self.base_representation

The points for which the differentials are to be converted: each of the components is multiplied by its unit vectors and scale factors.

Returns:
A new differential object that is this class’ type.
classmethod from_representation(representation, base)[source] [edit on github]

Create a new instance of this representation from another one.

Parameters:
representation : BaseRepresentation instance

The presentation that should be converted to this class.

base : instance of cls.base_representation

The base relative to which the differentials will be defined. If the representation is a differential itself, the base will be converted to its base_representation to help convert it.

norm(base=None)[source] [edit on github]

Vector norm.

The norm is the standard Frobenius norm, i.e., the square root of the sum of the squares of all components with non-angular units.

Parameters:
base : instance of self.base_representation

Base relative to which the differentials are defined. This is required to calculate the physical size of the differential for all but cartesian differentials.

Returns:
norm : astropy.units.Quantity

Vector norm, with the same shape as the representation.

represent_as(other_class, base)[source] [edit on github]

Convert coordinates to another representation.

If the instance is of the requested class, it is returned unmodified. By default, conversion is done via cartesian coordinates.

Parameters:
other_class : BaseRepresentation subclass

The type of representation to turn the coordinates into.

base : instance of self.base_representation, optional

Base relative to which the differentials are defined. If the other class is a differential representation, the base will be converted to its base_representation.

to_cartesian(base)[source] [edit on github]

Convert the differential to 3D rectangular cartesian coordinates.

Parameters:
base : instance of self.base_representation

The points for which the differentials are to be converted: each of the components is multiplied by its unit vectors and scale factors.

Returns:
This object as a `CartesianDifferential`