FunctionTransformWithFiniteDifference

class astropy.coordinates.FunctionTransformWithFiniteDifference(func, fromsys, tosys, priority=1, register_graph=None, finite_difference_frameattr_name='obstime', finite_difference_dt=<Quantity 1. s>, symmetric_finite_difference=True)[source] [edit on github]

Bases: astropy.coordinates.FunctionTransform

A coordinate transformation that works like a FunctionTransform, but computes velocity shifts based on the finite-difference relative to one of the frame attributes. Note that the transform function should not change the differential at all in this case, as any differentials will be overridden.

When a differential is in the from coordinate, the finite difference calculation has two components. The first part is simple the existing differential, but re-orientation (using finite-difference techniques) to point in the direction the velocity vector has in the new frame. The second component is the “induced” velocity. That is, the velocity intrinsic to the frame itself, estimated by shifting the frame using the finite_difference_frameattr_name frame attribute a small amount (finite_difference_dt) in time and re-calculating the position.

Parameters:
finite_difference_frameattr_name : str or None

The name of the frame attribute on the frames to use for the finite difference. Both the to and the from frame will be checked for this attribute, but only one needs to have it. If None, no velocity component induced from the frame itself will be included - only the re-orientation of any existing differential.

finite_difference_dt : Quantity or callable

If a quantity, this is the size of the differential used to do the finite difference. If a callable, should accept (fromcoord, toframe) and return the dt value.

symmetric_finite_difference : bool

If True, the finite difference is computed as \(\frac{x(t + \Delta t / 2) - x(t + \Delta t / 2)}{\Delta t}\), or if False, \(\frac{x(t + \Delta t) - x(t)}{\Delta t}\). The latter case has slightly better performance (and more stable finite difference behavior).

All other parameters are identical to the initializer for
`FunctionTransform`.

Attributes Summary

finite_difference_frameattr_name

Methods Summary

__call__(fromcoord, toframe) Does the actual coordinate transformation from the fromsys class to the tosys class.

Attributes Documentation

finite_difference_frameattr_name

Methods Documentation

__call__(fromcoord, toframe)[source] [edit on github]

Does the actual coordinate transformation from the fromsys class to the tosys class.

Parameters:
fromcoord : fromsys object

An object of class matching fromsys that is to be transformed.

toframe : object

An object that has the attributes necessary to fully specify the frame. That is, it must have attributes with names that match the keys of the dictionary that tosys.get_frame_attr_names() returns. Typically this is of class tosys, but it might be some other class as long as it has the appropriate attributes.

Returns:
tocoord : tosys object

The new coordinate after the transform has been applied.