InterpolatedDifferential

class interpolated_coordinates.InterpolatedDifferential(rep: IDType | DType, *args: Any, **kwargs: Any)[source]

Bases: InterpolatedBaseRepresentationOrDifferential

Attributes Summary

affine

derivative_type

The class used when taking a derivative.

uninterpolated

Return the underlying Representation.

Methods Summary

__call__([affine])

Evaluate interpolated representation.

clear_derivatives()

Return self, clearing cached derivatives.

copy(*args, **kwargs)

Return an instance containing copies of the internal data.

derivative([n])

Construct a new spline representing the derivative of this spline.

from_cartesian(other)

Create a representation of this class from a Cartesian one.

represent_as(other_class, base)

Convert coordinates to another representation.

to_cartesian()

Convert the differential to its Cartesian form.

Attributes Documentation

affine
derivative_type

The class used when taking a derivative.

uninterpolated

Return the underlying Representation.

Methods Documentation

__call__(affine: Quantity | None = None) DType[source]

Evaluate interpolated representation.

Parameters:
affineQuantity array_like

The affine interpolation parameter. If None, returns representation points.

Returns:
BaseDifferential

Representation of type self.data evaluated with affine

clear_derivatives() IRoDType

Return self, clearing cached derivatives.

copy(*args: Any, **kwargs: Any) IRoDType

Return an instance containing copies of the internal data.

Parameters are as for copy().

Returns:
interpolated_coordinates.InterpolatedBaseRepresentationOrDifferential

Same type as this instance.

derivative(n: int = 1) InterpolatedDifferential

Construct a new spline representing the derivative of this spline.

Parameters:
nint, optional

Order of derivative to evaluate. Default: 1

from_cartesian(other: CartesianRepresentation | CartesianDifferential) IRoDType

Create a representation of this class from a Cartesian one.

Parameters:
otherCartesianRepresentation or CartesianDifferential

The representation to turn into this class

Note: the affine parameter of this class is used. The representation must be the same length as the affine parameter.

Returns:
representationobject of this class

A new representation of this class’s type.

Raises:
ValueError

If other is not same length as the this instance’s affine parameter.

represent_as(other_class: BaseDifferential, base: BaseRepresentation) IDType[source]

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_classBaseDifferential subclass

The type of representation to turn the coordinates into.

baseinstance of self.base_representation

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() InterpolatedCartesianRepresentation[source]

Convert the differential 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 ccoordinates:

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

The representation in Cartesian form. On Differentials, to_cartesian returns a Representation https://github.com/astropy/astropy/issues/6215