GiftsFrame

class gdt.missions.gifts.frame.GiftsFrame(*args, copy=True, representation_type=None, differential_type=None, **kwargs)[source]

Bases: SpacecraftFrame

The GIFTS spacecraft frame in azimuth and elevation. The frame is defined as a quaternion that represents a rotation from the GIFTS frame to the ICRS frame. This class is a wholesale inheritance of SpacecraftFrame

Example use:

>>> from gdt.core.coords import Quaternion
>>> quat = Quaternion([-0.218,  0.009,  0.652, -0.726], scalar_first=False)
>>> gifts_frame = GiftsFrame(quaternion=quat)
>>> coord = SkyCoord(100.0, -30.0, unit='deg')
>>> az_el = SkyCoord.transform_to(gifts_frame)

Attributes Summary

T

Return an instance with the data transposed.

cache

Cache for this frame, a dict.

cartesian

Shorthand for a cartesian representation of the coordinates in this object.

cylindrical

Shorthand for a cylindrical representation of the coordinates in this object.

data

The coordinate data for this object.

default_differential

Default representation for differential data (e.g., velocity)

default_representation

Default representation for position data

detectors

The spacecraft detectors definition

differential_type

The differential used for this frame's data.

earth_angular_radius

The apparent angular radius, in degrees, of the Earth from the spacecraft position

earth_location

The spacecraft position as an Earth coordinate.

frame_attributes

frame_specific_representation_info

Mapping for frame-specific component names

geocenter

The geocenter location in the GCRS frame.

has_data

True if this frame has data, False otherwise.

isscalar

name

ndim

The number of dimensions of the instance and underlying arrays.

obsgeoloc

Spacecraft position in Earth-centered Inertial coordinates at time(s) obstime

obsgeovel

Spacecraft velocity at time(s) obstime

obstime

Time or times of associated with the spacecraft frame

proper_motion

Shorthand for the two-dimensional proper motion as a ~astropy.units.Quantity object with angular velocity units.

quaternion

Spacecraft attitude quaternions at time(s) obstime

radial_velocity

Shorthand for the radial or line-of-sight velocity as a ~astropy.units.Quantity object.

representation_component_names

representation_component_units

representation_info

A dictionary with the information of what attribute names for this frame apply to particular representations.

representation_type

The representation class used for this frame's data.

sc_gcrs

The spacecraft position in the GCRS frame

sc_itrs

The spacecraft position in the ITRS frame

shape

The shape of the underlying data.

size

The size of the object, as calculated from its shape.

spherical

Shorthand for a spherical representation of the coordinates in this object.

sphericalcoslat

Shorthand for a spherical representation of the positional data and a ~astropy.coordinates.SphericalCosLatDifferential for the velocity data in this object.

sun_visible

True if the sun is visible to the spacecraft.

velocity

Shorthand for retrieving the Cartesian space-motion as a ~astropy.coordinates.CartesianDifferential object.

Methods Summary

at(obstime)

Retrieve the interpolated spacecraft positions and quaternions for the specified time(s).

copy(*args, **kwargs)

Return an instance containing copies of the internal data.

detector_angle(det, coord)

Calculate the detector angle for a SkyCoord.

diagonal(*args, **kwargs)

Return an instance with the specified diagonals.

estimate_velocity(time[, eps])

Estimate the orbital velocity at a given time.

flatten(*args, **kwargs)

Return a copy with the array collapsed into one dimension.

get_frame_attr_defaults()

Return a dict with the defaults for each frame attribute.

get_frame_attr_names()

Deprecated since version 5.2.

get_representation_cls([which])

The class used for part of this frame's data.

get_representation_component_names([which])

get_representation_component_units([which])

init_interpolation()

Initialize the interpolation functions

is_equivalent_frame(other)

Checks if this object is the same frame as the other object.

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.

location_visible(pos)

Determine if a sky location is visible or occulted by the Earth.

ravel(*args, **kwargs)

