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]#
Bases:
FunctionTransform
Transformation based on functions using finite difference for velocities.
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
orNone
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
[:ref: ‘time’] orcallable()
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 thedt
value.- symmetric_finite_differencebool
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
- `~astropy.coordinates.FunctionTransform`.
- finite_difference_frameattr_name
Attributes Summary
Methods Summary
__call__
(fromcoord, toframe)Does the actual coordinate transformation from the
fromsys
class to thetosys
class.Attributes Documentation
- finite_difference_frameattr_name#
Methods Documentation
- __call__(fromcoord, toframe)[source]#
Does the actual coordinate transformation from the
fromsys
class to thetosys
class.- Parameters:
- fromcoord
BaseCoordinateFrame
subclass instance 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
tosys.frame_attributes
. Typically this is of classtosys
, but it might be some other class as long as it has the appropriate attributes.
- fromcoord
- Returns:
- tocoord
BaseCoordinateFrame
subclass instance The new coordinate after the transform has been applied.
- tocoord