InterpolatedBaseRepresentationOrDifferential

class interpolated_coordinates.InterpolatedBaseRepresentationOrDifferential(*_: Any, **__: Any)[source]

Bases: object

Wrapper for Representations, adding affine interpolations.

Parameters:
repBaseRepresentation instance, positional-only
affineQuantity array_like

The affine interpolation parameter.

interpsMapping or None, optional keyword-only

Has same structure as a Representation

dict(component name: interpolation,
    ...
    "differentials": dict(
        "s" : dict(component name: interpolation, ...),
        ...))
**interp_kwargsAny

Only used if interps is None. keyword arguments into interpolation class

Other Parameters:
interp_clsCallable (optional, keyword-only)

option for ‘interp_kwargs’. If not specified, default is IntpUnivarSplUnits.

derivative_typeCallable (optional, keyword-only)

The class to use when differentiating wrt to the affine parameter. If not provided, will use _infer_derivative_type to infer. Defaults to GenericDifferential if all else fails.

Raises:
ValueError

If rep is a BaseRepresentationOrDifferential class, not instance If affine shape is not 1-D. If affine is not same length as rep.

TypeError

If rep not not type BaseRepresentationOrDifferential.

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.

to_cartesian()

Convert the representation to its Cartesian form.

Attributes Documentation

affine
derivative_type

The class used when taking a derivative.

uninterpolated

Return the underlying Representation.

Methods Documentation

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

Evaluate interpolated representation.

Parameters:
affineQuantity array_like

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

clear_derivatives() IRoDType[source]

Return self, clearing cached derivatives.

copy(*args: Any, **kwargs: Any) IRoDType[source]

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[source]

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[source]

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.

to_cartesian() IRoDType[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:
cartreprCartesianRepresentation or CartesianDifferential

The representation in Cartesian form. If starting from a Cart