Return an instance with the array collapsed into one dimension.

realize_frame(data, **kwargs)

Generates a new frame with new data from another frame (which may or may not have data).

replicate([copy])

Return a replica of the frame, optionally with new frame attributes.

replicate_without_data([copy])

Return a replica without data, optionally with new frame attributes.

represent_as(base[, s, in_frame_units])

Generate and return a new representation of this frame's data as a Representation object.

reshape(*args, **kwargs)

Returns an instance containing the same data with a new shape.

separation(other)

Computes on-sky separation between this coordinate and another.

separation_3d(other)

Computes three dimensional separation between this coordinate and another.

set_representation_cls([base, s])

Set representation and/or differential class for this frame's data.

squeeze(*args, **kwargs)

Return an instance with single-dimensional shape entries removed.

swapaxes(*args, **kwargs)

Return an instance with the given axes interchanged.

take(indices[, axis, out, mode])

Return a new instance formed from the elements at the given indices.

transform_to(new_frame)

Transform this object's coordinate data to a new frame.

transpose(*args, **kwargs)

Return an instance with the data transposed.

Attributes Documentation

T

Return an instance with the data transposed.

Parameters are as for T. All internal data are views of the data of the original.

cache

Cache for this frame, a dict.

It stores anything that should be computed from the coordinate data (not from the frame attributes). This can be used in functions to store anything that might be expensive to compute but might be re-used by some other function. E.g.:

if 'user_data' in myframe.cache:
    data = myframe.cache['user_data']
else:
    myframe.cache['user_data'] = data = expensive_func(myframe.lat)

If in-place modifications are made to the frame data, the cache should be cleared:

myframe.cache.clear()
cartesian

Shorthand for a cartesian representation of the coordinates in this object.

cylindrical

Shorthand for a cylindrical representation of the coordinates in this object.

data

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.

default_differential

Default representation for differential data (e.g., velocity)

default_representation

The default representation of the spacecraft frame

detectors = None

The spacecraft detectors definition

differential_type

The differential used for this frame’s data.

This will be a subclass from ~astropy.coordinates.BaseDifferential. For simultaneous setting of representation and differentials, see the set_representation_cls method.

earth_angular_radius

The apparent angular radius, in degrees, of the Earth from the spacecraft position

Returns:

(astropy.units.Quantity)

earth_location

The spacecraft position as an Earth coordinate.

Type:

(astropy.coordinates.EarthLocation)

frame_attributes = {'detectors': <gdt.core.coords.spacecraft.frame.DetectorsAttribute object>, 'obsgeoloc': <astropy.coordinates.attributes.CartesianRepresentationAttribute object>, 'obsgeovel': <astropy.coordinates.attributes.CartesianRepresentationAttribute object>, 'obstime': <astropy.coordinates.attributes.TimeAttribute object>, 'quaternion': <gdt.core.coords.quaternion.QuaternionAttribute object>}
frame_specific_representation_info

Mapping for frame-specific component names

geocenter

The geocenter location in the GCRS frame.

Type:

(astropy.coordinates.GCRS)

has_data

True if this frame has data, False otherwise.

isscalar
name = 'giftsframe'
ndim

The number of dimensions of the instance and underlying arrays.

obsgeoloc = <CartesianRepresentation (x, y, z) in m     (0., 0., 0.)>

Spacecraft position in Earth-centered Inertial coordinates at time(s) obstime

obsgeovel = <CartesianRepresentation (x, y, z) in m / s     (0., 0., 0.)>

Spacecraft velocity at time(s) obstime

obstime = <Time object: scale='tt' format='jyear_str' value=J2000.000>

Time or times of associated with the spacecraft frame

proper_motion

Shorthand for the two-dimensional proper motion as a ~astropy.units.Quantity object with angular velocity units. In the returned ~astropy.units.Quantity, axis=0 is the longitude/latitude dimension so that .proper_motion[0] is the longitudinal proper motion and .proper_motion[1] is latitudinal. The longitudinal proper motion already includes the cos(latitude) term.

