PhysicsSphericalRepresentation¶

class
astropy.coordinates.
PhysicsSphericalRepresentation
(phi, theta=None, r=None, differentials=None, copy=True)[source]¶ Bases:
astropy.coordinates.BaseRepresentation
Representation of points in 3D spherical coordinates (using the physics convention of using
phi
andtheta
for azimuth and inclination from the pole). Parameters
 phi, theta
Quantity
or str The azimuth and inclination of the point(s), in angular units. The inclination should be between 0 and 180 degrees, and the azimuth will be wrapped to an angle between 0 and 360 degrees. These can also be instances of
Angle
. Ifcopy
is False,phi
will be changed inplace if it is not between 0 and 360 degrees. r
Quantity
The distance to the point(s). If the distance is a length, it is passed to the
Distance
class, otherwise it is passed to theQuantity
class. differentialsdict,
PhysicsSphericalDifferential
, optional Any differential classes that should be associated with this representation. The input must either be a single
PhysicsSphericalDifferential
instance, 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. copybool, optional
If
True
(default), arrays will be copied. IfFalse
, arrays will be references, though possibly broadcast to ensure matching shapes.
 phi, theta
Attributes Summary
The azimuth of the point(s).
The distance from the origin to the point(s).
The elevation of the point(s).
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 for each component’s direction.
Converts spherical polar coordinates to 3D rectangular cartesian coordinates.
Cartesian unit vectors in the direction of each component.
Attributes Documentation

attr_classes
= {'phi': <class 'astropy.coordinates.angles.Angle'>, 'r': <class 'astropy.units.quantity.Quantity'>, 'theta': <class 'astropy.coordinates.angles.Angle'>}¶

phi
¶ The azimuth of the point(s).

r
¶ The distance from the origin to the point(s).

theta
¶ The elevation of the point(s).
Methods Documentation

classmethod
from_cartesian
(cart)[source]¶ Converts 3D rectangular cartesian coordinates to spherical polar coordinates.

norm
()[source]¶ Vector norm.
The norm is the standard Frobenius norm, i.e., the square root of the sum of the squares of all components with nonangular units. For spherical coordinates, this is just the absolute value of the radius.
 Returns
 norm
astropy.units.Quantity
Vector norm, with the same shape as the representation.
 norm

represent_as
(other_class, differential_class=None)[source]¶ 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. Also note that orientation information at the origin is not preserved by conversions through Cartesian coordinates. See the docstring for
represent_as()
for an example. Parameters
 other_class
BaseRepresentation
subclass The type of representation to turn the coordinates into.
 differential_classdict of
BaseDifferential
, optional Classes 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.
 other_class

scale_factors
()[source]¶ Scale factors for each component’s direction.
Given unit vectors \(\hat{e}_c\) and scale factors \(f_c\), a change in one component of \(\delta c\) corresponds to a change in representation of \(\delta c \times f_c \times \hat{e}_c\).
 Returns
 scale_factorsdict of
Quantity
The keys are the component names.
 scale_factorsdict of

to_cartesian
()[source]¶ Converts spherical polar coordinates to 3D rectangular cartesian coordinates.

unit_vectors
()[source]¶ Cartesian unit vectors in the direction of each component.
Given unit vectors \(\hat{e}_c\) and scale factors \(f_c\), a change in one component of \(\delta c\) corresponds to a change in representation of \(\delta c \times f_c \times \hat{e}_c\).
 Returns
 unit_vectorsdict of
CartesianRepresentation
The keys are the component names.
 unit_vectorsdict of