CartesianDifferential¶
- class astropy.coordinates.CartesianDifferential(d_x, d_y=None, d_z=None, unit=None, xyz_axis=None, copy=True)[source]¶
Bases:
BaseDifferential
Differentials in of points in 3D cartesian coordinates.
- Parameters:
- d_x, d_y, d_z
Quantity
orarray
The x, y, and z coordinates of the differentials. If
d_x
,d_y
, andd_z
have different shapes, they should be broadcastable. If not quantities,unit
should be set. If onlyd_x
is given, it is assumed that it contains an array with the 3 coordinates stored alongxyz_axis
.- unit
Unit
orpython:str
If given, the differentials will be converted to this unit (or taken to be in this unit if not given.
- xyz_axis
python:int
, optional The axis along which the coordinates are stored when a single array is provided instead of distinct
d_x
,d_y
, andd_z
(default: 0).- copybool, optional
If
True
(default), arrays will be copied. IfFalse
, arrays will be references, though possibly broadcast to ensure matching shapes.
- d_x, d_y, d_z
Attributes Summary
Component 'd_x' of the Differential.
Return a vector array of the x, y, and z coordinates.
Component 'd_y' of the Differential.
Component 'd_z' of the Differential.
Methods Summary
from_cartesian
(other[, base])Convert the differential from 3D rectangular cartesian coordinates to the desired class.
get_d_xyz
([xyz_axis])Return a vector array of the x, y, and z coordinates.
to_cartesian
([base])Convert the differential to 3D rectangular cartesian coordinates.
transform
(matrix[, base, transformed_base])Transform differentials using a 3x3 matrix in a Cartesian basis.
Attributes Documentation
- attr_classes = {'d_x': <class 'astropy.units.quantity.Quantity'>, 'd_y': <class 'astropy.units.quantity.Quantity'>, 'd_z': <class 'astropy.units.quantity.Quantity'>}¶
- d_x¶
Component ‘d_x’ of the Differential.
- d_xyz¶
Return a vector array of the x, y, and z coordinates.
- Parameters:
- xyz_axis
python:int
, optional The axis in the final array along which the x, y, z components should be stored (default: 0).
- xyz_axis
- Returns:
- d_xyz
Quantity
With dimension 3 along
xyz_axis
. Note that, if possible, this will be a view.
- d_xyz
- d_y¶
Component ‘d_y’ of the Differential.
- d_z¶
Component ‘d_z’ of the Differential.
Methods Documentation
- classmethod from_cartesian(other, base=None)[source]¶
Convert the differential from 3D rectangular cartesian coordinates to the desired class.
- Parameters:
- other
The object to convert into this differential.
- base
BaseRepresentation
The points for which the differentials are to be converted: each of the components is multiplied by its unit vectors and scale factors. Will be converted to
cls.base_representation
if needed.
- Returns:
BaseDifferential
subclass instanceA new differential object that is this class’ type.
- get_d_xyz(xyz_axis=0)[source]¶
Return a vector array of the x, y, and z coordinates.
- Parameters:
- xyz_axis
python:int
, optional The axis in the final array along which the x, y, z components should be stored (default: 0).
- xyz_axis
- Returns:
- d_xyz
Quantity
With dimension 3 along
xyz_axis
. Note that, if possible, this will be a view.
- d_xyz
- to_cartesian(base=None)[source]¶
Convert the differential to 3D rectangular cartesian coordinates.
- Parameters:
- baseinstance 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.
- baseinstance of
- Returns:
CartesianDifferential
This object, converted.
- transform(matrix, base=None, transformed_base=None)[source]¶
Transform differentials using a 3x3 matrix in a Cartesian basis.
This returns a new differential and does not modify the original one.
- Parameters:
- matrix(3,3) numpy:array_like
A 3x3 (or stack thereof) matrix, such as a rotation matrix.
- base, transformed_base
CartesianRepresentation
orpython:None
, optional Not used in the Cartesian transformation.