quaternion = None

Spacecraft attitude quaternions at time(s) obstime

radial_velocity

Shorthand for the radial or line-of-sight velocity as a ~astropy.units.Quantity object.

representation_component_names
representation_component_units
representation_info

A dictionary with the information of what attribute names for this frame apply to particular representations.

representation_type

The representation class used for this frame’s data.

This will be a subclass from ~astropy.coordinates.BaseRepresentation. Can also be set using the string name of the representation. If you wish to set an explicit differential class (rather than have it be inferred), use the set_representation_cls method.

sc_gcrs

The spacecraft position in the GCRS frame

Type:

(astropy.coordinates.GCRS)

sc_itrs

The spacecraft position in the ITRS frame

Type:

(astropy.coordinates.ITRS)

shape
size
spherical

Shorthand for a spherical representation of the coordinates in this object.

sphericalcoslat

Shorthand for a spherical representation of the positional data and a ~astropy.coordinates.SphericalCosLatDifferential for the velocity data in this object.

sun_visible

True if the sun is visible to the spacecraft.

Type:

(bool)

velocity

Shorthand for retrieving the Cartesian space-motion as a ~astropy.coordinates.CartesianDifferential object.

This is equivalent to calling self.cartesian.differentials['s'].

Methods Documentation

at(obstime: Time)

Retrieve the interpolated spacecraft positions and quaternions for the specified time(s).

Parameters:

obstime (astropy.time.Time) – The times for which the frames are requested.

Returns:

(SpacecraftFrame)

copy(*args, **kwargs)

Return an instance containing copies of the internal data.

Parameters are as for copy().

detector_angle(det, coord)

Calculate the detector angle for a SkyCoord.

Note

This will only work if the SpacecraftFrame was initialized with a valid Detectors object containing the detector pointing definitions.

Parameters:
  • det (string or Detectors) – The detector for which to calculate the angle. If this is a string value, it can either be the name or full_name of the detector. A single Detector object can also be used.

  • coord (astropy.coordinates.SkyCoord) – The coordinate(s) against which the angle will be calculated.

Returns:

(astropy.coordinates.Angle)

diagonal(*args, **kwargs)

Return an instance with the specified diagonals.

Parameters are as for diagonal(). All internal data are views of the data of the original.

estimate_velocity(time: Time, eps=0.1)

Estimate the orbital velocity at a given time. The result is returned as an astropy Quantity in units of x/s, where x is the distance unit of the Earth-inertial coordinates used to initialize the object.

Parameters:
  • time (float or astropy.time.Time) – The time(s) at which to estimate the orbital velocity.

  • eps (float) – The epsilon change in time, in seconds, over which the time derivative is calculated. Default is 0.1.

Returns:

(astropy.units.Quantity)

flatten(*args, **kwargs)

Return a copy with the array collapsed into one dimension.

Parameters are as for flatten().

classmethod get_frame_attr_defaults()

Return a dict with the defaults for each frame attribute.

classmethod get_frame_attr_names()

Deprecated since version 5.2: The get_frame_attr_names() method is deprecated and may be removed in a future version. Use get_frame_attr_defaults() to obtain a dict of frame attribute names and default values. The fastest way to obtain the names is frame_attributes.keys()

Return a dict with the defaults for each frame attribute.

get_representation_cls(which='base')

The class used for part of this frame’s data.

Parameters:

which ((‘base’, ‘s’, None)) – The class of which part to return. ‘base’ means the class used to represent the coordinates; ‘s’ the first derivative to time, i.e., the class representing the proper motion and/or radial velocity. If None, return a dict with both.

Returns:

representation (~astropy.coordinates.BaseRepresentation or ~astropy.coordinates.BaseDifferential.)

get_representation_component_names(which='base')
get_representation_component_units(which='base')
init_interpolation()

