Example #1
0
class TETE(BaseRADecFrame):
    """
    An equatorial coordinate or frame using the True Equator and True Equinox (TETE).

    Equatorial coordinate frames measure RA with respect to the equinox and declination
    with with respect to the equator. The location of the equinox and equator vary due
    the gravitational torques on the oblate Earth. This variation is split into precession
    and nutation, although really they are two aspects of a single phenomena. The smooth,
    long term variation is known as precession, whilst smaller, periodic components are
    called nutation.

    Calculation of the true equator and equinox involves the application of both precession
    and nutation, whilst only applying precession gives a mean equator and equinox.

    TETE coordinates are often referred to as "apparent" coordinates, or
    "apparent place". TETE is the apparent coordinate system used by JPL Horizons
    and is the correct coordinate system to use when combining the right ascension
    with local apparent sidereal time to calculate the apparent (TIRS) hour angle.

    For more background on TETE, see the references provided in the
    :ref:`astropy:astropy-coordinates-seealso` section of the documentation.
    Of particular note are Sections 5 and 6 of
    `USNO Circular 179 <https://arxiv.org/abs/astro-ph/0602086>`_) and
    especially the diagram at the top of page 57.

    This frame also includes frames that are defined *relative* to the center of the Earth,
    but that are offset (in both position and velocity) from the center of the Earth. You
    may see such non-geocentric coordinates referred to as "topocentric".

    The frame attributes are listed under **Other Parameters**.
    """

    obstime = TimeAttribute(default=DEFAULT_OBSTIME)
    location = EarthLocationAttribute(default=EARTH_CENTER)
Example #2
0
class UVW(BaseCoordinateFrame):
    """
    Written by Joshua G. Albert - [email protected]
    A coordinate or frame in the UVW system.  
    This frame has the following frame attributes, which are necessary for
    transforming from UVW to some other system:
    * ``obstime``
        The time at which the observation is taken.  Used for determining the
        position and orientation of the Earth.
    * ``location``
        The location on the Earth.  This can be specified either as an
        `~astropy.coordinates.EarthLocation` object or as anything that can be
        transformed to an `~astropy.coordinates.ITRS` frame.
    * ``phaseDir``
        The phase tracking center of the frame.  This can be specified either as an
        (ra,dec) `~astropy.units.Qunatity` or as anything that can be
        transformed to an `~astropy.coordinates.ICRS` frame.
    Parameters
    ----------
    representation : `BaseRepresentation` or None
        A representation object or None to have no data (or use the other keywords)
    u : :class:`~astropy.units.Quantity`, optional, must be keyword
        The u coordinate for this object (``v`` and ``w`` must also be given and
        ``representation`` must be None).
    v : :class:`~astropy.units.Quantity`, optional, must be keyword
        The v coordinate for this object (``u`` and ``w`` must also be given and
        ``representation`` must be None).
    w : :class:`~astropy.units.Quantity`, optional, must be keyword
        The w coordinate for this object (``u`` and ``v`` must also be given and
        ``representation`` must be None).
    Notes
    -----
    This is useful for radio astronomy.
    """

    frame_specific_representation_info = {
        'cartesian': [
            RepresentationMapping('x', 'u'),
            RepresentationMapping('y', 'v'),
            RepresentationMapping('z', 'w')
        ],
    }

    default_representation = CartesianRepresentation

    obstime = TimeAttribute(default=None)
    location = EarthLocationAttribute(default=None)
    phase = CoordinateAttribute(ICRS, default=None)

    def __init__(self, *args, **kwargs):
        super(UVW, self).__init__(*args, **kwargs)

    @property
    def elevation(self):
        """
        Elevation above the horizon of the direction
        """
        return self.phase.transform_to(
            AltAz(location=self.location, obstime=self.obstime)).alt
Example #3
0
class CIRS(BaseRADecFrame):
    """
    A coordinate or frame in the Celestial Intermediate Reference System (CIRS).

    The frame attributes are listed under **Other Parameters**.
    """

    obstime = TimeAttribute(default=DEFAULT_OBSTIME)
    location = EarthLocationAttribute(default=EARTH_CENTER)
