SphericalCoordinatesBase

class astropy.coordinates.coordsystems.SphericalCoordinatesBase(*args, **kwargs) [edit on github][source]

Bases: object

Abstract superclass for all coordinate classes representing points in three dimensions.

Notes

Subclasses must implement __init__, and define the latangle and lonangle properties. They may also override the equinox property, or leave it unaltered to indicate the coordinates are equinoxless.

_initialize_latlon is provided to implement typical initialization features, and should be called from a subclass’ __init__. See the classes in astropy.coordinates.builtin_systems for examples of this.

Attributes Summary

cartesian
distance The radial distance for this coordinate object as an Distance object.
equinox The equinox of this system, or None to indicate no equinox specified.
latangle The latitudinal/elevation angle for these coordinates as an Angle object.
lonangle The longitudinal/azimuthal angle for these coordinates as an Angle object.
x
y
z

Methods Summary

from_name(name) Given a name, query the CDS name resolver to attempt to retrieve coordinate information for that object.
is_transformable_to(tosys) Determines if this coordinate can be transformed to a particular system.
separation(other) Computes on-sky separation between this coordinate and another.
separation_3d(other) Computes three dimensional separation between this coordinate and another.
transform_to(tosys) Transform this coordinate to a new system.

Attributes Documentation

cartesian[source]
distance[source]

The radial distance for this coordinate object as an Distance object.

If set as a tuple, the tuple will be passed into the Distance constructor.

Alternatively, this may be None, indicating an unknown/not given distance. Where necessary, this object will be interpreted as angles on the unit sphere.

equinox[source]

The equinox of this system, or None to indicate no equinox specified.

latangle[source]

The latitudinal/elevation angle for these coordinates as an Angle object.

Note

This should be overridden in subclasses as a read-only property that just returns an attribute a way to abstract the exact choice of names for the coordiantes. E.g., ICRSCoordinates implements this by doing return self.ra.

lonangle[source]

The longitudinal/azimuthal angle for these coordinates as an Angle object.

Note

This should be overridden in subclasses as a read-only property that just returns an attribute a way to abstract the exact choice of names for the coordinates. E.g., ICRSCoordinates implements this by doing return self.dec.

x[source]
y[source]
z[source]

Methods Documentation

classmethod from_name(name) [edit on github][source]

Given a name, query the CDS name resolver to attempt to retrieve coordinate information for that object. The search database, sesame url, and query timeout can be set through configuration items in astropy.coordinates.name_resolve – see docstring for astropy.coordinates.name_resolve.get_icrs_coordinates for more information.

Parameters :

name : str

The name of the object to get coordinates for, e.g. m42.

Returns :

coord : SphericalCoordinatesBase

Instance of a Coordinates class, specified by the class this is called on, e.g. if GalacticCoordinates.from_name('m42'), will get an instance of GalacticCoordinates representing the position of M42.

is_transformable_to(tosys) [edit on github][source]

Determines if this coordinate can be transformed to a particular system.

Parameters :

tosys : class

The system to transform this coordinate into.

Returns :

transformable : bool or str

True if this can be trasnformed to tosys, False if not. The string ‘same’ if tosys is the same system as this object (i.e. no transformation is needed).

separation(other) [edit on github][source]

Computes on-sky separation between this coordinate and another.

See the AngularSeparation docstring for further details on the actual calculation.

Parameters :

other : SphericalCoordinatesBase

The coordinate system to get the separation to.

Returns :

sep : AngularSeparation

The on-sky separation between this and the other coordinate.

separation_3d(other) [edit on github][source]

Computes three dimensional separation between this coordinate and another.

Parameters :

other : SphericalCoordinatesBase

The coordinate system to get the distance to.

Returns :

sep : Distance

The real-space distance between these two coordinates.

Raises :

ValueError :

If this or the other coordinate do not have distances.

transform_to(tosys) [edit on github][source]

Transform this coordinate to a new system.

Parameters :

tosys : class

The system to transform this coordinate into.

Returns :

transcoord :

A new object with this coordinate represented in the tosys system.

Raises :

ValueError :

If there is no possible transformation route.