Initialize the interpolation functions

is_equivalent_frame(other)

Checks if this object is the same frame as the other object.

To be the same frame, two objects must be the same frame class and have the same frame attributes. Note that it does not matter what, if any, data either object has.

Parameters:

other (BaseCoordinateFrame) – the other frame to check

Returns:

isequiv (bool) – True if the frames are the same, False if not.

Raises:

TypeError – If other isn’t a ~astropy.coordinates.BaseCoordinateFrame or subclass.

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.

Parameters:

attrnm (str) – The name of the attribute to check.

Returns:

isdefault (bool) – True if the attribute attrnm has its value by default, False if it was specified at creation of this frame.

is_transformable_to(new_frame)

Determines if this coordinate frame can be transformed to another given frame.

Parameters:

new_frame (~astropy.coordinates.BaseCoordinateFrame subclass or instance) – The proposed frame to transform into.

Returns:

transformable (bool or str) – True if this can be transformed to new_frame, False if not, or the string ‘same’ if new_frame is the same system as this object but no transformation is defined.

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.

location_visible(pos: SkyCoord)

Determine if a sky location is visible or occulted by the Earth.

Parameters:

pos (astropy.coordinates.SkyCoord) – Sky location(s)

Returns:

np.array(dtype=bool) – A boolean array where True indicates the position is visible.

ravel(*args, **kwargs)

Return an instance with the array collapsed into one dimension.

Parameters are as for ravel(). Note that it is not always possible to unravel an array without copying the data. If you want an error to be raise if the data is copied, you should should assign shape (-1,) to the shape attribute.

realize_frame(data, **kwargs)

Generates a new frame with new data from another frame (which may or may not have data). Roughly speaking, the converse of replicate_without_data.

Parameters:
  • data (~astropy.coordinates.BaseRepresentation) – The representation to use as the data for the new frame.

  • **kwargs – Any additional keywords are treated as frame attributes to be set on the new frame object. In particular, representation_type can be specified.

Returns:

frameobj (~astropy.coordinates.BaseCoordinateFrame subclass instance) – A new object in this frame, with the same frame attributes as this one, but with the data as the coordinate data.

replicate(copy=False, **kwargs)

Return a replica of the frame, optionally with new frame attributes.

The replica is a new frame object that has the same data as this frame object and with frame attributes overridden if they are provided as extra keyword arguments to this method. If copy is set to True then a copy of the internal arrays will be made. Otherwise the replica will use a reference to the original arrays when possible to save memory. The internal arrays are normally not changeable by the user so in most cases it should not be necessary to set copy to True.

Parameters:
  • copy (bool, optional) – If True, the resulting object is a copy of the data. When False, references are used where possible. This rule also applies to the frame attributes.

  • **kwargs – Any additional keywords are treated as frame attributes to be set on the new frame object.

Returns:

frameobj (~astropy.coordinates.BaseCoordinateFrame subclass instance) – Replica of this object, but possibly with new frame attributes.

replicate_without_data(copy=False, **kwargs)

Return a replica without data, optionally with new frame attributes.

The replica is a new frame object without data but with the same frame attributes as this object, except where overridden by extra keyword arguments to this method. The copy keyword determines if the frame attributes are truly copied vs being references (which saves memory for cases where frame attributes are large).

This method is essentially the converse of realize_frame.

Parameters:
  • copy (bool, optional) – If True, the resulting object has copies of the frame attributes. When False, references are used where possible.

  • **kwargs – Any additional keywords are treated as frame attributes to be set on the new frame object.

Returns:

frameobj (~astropy.coordinates.BaseCoordinateFrame subclass instance) – Replica of this object, but without data and possibly with new frame attributes.

represent_as(base, s='base', in_frame_units=False)

Generate and return a new representation of this frame’s data as a Representation object.

Note: In order to make an in-place change of the representation of a Frame or SkyCoord object, set the representation attribute of that object to the desired new representation, or use the set_representation_cls method to also set the differential.