Example #4
0
class ENU(BaseCoordinateFrame):
    """
    Written by Joshua G. Albert - [email protected]
    A coordinate or frame in the East-North-Up (ENU) system.  
    This frame has the following frame attributes, which are necessary for
    transforming from ENU to some other system:
    * ``obstime``
        The time at which the observation is taken.  Used for determining the
        position and orientation of the Earth.
    * ``location``
        The location on the Earth.  This can be specified either as an
        `~astropy.coordinates.EarthLocation` object or as anything that can be
        transformed to an `~astropy.coordinates.ITRS` frame.
    Parameters
    ----------
    representation : `BaseRepresentation` or None
        A representation object or None to have no data (or use the other keywords)
    east : :class:`~astropy.units.Quantity`, optional, must be keyword
        The east coordinate for this object (``north`` and ``up`` must also be given and
        ``representation`` must be None).
    north : :class:`~astropy.units.Quantity`, optional, must be keyword
        The north coordinate for this object (``east`` and ``up`` must also be given and
        ``representation`` must be None).
    up : :class:`~astropy.units.Quantity`, optional, must be keyword
        The up coordinate for this object (``north`` and ``east`` must also be given and
        ``representation`` must be None).
    Notes
    -----
    This is useful as an intermediate frame between ITRS and UVW for radio astronomy
    """

    frame_specific_representation_info = {
        'cartesian': [
            RepresentationMapping('x', 'east'),
            RepresentationMapping('y', 'north'),
            RepresentationMapping('z', 'up')
        ],
    }

    default_representation = CartesianRepresentation

    obstime = TimeAttribute(
        default=None
    )  #at.Time("2000-01-01T00:00:00.000",format="isot",scale="tai"))
    location = EarthLocationAttribute(default=None)

    def __init__(self, *args, **kwargs):
        super(ENU, self).__init__(*args, **kwargs)

    @property
    def elevation(self):
        """
        Elevation above the horizon of the direction, in degrees
        """
        return np.arctan2(self.up,
                          np.sqrt(self.north**2 + self.east**2)) * 180. / np.pi
Example #5
0
class HADec(BaseCoordinateFrame):
    """
    A coordinate or frame in the Hour Angle-Declination system (Equatorial
    coordinates) with respect to the WGS84 ellipsoid.  Hour Angle is oriented
    with respect to upper culmination such that the hour angle is negative to
    the East and positive to the West.

    This frame is assumed to *include* refraction effects if the ``pressure``
    frame attribute is non-zero.

    The frame attributes are listed under **Other Parameters**, which are
    necessary for transforming from HADec to some other system.
    """

    frame_specific_representation_info = {
        r.SphericalRepresentation: [
            RepresentationMapping('lon', 'ha', u.hourangle),
            RepresentationMapping('lat', 'dec')
        ]
    }

    default_representation = r.SphericalRepresentation
    default_differential = r.SphericalCosLatDifferential

    obstime = TimeAttribute(default=None)
    location = EarthLocationAttribute(default=None)
    pressure = QuantityAttribute(default=0, unit=u.hPa)
    temperature = QuantityAttribute(default=0, unit=u.deg_C)
    relative_humidity = QuantityAttribute(default=0,
                                          unit=u.dimensionless_unscaled)
    obswl = QuantityAttribute(default=1 * u.micron, unit=u.micron)

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        if self.has_data:
            self._set_data_lon_wrap_angle(self.data)

    @staticmethod
    def _set_data_lon_wrap_angle(data):
        if hasattr(data, 'lon'):
            data.lon.wrap_angle = 180. * u.deg
        return data

    def represent_as(self, base, s='base', in_frame_units=False):
        """
        Ensure the wrap angle for any spherical
        representations.
        """
        data = super().represent_as(base, s, in_frame_units=in_frame_units)
        self._set_data_lon_wrap_angle(data)
        return data
Example #6
0
class AltAz(BaseCoordinateFrame):
    """
    A coordinate or frame in the Altitude-Azimuth system (Horizontal
    coordinates) with respect to the WGS84 ellipsoid.  Azimuth is oriented
    East of North (i.e., N=0, E=90 degrees).  Altitude is also known as
    elevation angle, so this frame is also in the Azimuth-Elevation system.

    This frame is assumed to *include* refraction effects if the ``pressure``
    frame attribute is non-zero.

    The frame attributes are listed under **Other Parameters**, which are
    necessary for transforming from AltAz to some other system.
    """

    frame_specific_representation_info = {
        r.SphericalRepresentation: [
            RepresentationMapping('lon', 'az'),
            RepresentationMapping('lat', 'alt')
        ]
    }

    default_representation = r.SphericalRepresentation
    default_differential = r.SphericalCosLatDifferential

    obstime = TimeAttribute(default=None)
    location = EarthLocationAttribute(default=None)
    pressure = QuantityAttribute(default=0, unit=u.hPa)
    temperature = QuantityAttribute(default=0, unit=u.deg_C)
    relative_humidity = QuantityAttribute(default=0,
                                          unit=u.dimensionless_unscaled)
    obswl = QuantityAttribute(default=1 * u.micron, unit=u.micron)

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

    @property
    def secz(self):
        """
        Secant of the zenith angle for this coordinate, a common estimate of
        the airmass.
        """
        return 1 / np.sin(self.alt)

    @property
    def zen(self):
        """
        The zenith angle (or zenith distance / co-altitude) for this coordinate.
        """
        return _90DEG.to(self.alt.unit) - self.alt
Example #7
0
from .moon import *  # noqa
from .mcmf import *  # noqa
from .topo import *  # noqa
from .time import *  # noqa
from .sky_coordinate import SkyCoord  # noqa

from astropy.coordinates.baseframe import frame_transform_graph
from astropy.coordinates.attributes import EarthLocationAttribute

if 'location' in frame_transform_graph.frame_attributes:
    frame_transform_graph.frame_attributes[
        'location'] = EarthLocationAttribute(default=None)