ó
šßÈ[c           @` se  d  Z  d d l m Z m Z m Z m Z d d l Z d d l m Z d d l	 Z
 d d l m Z d d l m Z d d	 l m Z d d
 l m Z d d l m Z d d d g Z e d d d d f ƒ Z e d d d d f ƒ Z e d d d d d f ƒ Z d e j f d „  ƒ  YZ d „  Z d e f d „  ƒ  YZ d e j f d „  ƒ  YZ d e f d „  ƒ  YZ  d S(    u\   
This module contains the fundamental classes used for representing
coordinates in astropy.
i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t
   namedtuplei   (   t   sixi   (   t   angle_utilities(   t   units(   t
   isiterable(   t   NUMPY_LT_1_14_1u   Angleu   Latitudeu	   Longitudeu	   hms_tupleu   hu   mu   su	   dms_tupleu   du   signed_dms_tupleu   signt   Anglec        	   B` sì   e  Z d  Z e j Z e Z d d e d „ Z	 e
 d „  ƒ Z e
 d „  ƒ Z d „  Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z d e d	 d e e d
 d d „ Z e d „ Z d d d „ Z d d „ Z d „  Z d „  Z RS(   u:  
    One or more angular value(s) with units equivalent to radians or degrees.

    An angle can be specified either as an array, scalar, tuple (see
    below), string, `~astropy.units.Quantity` or another
    :class:`~astropy.coordinates.Angle`.

    The input parser is flexible and supports a variety of formats::

      Angle('10.2345d')
      Angle(['10.2345d', '-20d'])
      Angle('1:2:30.43 degrees')
      Angle('1 2 0 hours')
      Angle(np.arange(1, 8), unit=u.deg)
      Angle('1Â°2â€²3â€³')
      Angle('1d2m3.4s')
      Angle('-1h2m3s')
      Angle('-1h2.5m')
      Angle('-1:2.5', unit=u.deg)
      Angle((10, 11, 12), unit='hourangle')  # (h, m, s)
      Angle((-1, 2, 3), unit=u.deg)  # (d, m, s)
      Angle(10.2345 * u.deg)
      Angle(Angle(10.2345 * u.deg))

    Parameters
    ----------
    angle : `~numpy.array`, scalar, `~astropy.units.Quantity`, :class:`~astropy.coordinates.Angle`
        The angle value. If a tuple, will be interpreted as ``(h, m,
        s)`` or ``(d, m, s)`` depending on ``unit``. If a string, it
        will be interpreted following the rules described above.

        If ``angle`` is a sequence or array of strings, the resulting
        values will be in the given ``unit``, or if `None` is provided,
        the unit will be taken from the first given value.

    unit : `~astropy.units.UnitBase`, str, optional
        The unit of the value specified for the angle.  This may be
        any string that `~astropy.units.Unit` understands, but it is
        better to give an actual unit object.  Must be an angular
        unit.

    dtype : `~numpy.dtype`, optional
        See `~astropy.units.Quantity`.

    copy : bool, optional
        See `~astropy.units.Quantity`.

    Raises
    ------
    `~astropy.units.UnitsError`
        If a unit is not provided or it is not an angular unit.
    c         C` sq  t  | t j ƒ sI| d  k	 r9 |  j t j | ƒ ƒ } n  t  | t ƒ r] |  j | | ƒ } qIt  | t j	 ƒ rê t
 j | | ƒ \ } } | d  k rœ | } n  t  | t ƒ rÀ |  j | | ƒ } n  | | k	 rFt j | | d t ƒ} qFqIt | ƒ rIt  | t j ƒ o| j j d k rIg  | D] } t | | d t ƒ^ q"} qIn  t t |  ƒ j |  | | d | d | ƒS(   Nt   copyu   SUVOt   dtype(   t
   isinstancet   ut   Quantityt   Nonet   _convert_unit_to_angle_unitt   Unitt   tuplet   _tuple_to_floatR   t   string_typest   utilt   parse_anglet   FalseR   t   npt   ndarrayR   t   kindR
   t   supert   __new__(   t   clst   anglet   unitR   R   t
   angle_unitt   x(    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyR   W   s&    	.!c         C` sW   | t  j k r t j |  Œ  S| t  j k r8 t j |  Œ  St  j d j |  | ƒ ƒ ‚ d S(   u   
        Converts an angle represented as a 3-tuple or 2-tuple into a floating
        point number in the given unit.
        u!   Can not parse '{0}' as unit '{1}'N(   R   t	   hourangleR   t   hms_to_hourst   degreet   dms_to_degreest
   UnitsErrort   format(   R   R    (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyR   t   s    c         C` s   |  t  j k r t  j S|  S(   N(   R   t   hourR#   (   R    (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyR   ƒ   s    c         C` s#   t  t |  ƒ j |  j | ƒ ƒ d  S(   N(   R   R
   t	   _set_unitR   (   t   selfR    (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyR*   ‡   s    c         C` s   |  j  S(   uB   
        The angle's value in hours (read-only property).
        (   R#   (   R+   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyR)   Š   s    c         C` s   t  t j |  j ƒ Œ  S(   uƒ   
        The angle's value in hours, as a named tuple with ``(h, m, s)``
        members.  (This is a read-only property.)
        (   t	   hms_tupleR   t   hours_to_hmsR#   (   R+   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyt   hms‘   s    c         C` s   t  t j |  j ƒ Œ  S(   u…   
        The angle's value in degrees, as a named tuple with ``(d, m, s)``
        members.  (This is a read-only property.)
        (   t	   dms_tupleR   t   degrees_to_dmsR%   (   R+   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyt   dms™   s    c         C` s.   t  t j |  j ƒ t j t j |  j ƒ ƒ Œ S(   uŒ  
        The angle's value in degrees, as a named tuple with ``(sign, d, m, s)``
        members.  The ``d``, ``m``, ``s`` are thus always positive, and the sign of
        the angle is given by ``sign``. (This is a read-only property.)

        This is primarily intended for use with `dms` to generate string
        representations of coordinates that are correct for negative angles.
        (   t   signed_dms_tupleR   t   signR%   R   R0   t   abs(   R+   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyt
   signed_dms¡   s    
u   fromuniti   c	         ` se  | d  k r |  j } n |  j t j | ƒ ƒ } i i d t j 6d t j 6d  6i d d d g t j 6d d d g t j 6d	 6i d
 t j 6d t j 6d 6}	 ˆ d k rï ˆ |	 k rÉ t d j ˆ ƒ ƒ ‚ n  |	 ˆ }
 | |
 k rï |
 | ‰ qï n  | t j k rx| r?|  j } ˆ d  k	 r3d t	 ˆ ƒ d j ‰ qud j ‰ qˆ d k rTd ‰ n  |  j } ‡ ‡ ‡ ‡ f d †  ‰ n”| t j k r| rÈ|  j
 } ˆ d  k	 r¼d t	 ˆ ƒ d j ‰ qþd j ‰ qˆ d k rÝd ‰ n  |  j
 } ‡ ‡ ‡ ‡ f d †  ‰ n| j t j ƒ rý| rZ|  j | ƒ } ˆ d  k	 rNd t	 ˆ ƒ d j ‰ qúd j ‰ qˆ d k râ|  j | ƒ } | j d ˆ ƒ ‰ ˆ d	 k r£ˆ d d !‰ n  ˆ d  k	 rÊ‡ ‡ f d †  } | ‰ qú‡ f d †  } | ‰ qt d j | j ƒ ƒ ‚ n t j d ƒ ‚ ‡  ‡ ‡ f d †  } t j | d d g ƒ} | | ƒ } | j d k ra| d! } n  | S("   u
   A string representation of the angle.

        Parameters
        ----------
        unit : `~astropy.units.UnitBase`, optional
            Specifies the unit.  Must be an angular unit.  If not
            provided, the unit used to initialize the angle will be
            used.

        decimal : bool, optional
            If `True`, a decimal representation will be used, otherwise
            the returned string will be in sexagesimal form.

        sep : str, optional
            The separator between numbers in a sexagesimal
            representation.  E.g., if it is ':', the result is
            ``'12:41:11.1241'``. Also accepts 2 or 3 separators. E.g.,
            ``sep='hms'`` would give the result ``'12h41m11.1241s'``, or
            sep='-:' would yield ``'11-21:17.124'``.  Alternatively, the
            special string 'fromunit' means 'dms' if the unit is
            degrees, or 'hms' if the unit is hours.

        precision : int, optional
            The level of decimal precision.  If ``decimal`` is `True`,
            this is the raw precision, otherwise it gives the
            precision of the last place of the sexagesimal
            representation (seconds).  If `None`, or not provided, the
            number of decimal places is determined by the value, and
            will be between 0-8 decimal places as required.

        alwayssign : bool, optional
            If `True`, include the sign no matter what.  If `False`,
            only include the sign if it is negative.

        pad : bool, optional
            If `True`, include leading zeros when needed to ensure a
            fixed number of characters for sexagesimal representation.

        fields : int, optional
            Specifies the number of fields to display when outputting
            sexagesimal notation.  For example:

                - fields == 1: ``'5d'``
                - fields == 2: ``'5d45m'``
                - fields == 3: ``'5d45m32.5s'``

            By default, all fields are displayed.

        format : str, optional
            The format of the result.  If not provided, an unadorned
            string is returned.  Supported values are:

            - 'latex': Return a LaTeX-formatted string

            - 'unicode': Return a string containing non-ASCII unicode
              characters, such as the degree symbol

        Returns
        -------
        strrepr : str or array
            A string representation of the angle. If the angle is an array, this
            will be an array with a unicode dtype.


        u   dmsu   hmsu   ^\circu	   {}^\primeu   {}^{\prime\prime}u   ^\mathrm{h}u   ^\mathrm{m}u   ^\mathrm{s}u   latexu   Â°â€²â€³u   Ê°áµË¢u   unicodeu   fromunitu   Unknown format '{0}'u   {0:0.u   f}u   {0:g}c      
   ` s%   t  j |  d ˆ d ˆ d ˆ d ˆ  ƒS(   Nt	   precisiont   sept   padt   fields(   R   t   degrees_to_string(   R"   (   R9   R8   R6   R7   (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyt   <lambda>  s   c      
   ` s%   t  j |  d ˆ d ˆ d ˆ d ˆ  ƒS(   NR6   R7   R8   R9   (   R   t   hours_to_string(   R"   (   R9   R8   R6   R7   (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyR;   &  s   u   {0:1.R(   i   iÿÿÿÿc         ` s   d t  ˆ  ƒ d j |  ˆ ƒ S(   Nu   {0:0.u   f}{1}(   t   strR(   (   t   val(   R6   t   unit_string(    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyt   plain_unit_format8  s    c         ` s   d j  |  ˆ  ƒ S(   Nu   {0:g}{1}(   R(   (   R>   (   R?   (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyR@   =  s    u4   '{0}' can not be represented in sexagesimal notationu/   The unit value provided is not an angular unit.c         ` sW   ˆ t  |  ƒ ƒ } ˆ  r5 | j d ƒ r5 d | } n  ˆ d k rS d j | ƒ } n  | S(   Nu   -u   +u   latexu   ${0}$(   t   floatt
   startswithR(   (   R>   t   s(   t
   alwayssignR(   t   func(    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyt	   do_formatJ  s    t   otypesu   Ui    N(    (   R   R    R   R   R   R%   R#   t
   ValueErrorR(   R=   R)   t   is_equivalentt   radiant   to_valuet	   to_stringt   nameR'   R   t	   vectorizet   ndim(   R+   R    t   decimalR7   R6   RD   R8   R9   R(   t
   separatorst   sepst   valuesR@   RF   t   format_ufunct   result(    (   RD   R9   R(   RE   R8   R6   R7   R?   s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyRL   ®   s„    D


									c         C` sS   t  | ƒ } t j |  | d t j ƒ d t j | } | rK | |  d <n | Sd S(   u-  
        Wrap the `Angle` object at the given ``wrap_angle``.

        This method forces all the angle values to be within a contiguous
        360 degree range so that ``wrap_angle - 360d <= angle <
        wrap_angle``. By default a new Angle object is returned, but if the
        ``inplace`` argument is `True` then the `Angle` object is wrapped in
        place and nothing is returned.

        For instance::

          >>> from astropy.coordinates import Angle
          >>> import astropy.units as u
          >>> a = Angle([-20.0, 150.0, 350.0] * u.deg)

          >>> a.wrap_at(360 * u.deg).degree  # Wrap into range 0 to 360 degrees  # doctest: +FLOAT_CMP
          array([340., 150., 350.])

          >>> a.wrap_at('180d', inplace=True)  # Wrap into range -180 to 180 degrees  # doctest: +FLOAT_CMP
          >>> a.degree  # doctest: +FLOAT_CMP
          array([-20., 150., -10.])

        Parameters
        ----------
        wrap_angle : str, `Angle`, angular `~astropy.units.Quantity`
            Specifies a single value for the wrap angle.  This can be any
            object that can initialize an `Angle` object, e.g. ``'180d'``,
            ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.

        inplace : bool
            If `True` then wrap the object in place instead of returning
            a new `Angle`

        Returns
        -------
        out : Angle or `None`
            If ``inplace is False`` (default), return new `Angle` object
            with angles wrapped accordingly.  Otherwise wrap in place and
            return `None`.
        g     €v@N(    (   R
   R   t   modR   t   deg(   R+   t
   wrap_anglet   inplacet   wrapped(    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyt   wrap_atY  s
    ),c         C` sr   t  } | d k	 r4 | t j t | ƒ |  k ƒ M} n  | rh | d k	 rh | t j |  t | ƒ k  ƒ M} n  t | ƒ S(   u  
        Check if all angle(s) satisfy ``lower <= angle < upper``

        If ``lower`` is not specified (or `None`) then no lower bounds check is
        performed.  Likewise ``upper`` can be left unspecified.  For example::

          >>> from astropy.coordinates import Angle
          >>> import astropy.units as u
          >>> a = Angle([-20, 150, 350] * u.deg)
          >>> a.is_within_bounds('0d', '360d')
          False
          >>> a.is_within_bounds(None, '360d')
          True
          >>> a.is_within_bounds(-30 * u.deg, None)
          True

        Parameters
        ----------
        lower : str, `Angle`, angular `~astropy.units.Quantity`, `None`
            Specifies lower bound for checking.  This can be any object
            that can initialize an `Angle` object, e.g. ``'180d'``,
            ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.
        upper : str, `Angle`, angular `~astropy.units.Quantity`, `None`
            Specifies upper bound for checking.  This can be any object
            that can initialize an `Angle` object, e.g. ``'180d'``,
            ``180 * u.deg``, or ``Angle(180, unit=u.deg)``.

        Returns
        -------
        is_within_bounds : bool
            `True` if all angles satisfy ``lower <= angle < upper``
        N(   t   TrueR   R   t   allR
   t   bool(   R+   t   lowert   uppert   ok(    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyt   is_within_boundsŠ  s    !""c         ` s]   ˆ j  r ˆ j d ˆ  ƒ St r1 ‡  f d †  } n ‡  ‡ f d †  } t j ˆ d i | d 6ƒS(   NR(   c         ` s   |  j  d ˆ  ƒ S(   NR(   (   RL   (   R"   (   R(   (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyt	   formatter·  s    c         ` s   ˆ j  |  ƒ j d ˆ  ƒ S(   NR(   (   t	   _new_viewRL   (   R"   (   R(   R+   (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyRc   ¼  s    Rc   u   all(   t   isscalarRL   R	   R   t   array2string(   R+   R(   Rc   (    (   R(   R+   s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyt   _str_helper²  s    	c         C` s
   |  j  ƒ  S(   N(   Rg   (   R+   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyt   __str__Á  s    c         C` s   |  j  d d ƒ S(   NR(   u   latex(   Rg   (   R+   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyt   _repr_latex_Ä  s    N(   t   __name__t
   __module__t   __doc__R   RJ   t   _equivalent_unitR\   t    _include_easy_conversion_membersR   R   t   staticmethodR   R   R*   t   propertyR)   R.   R1   R5   R   RL   R[   Rb   Rg   Rh   Ri   (    (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyR
      s&   4				©1(	c         C` sC   t  |  t ƒ r# t d „  |  Dƒ ƒ St  |  t ƒ r? |  j t ƒ S|  S(   uÃ   Return any Angle subclass objects as an Angle objects.

    This is used to ensure that Latitude and Longitude change to Angle
    objects when they are used in calculations (such as lon/2.)
    c         s` s   |  ] } t  | ƒ Vq d  S(   N(   t   _no_angle_subclass(   t   .0t   _obj(    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pys	   <genexpr>Ï  s    (   R   R   R
   t   view(   t   obj(    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyRq   È  s    t   Latitudec           B` sD   e  Z d  Z d d „ Z d d „ Z d „  Z d d „ Z d „  Z RS(   u¹  
    Latitude-like angle(s) which must be in the range -90 to +90 deg.

    A Latitude object is distinguished from a pure
    :class:`~astropy.coordinates.Angle` by virtue of being constrained
    so that::

      -90.0 * u.deg <= angle(s) <= +90.0 * u.deg

    Any attempt to set a value outside that range will result in a
    `ValueError`.

    The input angle(s) can be specified either as an array, list,
    scalar, tuple (see below), string,
    :class:`~astropy.units.Quantity` or another
    :class:`~astropy.coordinates.Angle`.

    The input parser is flexible and supports all of the input formats
    supported by :class:`~astropy.coordinates.Angle`.

    Parameters
    ----------
    angle : array, list, scalar, `~astropy.units.Quantity`, `Angle`. The
        angle value(s). If a tuple, will be interpreted as ``(h, m, s)`` or
        ``(d, m, s)`` depending on ``unit``. If a string, it will be
        interpreted following the rules described for
        :class:`~astropy.coordinates.Angle`.

        If ``angle`` is a sequence or array of strings, the resulting
        values will be in the given ``unit``, or if `None` is provided,
        the unit will be taken from the first given value.

    unit : :class:`~astropy.units.UnitBase`, str, optional
        The unit of the value specified for the angle.  This may be
        any string that `~astropy.units.Unit` understands, but it is
        better to give an actual unit object.  Must be an angular
        unit.

    Raises
    ------
    `~astropy.units.UnitsError`
        If a unit is not provided or it is not an angular unit.
    `TypeError`
        If the angle parameter is an instance of :class:`~astropy.coordinates.Longitude`.
    c         K` sP   t  | t ƒ r t d ƒ ‚ n  t t |  ƒ j |  | d | | } | j ƒ  | S(   Nu9   A Latitude angle cannot be created from a Longitude angleR    (   R   t	   Longitudet	   TypeErrorR   Rv   R   t   _validate_angles(   R   R   R    t   kwargsR+   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyR     s
    $
c         C` s   | d k r |  } n  t j j | j d ƒ } t j j | j d ƒ } t j | j | k  ƒ su t j | j | k ƒ r™ t d j	 | j t j ƒ ƒ ƒ ‚ n  d S(   un   Check that angles are between -90 and 90 degrees.
        If not given, the check is done on the object itselfg     €VÀg     €V@uD   Latitude angle(s) must be within -90 deg <= angle <= 90 deg, got {0}N(
   R   R   R%   t   toR    R   t   anyt   valueRH   R(   (   R+   t   anglesR_   R`   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyRy   
  s    	0	c         C` sH   t  | t ƒ r t d ƒ ‚ n  |  j | ƒ t t |  ƒ j | | ƒ d  S(   Nu8   A Longitude angle cannot be assigned to a Latitude angle(   R   Rw   Rx   Ry   R   Rv   t   __setitem__(   R+   t   itemR}   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyR     s    c         C` s(   t  t |  ƒ j | d | ƒ} t | ƒ S(   Nt   context(   R   R
   t   __array_wrap__Rq   (   R+   Ru   R   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyR‚   #  s    c         O` s%   t  t |  ƒ j | | Ž  } t | ƒ S(   N(   R   Rv   t   __array_ufunc__Rq   (   R+   t   argsRz   t   results(    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyRƒ   '  s    N(	   Rj   Rk   Rl   R   R   Ry   R   R‚   Rƒ   (    (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyRv   Ô  s   -		t   LongitudeInfoc           B` s   e  Z e j j d Z RS(   u
   wrap_angle(   u
   wrap_angle(   Rj   Rk   R   t   QuantityInfot   _represent_as_dict_attrs(    (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyR†   ,  s   Rw   c           B` s   e  Z d  Z d
 Z e d e j ƒ Z e	 ƒ  Z
 d
 d
 d „ Z d „  Z d „  Z e d „  ƒ Z e j d „  ƒ Z d „  Z d
 d „ Z d	 „  Z RS(   u^	  
    Longitude-like angle(s) which are wrapped within a contiguous 360 degree range.

    A ``Longitude`` object is distinguished from a pure
    :class:`~astropy.coordinates.Angle` by virtue of a ``wrap_angle``
    property.  The ``wrap_angle`` specifies that all angle values
    represented by the object will be in the range::

      wrap_angle - 360 * u.deg <= angle(s) < wrap_angle

    The default ``wrap_angle`` is 360 deg.  Setting ``wrap_angle=180 *
    u.deg`` would instead result in values between -180 and +180 deg.
    Setting the ``wrap_angle`` attribute of an existing ``Longitude``
    object will result in re-wrapping the angle values in-place.

    The input angle(s) can be specified either as an array, list,
    scalar, tuple, string, :class:`~astropy.units.Quantity`
    or another :class:`~astropy.coordinates.Angle`.

    The input parser is flexible and supports all of the input formats
    supported by :class:`~astropy.coordinates.Angle`.

    Parameters
    ----------
    angle : array, list, scalar, `~astropy.units.Quantity`,
        :class:`~astropy.coordinates.Angle` The angle value(s). If a tuple,
        will be interpreted as ``(h, m s)`` or ``(d, m, s)`` depending
        on ``unit``. If a string, it will be interpreted following the
        rules described for :class:`~astropy.coordinates.Angle`.

        If ``angle`` is a sequence or array of strings, the resulting
        values will be in the given ``unit``, or if `None` is provided,
        the unit will be taken from the first given value.

    unit : :class:`~astropy.units.UnitBase`, str, optional
        The unit of the value specified for the angle.  This may be
        any string that `~astropy.units.Unit` understands, but it is
        better to give an actual unit object.  Must be an angular
        unit.

    wrap_angle : :class:`~astropy.coordinates.Angle` or equivalent, or None
        Angle at which to wrap back to ``wrap_angle - 360 deg``.
        If ``None`` (default), it will be taken to be 360 deg unless ``angle``
        has a ``wrap_angle`` attribute already (i.e., is a ``Longitude``),
        in which case it will be taken from there.

    Raises
    ------
    `~astropy.units.UnitsError`
        If a unit is not provided or it is not an angular unit.
    `TypeError`
        If the angle parameter is an instance of :class:`~astropy.coordinates.Latitude`.
    ih  c         K` ss   t  | t ƒ r t d ƒ ‚ n  t t |  ƒ j |  | d | | } | d  k rf t | d | j ƒ } n  | | _	 | S(   Nu:   A Longitude angle cannot be created from a Latitude angle.R    u
   wrap_angle(
   R   Rv   Rx   R   Rw   R   R   t   getattrt   _default_wrap_angleRX   (   R   R   R    RX   Rz   R+   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyR   k  s    $	c         C` sE   t  | t ƒ r t d ƒ ‚ n  t t |  ƒ j | | ƒ |  j ƒ  d  S(   Nu8   A Latitude angle cannot be assigned to a Longitude angle(   R   Rv   Rx   R   Rw   R   t   _wrap_internal(   R+   R€   R}   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyR   v  s    c         C` s¹   t  j j |  j d ƒ } |  j j |  j ƒ } | | } |  j } t j | | k  ƒ sj t j | | k ƒ rµ t j	 | | | ƒ | } t  j
 | |  j ƒ } t t |  ƒ j d | ƒ n  d S(   u¡   
        Wrap the internal values in the Longitude object. Using the
        :meth:`~astropy.coordinates.Angle.wrap_at` method causes
        recursion.
        g     €v@N(    (   R   R%   R{   R    RX   RK   R}   R   R|   RV   R   R   Rw   R   (   R+   t   a360RX   t   wrap_angle_floort
   self_angleRZ   R}   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyR‹   }  s    	
	*c         C` s   |  j  S(   N(   t   _wrap_angle(   R+   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyRX     s    c         C` s   t  | ƒ |  _ |  j ƒ  d  S(   N(   R
   R   R‹   (   R+   R}   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyRX   ”  s    c         C` s2   t  t |  ƒ j | ƒ t | d |  j ƒ |  _ d  S(   Nu   _wrap_angle(   R   Rw   t   __array_finalize__R‰   RŠ   R   (   R+   Ru   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyR   ™  s    	c         C` s(   t  t |  ƒ j | d | ƒ} t | ƒ S(   NR   (   R   R
   R‚   Rq   (   R+   Ru   R   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyR‚   Ÿ  s    c         O` s%   t  t |  ƒ j | | Ž  } t | ƒ S(   N(   R   Rw   Rƒ   Rq   (   R+   R„   Rz   R…   (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyRƒ   £  s    N(   Rj   Rk   Rl   R   R   R
   R   RW   RŠ   R†   t   infoR   R   R‹   Rp   RX   t   setterR   R‚   Rƒ   (    (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyRw   0  s   5				(!   Rl   t
   __future__R    R   R   R   t   matht   collectionsR   t   numpyR   t   externR   t    R   R   R   R   t   utilsR   t   utils.compatR	   t   __all__R,   R/   R2   t   SpecificTypeQuantityR
   Rq   Rv   R‡   R†   Rw   (    (    (    s9   lib/python2.7/site-packages/astropy/coordinates/angles.pyt   <module>   s&   "ÿ ª	X