Bases: object
The base class for coordinate frames.
This class is intended to be subclassed to create instances of specific systems. Subclasses can implement the following attributes:
A subclass of BaseRepresentation that will be treated as the default representation of this frame. This is the representation assumed by default when the frame is created.
Frame attributes such as FK4.equinox or FK4.obstime are defined using a descriptor class. See the narrative documentation or built-in classes code for details.
A dictionary mapping the name or class of a representation to a list of RepresentationMapping objects that tell what names and default units should be used on this frame for the components of that representation.
Attributes Summary
cartesian | Shorthand for a cartesian representation of the coordinates in this object. |
data | The coordinate data for this object. |
default_representation | |
frame_specific_representation_info | |
has_data | True if this frame has data, False otherwise. |
isscalar | |
name | str(object=’‘) -> string |
representation | The representation of the data in this frame, as a class that is subclassed from BaseRepresentation. |
representation_component_names | |
representation_component_units | |
representation_info | A dictionary with the information of what attribute names for this frame apply to particular representations. |
shape | |
spherical | Shorthand for a spherical representation of the coordinates in this object. |
Methods Summary
get_frame_attr_names() | |
is_frame_attr_default(attrnm) | Determine whether or not a frame attribute has its value because it’s the default value, or because this frame was created with that value explicitly requested. |
is_transformable_to(new_frame) | Determines if this coordinate frame can be transformed to another given frame. |
realize_frame(representation) | Generates a new frame with new data from another frame (which may or may not have data). |
represent_as(new_representation[, ...]) | Generate and return a new representation of this frame’s data. |
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(new_frame) | Transform this object’s coordinate data to a new frame. |
Attributes Documentation
Shorthand for a cartesian representation of the coordinates in this object.
The coordinate data for this object. If this frame has no data, an ValueError will be raised. Use has_data to check if data is present on this frame object.
The representation of the data in this frame, as a class that is subclassed from BaseRepresentation. Can also be set using the string name of the representation.
A dictionary with the information of what attribute names for this frame apply to particular representations.
Shorthand for a spherical representation of the coordinates in this object.
Methods Documentation
Determine whether or not a frame attribute has its value because it’s the default value, or because this frame was created with that value explicitly requested.
Parameters: | attrnm : str
|
---|---|
Returns: | isdefault : bool
|
Determines if this coordinate frame can be transformed to another given frame.
Parameters: | new_frame : class or frame object
|
---|---|
Returns: | transformable : bool or str |
Notes
A return value of ‘same’ means the transformation will work, but it will just give back a copy of this object. The intended usage is:
if coord.is_transformable_to(some_unknown_frame):
coord2 = coord.transform_to(some_unknown_frame)
This will work even if some_unknown_frame turns out to be the same frame class as coord. This is intended for cases where the frame is the same regardless of the frame attributes (e.g. ICRS), but be aware that it might also indicate that someone forgot to define the transformation between two objects of the same frame class but with different attributes.
Generates a new frame with new data from another frame (which may or may not have data).
Parameters: | representation : BaseRepresentation
|
---|---|
Returns: | frameobj : same as this frame
|
Generate and return a new representation of this frame’s data.
Parameters: | new_representation : subclass of BaseRepresentation or string
in_frame_units : bool
|
---|---|
Returns: | newrep : whatever new_representation is
|
Raises: | AttributeError
|
Examples
>>> from astropy import units as u
>>> from astropy.coordinates import ICRS, CartesianRepresentation
>>> coord = ICRS(0*u.deg, 0*u.deg)
>>> coord.represent_as(CartesianRepresentation)
<CartesianRepresentation x=1.0 , y=0.0 , z=0.0 >
Computes on-sky separation between this coordinate and another.
Parameters: | other : BaseCoordinateFrame
|
---|---|
Returns: | sep : Angle
|
Notes
The separation is calculated using the Vincenty formula, which is stable at all locations, including poles and antipodes [R2].
[R2] | http://en.wikipedia.org/wiki/Great-circle_distance |
Computes three dimensional separation between this coordinate and another.
Parameters: | other : BaseCoordinateFrame
|
---|---|
Returns: | sep : Distance
|
Raises: | ValueError
|
Transform this object’s coordinate data to a new frame.
Parameters: | new_frame : class or frame object or SkyCoord object
|
---|---|
Returns: | transframe
|
Raises: | ValueError
|