SphericalRepresentation¶
-
class
astropy.coordinates.
SphericalRepresentation
(lon, lat, distance, differentials=None, copy=True)[source] [edit on github]¶ Bases:
astropy.coordinates.BaseRepresentation
Representation of points in 3D spherical coordinates.
Parameters: lon, lat :
Quantity
distance :
Quantity
differentials : dict,
BaseDifferential
, optionalAny differential classes that should be associated with this representation. The input must either be a single
BaseDifferential
instance (see_compatible_differentials
for valid types), or a dictionary of of differential instances with keys set to a string representation of the SI unit with which the differential (derivative) is taken. For example, for a velocity differential on a positional representation, the key would be's'
for seconds, indicating that the derivative is a time derivative.copy : bool, optional
If
True
(default), arrays will be copied rather than referenced.Attributes Summary
attr_classes
distance
The distance from the origin to the point(s). lat
The latitude of the point(s). lon
The longitude of the point(s). recommended_units
Methods Summary
from_cartesian
(cart)Converts 3D rectangular cartesian coordinates to spherical polar coordinates. norm
()Vector norm. represent_as
(other_class[, differential_class])Convert coordinates to another representation. scale_factors
([omit_coslat])Scale factors for each component’s direction. to_cartesian
()Converts spherical polar coordinates to 3D rectangular cartesian coordinates. unit_vectors
()Cartesian unit vectors in the direction of each component. Attributes Documentation
-
attr_classes
= OrderedDict([('lon', <class 'astropy.coordinates.angles.Longitude'>), ('lat', <class 'astropy.coordinates.angles.Latitude'>), ('distance', <class 'astropy.units.quantity.Quantity'>)])¶
-
distance
¶ The distance from the origin to the point(s).
-
lat
¶ The latitude of the point(s).
-
lon
¶ The longitude of the point(s).
-
recommended_units
= {'lat': Unit("deg"), 'lon': Unit("deg")}¶
Methods Documentation
-
classmethod
from_cartesian
(cart)[source] [edit on github]¶ Converts 3D rectangular cartesian coordinates to spherical polar coordinates.
-
norm
()[source] [edit on github]¶ Vector norm.
The norm is the standard Frobenius norm, i.e., the square root of the sum of the squares of all components with non-angular units. For spherical coordinates, this is just the absolute value of the distance.
Returns: norm :
astropy.units.Quantity
Vector norm, with the same shape as the representation.
-
represent_as
(other_class, differential_class=None)[source] [edit on github]¶ 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_class :
BaseRepresentation
subclassThe type of representation to turn the coordinates into.
differential_class : dict of
BaseDifferential
, optionalClasses in which the differentials should be represented. Can be a single class if only a single differential is attached, otherwise it should be a
dict
keyed by the same keys as the differentials.
-
scale_factors
(omit_coslat=False)[source] [edit on github]¶ Scale factors for each component’s direction.
Given unit vectors
and scale factors
, a change in one component of
corresponds to a change in representation of
.
Returns: scale_factors : dict of
Quantity
The keys are the component names.
-
to_cartesian
()[source] [edit on github]¶ Converts spherical polar coordinates to 3D rectangular cartesian coordinates.
-
unit_vectors
()[source] [edit on github]¶ Cartesian unit vectors in the direction of each component.
Given unit vectors
and scale factors
, a change in one component of
corresponds to a change in representation of
.
Returns: unit_vectors : dict of
CartesianRepresentation
The keys are the component names.
-