Parameters:
  • base (subclass of BaseRepresentation or string) – The type of representation to generate. Must be a class (not an instance), or the string name of the representation class.

  • s (subclass of ~astropy.coordinates.BaseDifferential, str, optional) – Class in which any velocities should be represented. Must be a class (not an instance), or the string name of the differential class. If equal to ‘base’ (default), inferred from the base class. If None, all velocity information is dropped.

  • in_frame_units (bool, keyword-only) – Force the representation units to match the specified units particular to this frame

Returns:

newrep (BaseRepresentation-derived object) – A new representation object of this frame’s data.

Raises:

AttributeError – If this object had no data

Examples

>>> from astropy import units as u
>>> from astropy.coordinates import SkyCoord, CartesianRepresentation
>>> coord = SkyCoord(0*u.deg, 0*u.deg)
>>> coord.represent_as(CartesianRepresentation)  
<CartesianRepresentation (x, y, z) [dimensionless]
        (1., 0., 0.)>
>>> coord.representation_type = CartesianRepresentation
>>> coord  
<SkyCoord (ICRS): (x, y, z) [dimensionless]
    (1., 0., 0.)>
reshape(*args, **kwargs)

Returns an instance containing the same data with a new shape.

Parameters are as for reshape(). Note that it is not always possible to change the shape of an array without copying the data (see reshape() documentation). If you want an error to be raise if the data is copied, you should assign the new shape to the shape attribute (note: this may not be implemented for all classes using NDArrayShapeMethods).

separation(other)

Computes on-sky separation between this coordinate and another.

Note

If the other coordinate object is in a different frame, it is first transformed to the frame of this object. This can lead to unintuitive behavior if not accounted for. Particularly of note is that self.separation(other) and other.separation(self) may not give the same answer in this case.

Parameters:

other (~astropy.coordinates.BaseCoordinateFrame) – The coordinate to get the separation to.

Returns:

sep (~astropy.coordinates.Angle) – The on-sky separation between this and the other coordinate.

Notes

The separation is calculated using the Vincenty formula, which is stable at all locations, including poles and antipodes [1].

separation_3d(other)

Computes three dimensional separation between this coordinate and another.

Parameters:

other (~astropy.coordinates.BaseCoordinateFrame) – The coordinate system to get the distance to.

Returns:

sep (~astropy.coordinates.Distance) – The real-space distance between these two coordinates.

Raises:

ValueError – If this or the other coordinate do not have distances.

set_representation_cls(base=None, s='base')

Set representation and/or differential class for this frame’s data.

Parameters:
  • base (str, ~astropy.coordinates.BaseRepresentation subclass, optional) – The name or subclass to use to represent the coordinate data.

  • s (~astropy.coordinates.BaseDifferential subclass, optional) – The differential subclass to use to represent any velocities, such as proper motion and radial velocity. If equal to ‘base’, which is the default, it will be inferred from the representation. If None, the representation will drop any differentials.

squeeze(*args, **kwargs)

Return an instance with single-dimensional shape entries removed.

Parameters are as for squeeze(). All internal data are views of the data of the original.

swapaxes(*args, **kwargs)

Return an instance with the given axes interchanged.

Parameters are as for swapaxes(): axis1, axis2. All internal data are views of the data of the original.

take(indices, axis=None, out=None, mode='raise')

Return a new instance formed from the elements at the given indices.

Parameters are as for take(), except that, obviously, no output array can be given.

transform_to(new_frame)

Transform this object’s coordinate data to a new frame.

Parameters:

new_frame (coordinate-like) – The frame to transform this coordinate frame into.

Returns:

transframe (coordinate-like) – A new object with the coordinate data represented in the newframe system.

Raises:

ValueError – If there is no possible transformation route.

transpose(*args, **kwargs)

Return an instance with the data transposed.

Parameters are as for transpose(). All internal data are views of the data of the original.