
[c           @` s3  d  Z  d d l m Z m Z m Z m Z d d l Z d d l Z d d l m	 Z	 d d l
 Z
 d d l Z d d l m Z d d l m Z d d	 l m Z m Z m Z m Z m Z m Z d d
 l m Z d d l m Z m Z d d l m Z d d l m  Z  d d l! m" Z" m# Z# d d l$ m% Z% d d l& m' Z( d d l) m* Z* m+ Z+ m, Z, d d d d g Z- d g Z. d Z/ e j0 e j1 e j2 e j3 h Z4 d e( j5 f d     YZ6 e6   Z7 d e8 f d     YZ9 d e% f d     YZ: d e: f d     YZ; e j< e#  d  e j= f d!     Y Z> d" e> f d#     YZ? d S($   u   
This module defines the `Quantity` object, which represents a number with some
associated units. `Quantity` objects support operations like ordinary numbers,
but will deal with unit conversions internally.
i    (   t   absolute_importt   unicode_literalst   divisiont   print_functionN(   t   Fractioni   (   t   six(   t   zipi   (   t   Unitt   dimensionless_unscaledt   get_current_unit_registryt   UnitBaset
   UnitsErrort   UnitTypeError(   t   Latex(   t   NUMPY_LT_1_13t   NUMPY_LT_1_14(   t   override__dir__(   t   matmul(   t
   isiterablet   InheritDocstrings(   t   ParentDtypeInfo(   t   config(   t   converters_and_unitt   can_have_arbitrary_unitt   check_outputu   Quantityu   SpecificTypeQuantityu   QuantityInfoBaseu   QuantityInfou
   Quantity.*u   (Unit not initialised)t   Confc           B` s    e  Z d  Z e j d d  Z RS(   u/   
    Configuration parameters for Quantity
    id   u&  The maximum size an array Quantity can be before its LaTeX representation for IPython gets "summarized" (meaning only the first and last few elements are shown with "..." between). Setting this to a negative number means that the value will instead be whatever numpy gets from get_printoptions.(   t   __name__t
   __module__t   __doc__t   _configt
   ConfigItemt   latex_array_threshold(    (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR   .   s   	t   QuantityIteratorc           B` sA   e  Z d  Z d   Z d   Z d   Z d   Z d   Z e Z RS(   u  
    Flat iterator object to iterate over Quantities

    A `QuantityIterator` iterator is returned by ``q.flat`` for any Quantity
    ``q``.  It allows iterating over the array as if it were a 1-D array,
    either in a for-loop or by calling its `next` method.

    Iteration is done in C-contiguous style, with the last index varying the
    fastest. The iterator can also be indexed using basic slicing or
    advanced indexing.

    See Also
    --------
    Quantity.flatten : Returns a flattened copy of an array.

    Notes
    -----
    `QuantityIterator` is inspired by `~numpy.ma.core.MaskedIterator`.  It
    is not exported by the `~astropy.units` module.  Instead of
    instantiating a `QuantityIterator` directly, use `Quantity.flat`.
    c         C` s%   | |  _  | j t j  j |  _ d  S(   N(   t	   _quantityt   viewt   npt   ndarrayt   flatt	   _dataiter(   t   selft   q(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __init__T   s    	c         C` s   |  S(   N(    (   R'   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __iter__X   s    c         C` sB   |  j  j |  } t | t |  j   r. | S|  j j |  Sd  S(   N(   R&   t   __getitem__t
   isinstancet   typeR!   t	   _new_view(   R'   t   indxt   out(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR+   [   s    c         C` s   |  j  j |  |  j | <d  S(   N(   R!   t   _to_own_unitR&   (   R'   t   indext   value(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __setitem__d   s    c         C` s   t  |  j  } |  j j |  S(   u@   
        Return the next value, or raise StopIteration.
        (   t   nextR&   R!   R.   (   R'   R0   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __next__g   s    (	   R   R   R   R)   R*   R+   R4   R6   R5   (    (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR    =   s   						t   QuantityInfoBasec           B` s8   e  Z d  d h Z e Z e d    Z e d    Z RS(   u   dtypeu   unitc         C` s   d j  |   S(   Nu
   {0.value:}(   t   format(   t   val(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   default_formaty   s    c         c` s   d   Vd   Vd   Vd S(   uc  Iterate through possible string-derived format functions.

        A string can either be a format specifier for the format built-in,
        a new-style format string, or an old-style format string.

        This method is overridden in order to suppress printing the unit
        in each row since it is already at the top in the column header.
        c         S` s   t  | j |   S(   N(   R8   R3   (   t   format_R9   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   <lambda>   s    c         S` s   |  j  | j  S(   N(   R8   R3   (   R;   R9   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR<      s    c         S` s   |  | j  S(   N(   R3   (   R;   R9   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR<      s    N(    (   R;   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt    possible_string_format_functions}   s    
(   R   R   t   attrs_from_parentt   Truet   _supports_indexingt   staticmethodR:   R=   (    (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR7   r   s   t   QuantityInfoc           B` s,   e  Z d  Z d Z d   Z d d d  Z RS(   u   
    Container for meta information like name, description, format.  This is
    required when the object is used as a mixin column within a table, but can
    be used as a general way to store meta information.
    u   valueu   unitc         C` s   | j  d  } |  j | |  S(   Nu   value(   t   popt   _parent_cls(   R'   t   mapR3   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   _construct_from_dict   s    u   warnc         ` s   |  j    | | d
  } | f | j d  } | j d  } t j d | d |      f d   |  j D } t | d	 <|  j |  }	 x- | j   D] \ }
 } t |	 j	 |
 |  q W|	 S(   u  
        Return a new Quantity instance which is consistent with the
        input ``cols`` and has ``length`` rows.

        This is intended for creating an empty column object whose elements can
        be set in-place for table operations like join or vstack.

        Parameters
        ----------
        cols : list
            List of input columns
        length : int
            Length of the output column object
        metadata_conflicts : str ('warn'|'error'|'silent')
            How to handle metadata conflicts
        name : str
            Output column name

        Returns
        -------
        col : Quantity (or subclass)
            Empty instance of this class consistent with ``cols``

        u   metau   formatu   descriptionu   shapeu   dtypet   shapet   dtypec         ` s8   i  |  ]. } | d  k r  n t    d |  |  q S(   u   valuei(   t   getattr(   t   .0t   key(   t   colst   data(    s5   lib/python2.7/site-packages/astropy/units/quantity.pys
   <dictcomp>   s   	u   copy(   u   metau   formatu   description(
   t   merge_cols_attributesRC   R#   t   zerost   _represent_as_dict_attrst   FalseRF   t   itemst   setattrt   info(   R'   RL   t   lengtht   metadata_conflictst   namet   attrsRG   RH   RE   R0   t   attrR3   (    (   RL   RM   s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   new_like   s    	
(   u   valueu   unitN(   R   R   R   RP   RF   t   NoneRZ   (    (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRB      s   	t   Quantityc           B` s  e  Z d  Z g  Z e Z dl Z d Z dl dl e	 dl e
 d d  Z d   Z dl d  Z dl d  Z d   Z d   Z d	   Z dl dl d
  Z d   Z d   Z d   Z d   Z e   Z g  d  Z g  d  Z dl g  d  Z e e d d Z e d    Z e d    Z e d    Z  e d    Z! e d    Z" e
 Z# e$ d    Z% d   Z& d   Z' d   Z( d   Z) d   Z* d   Z+ d    Z, d!   Z- d"   Z. d#   Z/ d$   Z0 d%   Z1 e2 e3 d&  sd'   Z4 n  d(   Z5 e
 d)  Z6 d*   Z7 e8 rd+   Z9 n	 d,   Z9 d-   Z: d.   Z; d/   Z< d0   Z= e> j? rId1   Z@ n  d2   ZA e> j? sdeA ZB n  d3   ZC d4   ZD d5   ZE d6   ZF e> j? rd7   ZG n  e d8    ZH d9   ZI d:   ZJ d;   ZK d<   ZL g  d=  ZM e
 g  d>  ZN d?   ZO d@   ZP e	 dA  ZQ dB   ZR dC dD  ZS dE dF dG  ZT dH   ZU dI   ZV dJ   ZW e dK    ZX eX jY dL    ZX dM dN  ZZ dl dM dO  Z[ dP dQ dl dR  Z\ dS   Z] dl dl dT  Z^ dl dl dU  Z_ dV   Z` dl dW  Za d d dX dl dl dY  Zb dl dl dl d dZ  Zc dl dl dl d d[  Zd dl dl dl d\  Ze dl dl d]  Zf d dl d^  Zg dl dl e
 d_  Zh dl dl e
 d`  Zi dl dl dl e
 da  Zj dl dl dl e
 db  Zk dl dc  Zl dl dl dl dd  Zm dl dl dl de  Zn dl dl df  Zo dl dl dg  Zp dX dP dh  Zq dl dl di  Zr dl dl e
 dj  Zs dl dk  Zt RS(m   u
  A `~astropy.units.Quantity` represents a number with some associated unit.

    Parameters
    ----------
    value : number, `~numpy.ndarray`, `Quantity` object (sequence), str
        The numerical value of this quantity in the units given by unit.  If a
        `Quantity` or sequence of them (or any other valid object with a
        ``unit`` attribute), creates a new `Quantity` object, converting to
        `unit` units as needed.  If a string, it is converted to a number or
        `Quantity`, depending on whether a unit is present.

    unit : `~astropy.units.UnitBase` instance, str
        An object that represents the unit associated with the input value.
        Must be an `~astropy.units.UnitBase` object or a string parseable by
        the :mod:`~astropy.units` package.

    dtype : ~numpy.dtype, optional
        The dtype of the resulting Numpy array or scalar that will
        hold the value.  If not provided, it is determined from the input,
        except that any input that cannot represent float (integer and bool)
        is converted to float.

    copy : bool, optional
        If `True` (default), then the value is copied.  Otherwise, a copy will
        only be made if ``__array__`` returns a copy, if value is a nested
        sequence, or if a copy is needed to satisfy an explicitly given
        ``dtype``.  (The `False` option is intended mostly for internal use,
        to speed up initialization where a copy is known to have been made.
        Use with care.)

    order : {'C', 'F', 'A'}, optional
        Specify the order of the array.  As in `~numpy.array`.  This parameter
        is ignored if the input is a `Quantity` and ``copy=False``.

    subok : bool, optional
        If `False` (default), the returned array will be forced to be a
        `Quantity`.  Otherwise, `Quantity` subclasses will be passed through,
        or a subclass appropriate for the unit will be used (such as
        `~astropy.units.Dex` for ``u.dex(u.AA)``).

    ndmin : int, optional
        Specifies the minimum number of dimensions that the resulting array
        should have.  Ones will be pre-pended to the shape as needed to meet
        this requirement.  This parameter is ignored if the input is a
        `Quantity` and ``copy=False``.

    Raises
    ------
    TypeError
        If the value provided is not a Python numeric type.
    TypeError
        If the unit provided is not either a :class:`~astropy.units.Unit`
        object or a parseable string unit.

    Notes
    -----
    Quantities can also be created by multiplying a number or array with a
    :class:`~astropy.units.Unit`. See http://docs.astropy.org/en/latest/units/

    i'  i    c         C` sV  | d  k	 rN t |  } | rN t | d |   } t | |   rK | }  qK qN n  t | t  r2| d  k	 r | | j k	 r | j |  } t } n  t	 |  |  k	 r | o t | |   r | j
 |   } n  | d  k r| s | St j t j | j  st j } qn  t j | d | d | d | d t d | Sd  }	 t | t j  st | t j  rd }
 t j |
 |  } d  } y t | j    } Wn, t k
 rt d j | |  j    n X| j | j   j   } | rt |  }	 | d  k r|	 } qqqt |  rt  |  d	 k rt! d
   | D  r| d  k rU| d	 j } n  g  | D] } | j" |  ^ q\} | }	 qn  |	 d  k r<t | d d   }	 |	 d  k r| d  k r|  j# } n  | }	 q<y t |	  }	 Wn. t k
 r} t d j | j |    n X| d  k r$|	 } q<| |	 k	 r<t } q<n  t j | d | d | d | d t d | } | j j$ d k r| j j$ d k ot | j% | j& d	 k rd n d	  t' j(  rt d   n  | d  k rt j t j | j  s| j j$ d k r| j) t j  } n  | j
 |   } | j* |	  | |	 k rE| S| j |  Sd  S(   Nu   _quantity_classRH   t   copyt   ordert   subokt   ndminuk   \s*[+-]?((\d+\.?\d*)|(\.\d+)|([nN][aA][nN])|([iI][nN][fF]([iI][nN][iI][tT][yY]){0,1}))([eE][+-]?\d+)?[.+-]?u=   Cannot parse "{0}" as a {1}. It does not start with a number.i    c         s` s   |  ] } t  | t  Vq d  S(   N(   R,   R\   (   RJ   t   v(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pys	   <genexpr>W  s    u   unitur   The unit attribute {0!r} of the input could not be parsed as an astropy Unit, raising the following exception:
{1}u   OSUu   Ou7   The value must be a valid Python or Numpy numeric type.(    (+   R[   R   RI   t
   issubclassR,   R\   t   unitt   toRQ   R-   R"   R#   t   can_castt   float32RH   t   floatt   arrayR?   R$   R   t   string_typest   ret   matcht   groupt	   Exceptiont	   TypeErrorR8   R   t   stringt   endt   stripR   t   lent   allt   to_valuet   _default_unitt   kindt   itemt   ndimt   numberst   Numbert   astypet	   _set_unit(   t   clsR3   Rc   RH   R]   R^   R_   R`   t   qclst
   value_unitt   patternRa   t   unit_stringR(   t   exc(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __new__  s    		"			$%c         C` sk   |  j  d  k r@ t | d d   } | d  k	 r@ |  j |  q@ n  d t | d d  k rg | j |  _ n  d  S(   Nu   _unitu   infou   __dict__(    (   t   _unitR[   RI   R|   RT   (   R'   t   objRc   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __array_finalize__  s    c         ` s  | d  k r | S| d } | d | j  } t | d |  \ } } | j d k rc | | d } n    | k r t | | | t d   | D  d |   } n   j | |  } t |  r  | k rQt   f d   | D  rQ| d | j d k  rt d j	 | j
    n    j d	 r?  j   }   | _ qQ  j   | _ n  | | _ | t k rt j     _   j j   t j d
 d d d t qn  | | _ | S(   Ni    i   u   __call__i   c         s` s=   |  ]3 } | r. | d   d  d k r. t  j n t  j Vq d S(   g      ?g        N(   R#   t   float16t   int8(   RJ   t	   converter(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pys	   <genexpr>  s   t   functionc         3` s   |  ] }   | k Vq d  S(   N(    (   RJ   t   arg(   R'   (    s5   lib/python2.7/site-packages/astropy/units/quantity.pys	   <genexpr>  s    uv   Cannot apply multi-output {0} function to quantities with in-place replacement of an input by any but the last output.u   C_CONTIGUOUSu   ignoret   messageu   invalid value encountered int   category(   R[   t   ninR   t   noutR   t   tupleR.   t   anyRn   R8   R   t   flagsR]   t   _resultt   _contiguoust   _converterst   _UFUNCS_FILTER_WARNINGSt   warningst   catch_warningst   _catch_warningst	   __enter__t   filterwarningst   RuntimeWarningt   _result_unit(   R'   R   t   contextR   t   argst
   converterst   result_unitt   result(    (   R'   s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __array_prepare__  sB    
		(			c         C` sl  | d  k r |  j |  St | d  r: | j } | ` n d  } t | d  r+| j } | ` t |  d  r |  j j   |  ` n  t | d  r | j } n% t | d  r | j | d
 <| ` n  | j	 t
 j  } | d } | d | j  } g  } xU t | |  D]D \ }	 }
 |
 r1| j |
 |	 j   q| j t |	 d |	   qWy t
 j |   } Wn t t f k
 rd  } n+ X| d  k pt
 j | | j  sd  } n  | d	 d k r| j |  n | d  | g 7} | |   } | d  k r+| j d k r| | d	 } n  |  j | |  } q+n  | d  k rG| j	 t
 j  S| |  k rd| j |  | S| Sd  S(   Nu   _result_unitu   _convertersu   _catch_warningsu   _resultu   _contiguousi    i   u   valuei   (    (   R[   R.   t   hasattrR   R   R   t   __exit__R   R   R"   R#   R$   R   R   t   appendR3   RI   t   result_typeRn   t
   ValueErrorRe   RH   R   R|   (   R'   R   R   R   R   t	   obj_arrayR   R   t   inputsR   R   t	   tmp_dtypeR0   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __array_wrap__  s\    					

	c         O` s
  t  | | |  \ } } | j d d  } | d k	 r | j d k rR | d } n  t | | | d | } | j d k r | f n | | d <n  t d   t | |  D  }	 t t |   j	 | | |	 |  }
 | d k s |
 d k s |
 t
 k r |
 S|  j |
 | |  S(   u  Wrap numpy ufuncs, taking care of units.

        Parameters
        ----------
        function : callable
            ufunc to wrap.
        method : str
            Ufunc method: ``__call__``, ``at``, ``reduce``, etc.
        inputs : tuple
            Input arrays.
        kwargs : keyword arguments
            As passed on, with ``out`` containing possible quantity output.

        Returns
        -------
        result : `~astropy.units.Quantity`
            Results of the ufunc, with the unit set properly.
        u   outi   i    R   c         s` s<   |  ]2 \ } } | r$ | | j   n t | d  |  Vq d S(   u   valueN(   R3   RI   (   RJ   t   input_R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pys	   <genexpr>{  s   N(   R   t   getR[   R   R   R   R   t   superR\   t   __array_ufunc__t   NotImplementedt   _result_as_quantity(   R'   R   t   methodR   t   kwargsR   Rc   R0   t	   out_arrayt   arraysR   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR   V  s    %	$c         ` s   t  | t  rT | d k r. d t |  } n  t   f d   t | | |  D  S| d k r | d k rp | S  j | |  S| j |  | S(   u  Turn result into a quantity with the given unit.

        If no output is given, it will take a view of the array as a quantity,
        and set the unit.  If output is given, those should be quantity views
        of the result arrays, and the function will just set the unit.

        Parameters
        ----------
        result : `~numpy.ndarray` or tuple of `~numpy.ndarray`
            Array(s) which need to be turned into quantity.
        unit : `~astropy.units.Unit` or None
            Unit for the quantities to be returned (or `None` if the result
            should not be a quantity).  Should be tuple if result is a tuple.
        out : `~astropy.units.Quantity` or None
            Possible output quantity. Should be `None` or a tuple if result
            is a tuple.

        Returns
        -------
        out : `~astropy.units.Quantity`
           With units set.
        c         3` s-   |  ]# \ } } }   j  | | |  Vq d  S(   N(   R   (   RJ   t   result_t   unit_t   out_(   R'   (    s5   lib/python2.7/site-packages/astropy/units/quantity.pys	   <genexpr>  s   N(   N(   R,   R   R[   Rr   R   R.   R|   (   R'   R   Rc   R0   (    (   R'   s5   lib/python2.7/site-packages/astropy/units/quantity.pyR     s     c         C` s
   t  t f S(   u  
        Overridden by subclasses to change what kind of view is
        created based on the output unit of an operation.

        Parameters
        ----------
        unit : UnitBase
            The unit for which the appropriate class should be returned

        Returns
        -------
        tuple :
            - `Quantity` subclass
            - bool: True is subclasses of the given class are ok
        (   R\   R?   (   R'   Rc   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __quantity_subclass__  s    c         C` s   | d k r! |  j } |  j } nW t |  } t | d t  } t |  |  rx |  j |  \ } } | rx |  j } qx n  | d k r |  j t	 j
  } n t	 j | d t } | j |  } | j |  | j |   | S(   u  
        Create a Quantity view of some array-like input, and set the unit

        By default, return a view of ``obj`` of the same class as ``self`` and
        with the same unit.  Subclasses can override the type of class for a
        given unit using ``__quantity_subclass__``, and can ensure properties
        other than the unit are copied using ``__array_finalize__``.

        If the given unit defines a ``_quantity_class`` of which ``self``
        is not an instance, a view using this class is taken.

        Parameters
        ----------
        obj : ndarray or scalar, optional
            The array to create a view of.  If obj is a numpy or python scalar,
            it will be converted to an array scalar.  By default, ``self``
            is converted.

        unit : `UnitBase`, or anything convertible to a :class:`~astropy.units.Unit`, optional
            The unit of the resulting object.  It is used to select a
            subclass, and explicitly assigned to the view if given.
            If not given, the subclass and unit will be that of ``self``.

        Returns
        -------
        view : Quantity subclass
        u   _quantity_classR]   N(   R[   Rc   t	   __class__R   RI   R\   R,   R   R"   R#   R$   Rh   RQ   R|   R   (   R'   R   Rc   t   quantity_subclassR_   R"   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR.     s     	c         C` ss   t  | t  sf t t |  d d } t  | t  sf t d j t |   j t t |     qf n  | |  _ d S(   u  Set the unit.

        This is used anywhere the unit is set or modified, i.e., in the
        initilizer, in ``__imul__`` and ``__itruediv__`` for in-place
        multiplication and division by another unit, as well as in
        ``__array_finalize__`` for wrapping up views.  For Quantity, it just
        sets the unit, but subclasses can override it to check that, e.g.,
        a unit is consistent.
        t   parse_strictu   silentu3   {0} instances require {1} units, not {2} instances.N(	   R,   R
   R   t   strR   R8   R-   R   R   (   R'   Rc   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR|     s    
'c         C` s
   |  j    S(   N(   R]   (   R'   t   memo(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __deepcopy__  s    c         C` s<   t  t t |   j    } | d |  j f | d <t |  S(   Ni   (   t   listR   R\   t
   __reduce__t   __dict__R   (   R'   t   object_state(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR     s    c         C` s6   | \ } } t  t |   j |  |  j j |  d  S(   N(   R   R\   t   __setstate__R   t   update(   R'   t   statet   nd_statet	   own_state(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR   !  s    c         C` s=   | g  k r |  j  } n  |  j j | |  j t j  d | S(   u"   Helper method for to and to_value.t   equivalencies(   t   _equivalenciesRc   Rd   R"   R#   R$   (   R'   Rc   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt	   _to_value+  s    c         C` s(   t  |  } |  j |  j | |  |  S(   u  
        Return a new `~astropy.units.Quantity` object with the specified unit.

        Parameters
        ----------
        unit : `~astropy.units.UnitBase` instance, str
            An object that represents the unit to convert to. Must be
            an `~astropy.units.UnitBase` object or a string parseable
            by the `~astropy.units` package.

        equivalencies : list of equivalence pairs, optional
            A list of equivalence pairs to try if the units are not
            directly convertible.  See :ref:`unit_equivalencies`.
            If not provided or ``[]``, class default equivalencies will be used
            (none for `~astropy.units.Quantity`, but may be set for subclasses)
            If `None`, no equivalencies will be applied at all, not even any
            set globally or within a context.

        See also
        --------
        to_value : get the numerical value in a given unit.
        (   R   R.   R   (   R'   Rc   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRd   2  s    c         C` sh   |  j  t j  } | d k	 rQ t |  } | |  j k rQ |  j | |  } qQ n  |  j r^ | S| j   S(   u/  
        The numerical value, possibly in a different unit.

        Parameters
        ----------
        unit : `~astropy.units.UnitBase` instance or str, optional
            The unit in which the value should be given. If not given or `None`,
            use the current unit.

        equivalencies : list of equivalence pairs, optional
            A list of equivalence pairs to try if the units are not directly
            convertible (see :ref:`unit_equivalencies`). If not provided or
            ``[]``, class default equivalencies will be used (none for
            `~astropy.units.Quantity`, but may be set for subclasses).
            If `None`, no equivalencies will be applied at all, not even any
            set globally or within a context.

        Returns
        -------
        value : `~numpy.ndarray` or scalar
            The value in the units specified. For arrays, this will be a view
            of the data if no unit conversion was necessary.

        See also
        --------
        to : Get a new instance in a different unit.
        N(	   R"   R#   R$   R[   R   Rc   R   RG   Rw   (   R'   Rc   R   R3   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRt   N  s    t   docu}   The numerical value of this instance.

    See also
    --------
    to_value : Get the numerical value in a given unit.
    c         C` s   |  j  S(   ud   
        A `~astropy.units.UnitBase` object representing the unit of this
        quantity.
        (   R   (   R'   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRc   y  s    c         C` s   |  j  S(   uj   
        A list of equivalencies that will be applied by default during
        unit conversions.
        (   R   (   R'   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR     s    c         C` s-   |  j  j } |  j |  j | j | | j  S(   u   
        Returns a copy of the current `Quantity` instance with SI units. The
        value of the resulting object will be scaled.
        (   Rc   t   siR.   R3   t   scale(   R'   t   si_unit(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR     s    c         C` s-   |  j  j } |  j |  j | j | | j  S(   u   
        Returns a copy of the current `Quantity` instance with CGS units. The
        value of the resulting object will be scaled.
        (   Rc   t   cgsR.   R3   R   (   R'   t   cgs_unit(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR     s    c         C` s   |  j  S(   u  
        True if the `value` of this quantity is a scalar, or False if it
        is an array-like object.

        .. note::
            This is subtly different from `numpy.isscalar` in that
            `numpy.isscalar` returns False for a zero-dimensional array
            (e.g. ``np.array(1)``), while this is True for quantities,
            since quantities cannot represent true numpy scalars.
        (   RG   (   R'   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   isscalar  s    c         C` sY   |  j  s g  St   } t j |  j  } x* |  j j |  D] } | j | j  q; W| S(   u   
        Quantities are able to directly convert to other units that
        have the same physical type.  This function is implemented in
        order to make autocompletion still work correctly in IPython.
        (	   t    _include_easy_conversion_memberst   setR   t   _normalize_equivalenciesR   Rc   t"   _get_units_with_same_physical_typeR   t   names(   R'   t   extra_membersR   t
   equivalent(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __dir__  s    		c         ` sz    j  s* t d j  j j      n     f d   } |   } | d k rr t d j  j j      n | Sd S(   ur   
        Quantities are able to directly convert to other units that
        have the same physical type.
        u    '{0}' object has no '{1}' memberc          ` sj   t    j }  |  j   d   } | d  k r. d  Sy#  j j |  j d  j SWn t k
 re d  SXd  S(   NR   (	   R	   t   registryR   R[   Rc   Rd   R3   R   R   (   R   t   to_unit(   RY   R'   (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   get_virtual_unit_attribute  s    	u#   {0} instance has no attribute '{1}'N(   R   t   AttributeErrorR8   R   R   R[   (   R'   RY   R   R3   (    (   RY   R'   s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __getattr__  s    			c         C` si   y? y t  t |   j |  SWn t k
 r= t j |  |  SXWn# t k
 rS t St k
 rd t	 SXd  S(   N(
   R   R\   t   __eq__t   DeprecationWarningR#   t   equalR   RQ   Rn   R   (   R'   t   other(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR     s    c         C` si   y? y t  t |   j |  SWn t k
 r= t j |  |  SXWn# t k
 rS t St k
 rd t	 SXd  S(   N(
   R   R\   t   __ne__R   R#   t	   not_equalR   R?   Rn   R   (   R'   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR     s    c         C` sg   t  | t t j f  rQ y! |  j |  j   | |  j  SWqQ t k
 rM t SXn  t	 t
 |   j |  S(   u=    Multiplication between `Quantity` objects and other objects.(   R,   R
   R   Ri   R.   R]   Rc   R   R   R   R\   t   __mul__(   R'   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR     s    !c         C` sF   t  | t t j f  r0 |  j | |  j  |  St t |   j |  S(   u>   In-place multiplication between `Quantity` objects and others.(	   R,   R
   R   Ri   R|   Rc   R   R\   t   __imul__(   R'   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR   
  s    c         C` s   |  j  |  S(   uT    Right Multiplication between `Quantity` objects and other
        objects.
        (   R   (   R'   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __rmul__  s    c         C` sg   t  | t t j f  rQ y! |  j |  j   |  j |  SWqQ t k
 rM t SXn  t	 t
 |   j |  S(   u7    Division between `Quantity` objects and other objects.(   R,   R
   R   Ri   R.   R]   Rc   R   R   R   R\   t   __truediv__(   R'   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR     s    !c         C` sF   t  | t t j f  r0 |  j |  j |  |  St t |   j |  S(   u>   Inplace division between `Quantity` objects and other objects.(	   R,   R
   R   Ri   R|   Rc   R   R\   t   __itruediv__(   R'   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR   %  s    c         C` sL   t  | t t j f  r6 |  j d |  j | |  j  St t |   j	 |  S(   u=    Right Division between `Quantity` objects and other objects.g      ?(
   R,   R
   R   Ri   R.   R3   Rc   R   R\   t   __rtruediv__(   R'   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR   .  s    c         C` s   |  j  |  S(   u&    Division between `Quantity` objects. (   R   (   R'   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __div__6  s    c         C` s   |  j  |  S(   u&    Division between `Quantity` objects. (   R   (   R'   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __idiv__:  s    c         C` s   |  j  |  S(   u&    Division between `Quantity` objects. (   R   (   R'   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __rdiv__>  s    u   divmodc         C` sH   |  j  |  } t |  j |  } |  j | d t  |  j | d  f S(   Ni    i   (   R1   t   divmodR3   R.   R   (   R'   R   t   other_valuet   result_tuple(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt
   __divmod__D  s    c         C` sI   t  | t  r3 |  j |  j t |  |  j |  St t |   j |  S(   N(	   R,   R   R.   R3   Rg   Rc   R   R\   t   __pow__(   R'   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR   K  s    c         C` sG   |  j  t | d t  } t |  j t | d |   } |  j | |  S(   Nu   unitu   value(   Rc   RI   R   R   R3   R.   (   R'   R   t   reverseR   t   result_array(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt
   __matmul__T  s    c         C` sG   |  j  t | d t  } t t | d |  |  j  } |  j | |  S(   Nu   unitu   value(   Rc   RI   R   R   R3   R.   (   R'   R   R   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __rmatmul__Y  s    c         C` s
   |  j    S(   u   Plus the quantity.(   R]   (   R'   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __pos__a  s    c         C` s   t  j |   S(   u   Plus the quantity.(   R#   t   positive(   R'   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR   j  s    c         C` s   t  |  j  t  |  j  AS(   N(   t   hashR3   Rc   (   R'   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __hash__o  s    c         ` s@     j  r* t d j d   j j    n    f d   } |   S(   Nu2   '{cls}' object with a scalar value is not iterableR}   c          3` s&   x   j  D] }    j |   Vq
 Wd  S(   N(   R3   R.   (   R9   (   R'   (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   quantity_itery  s    (   R   Rn   R8   R   R   (   R'   R   (    (   R'   s5   lib/python2.7/site-packages/astropy/units/quantity.pyR*   r  s    		c         C` s   y t  t |   j |  } Wn> t k
 r\ |  j rV t d j d |  j j    q]   n Xt	 |  t	 |   k	 r |  j
 |  } n  | S(   Nu<   '{cls}' object with a scalar value does not support indexingR}   (   R   R\   R+   t
   IndexErrorR   Rn   R8   R   R   R-   R.   (   R'   RK   R0   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR+     s    		c         C` sa   |  j  r8 d |  j k r8 |  j j | | t |    n  |  j t j  j | |  j	 |   d  S(   Nu   info(
   R   R   RT   t   adjust_indicesRr   R"   R#   R$   R4   R1   (   R'   t   iR3   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR4     s    c         C` s   |  j  t | |  |  d  S(   N(   R4   t   slice(   R'   R   t   jR3   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __setslice__  s    c         C` s   t  S(   uw   Quantities should always be treated as non-False; there is too much
        potential for ambiguity otherwise.
        (   R?   (   R'   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __nonzero__  s    c         C` s;   |  j  r* t d j d |  j j    n t |  j  Sd  S(   Nu/   '{cls}' object with a scalar value has no len()R}   (   R   Rn   R8   R   R   Rr   R3   (   R'   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __len__  s    	c         C` sA   y t  |  j t   SWn# t t f k
 r< t d   n Xd  S(   NuG   only dimensionless scalar quantities can be converted to Python scalars(   Rg   Rt   R   R   Rn   (   R'   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt	   __float__  s    c         C` sA   y t  |  j t   SWn# t t f k
 r< t d   n Xd  S(   NuG   only dimensionless scalar quantities can be converted to Python scalars(   t   intRt   R   R   Rn   (   R'   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __int__  s    c         C` sJ   y& |  j  j   s t  |  j j   SWn t k
 rE t d   n Xd  S(   NuO   only integer dimensionless scalar quantities can be converted to a Python index(   Rc   t   is_unityt   AssertionErrorR3   t	   __index__Rm   Rn   (   R'   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR    s
    c         C` sA   y t  |  j t   SWn# t t f k
 r< t d   n Xd  S(   NuG   only dimensionless scalar quantities can be converted to Python scalars(   t   longRt   R   R   Rn   (   R'   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __long__  s    c         C` s>   |  j  d  k r t } n t |  j   } | r: d | } n  | S(   Nu    (   Rc   R[   t   _UNIT_NOT_INITIALISEDR   (   R'   t   unitstr(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   _unitstr  s    	c         C` s   d j  |  j |  j  S(   Nu   {0}{1:s}(   R8   R3   R  (   R'   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __str__  s    c         C` sc   d |  j  j d } t r  d n d } t j |  j t j  d | d | } d j | | |  j  S(   Nu   <u    u   ,u   , t	   separatort   prefixu   {0}{1}{2:s}>(	   R   R   R   R#   t   array2stringR"   R$   R8   R  (   R'   t	   prefixstrt   sept   arrstr(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   __repr__  s
    	c         ` sC  t  j   } d j | d      f d   } z i | d 6} t j d k ri t  j d t j d |  n  t r t  j |  j t  j	  d |  j
 j d	 k r | n t d
 t  j d d } n* t  j |  j t  j	  d
 t  j d d } | j d d  } Wd t  j |   X|  j d k	 r-|  j j   d d !n t } d j | |  S(   uV  
        Generate a latex representation of the quantity and its unit.

        The behavior of this function can be altered via the
        `numpy.set_printoptions` function and its various keywords.  The
        exception to this is the ``threshold`` keyword, which is controlled via
        the ``[units.quantity]`` configuration item ``latex_array_threshold``.
        This is treated separately because the numpy default of 1000 is too big
        for most browsers to handle.

        Returns
        -------
        lstr
            A LaTeX string with the contents of this Quantity
        u   .{}gu	   precisionc         ` s   t  j |  d   S(   Nt   format_spec(   R   t   format_exponential_notation(   R3   (   R  (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   float_formatter  s    u
   float_kindit	   thresholdt	   formattert   styleu   ft   max_line_widthR  u   ,~u   ...u   \dotsNi   u   ${0} \; {1}$(   R#   t   get_printoptionsR8   t   confR   t   set_printoptionsR   R  R"   R$   RH   Rv   t   reprt   inft   replaceRc   R[   t   _repr_latex_R  (   R'   t   popsR  R  t   latex_valuet
   latex_unit(    (   R  s5   lib/python2.7/site-packages/astropy/units/quantity.pyR&    s,    
%c         C` s[   y t  |  j |  } d } Wn  t k
 r> |  j } | } n Xt  d j  | |  j  |  S(   uF  
        Format quantities using the new-style python formatting codes
        as specifiers for the number.

        If the format specifier correctly applies itself to the value,
        then it is used to format only the value. If it cannot be
        applied to the value, then it is applied to the whole string.

        u   su   {0}{1:s}(   R8   R3   R   R  (   R'   R  R3   t   full_format_spec(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt
   __format__  s    

	
c         C` s   |  j  t d | S(   u  
        Generates a new `Quantity` with the units
        decomposed. Decomposed units have only irreducible units in
        them (see `astropy.units.UnitBase.decompose`).

        Parameters
        ----------
        bases : sequence of UnitBase, optional
            The bases to decompose into.  When not provided,
            decomposes down to any irreducible units.  When provided,
            the decomposed result will only contain the given units.
            This will raises a `~astropy.units.UnitsError` if it's not possible
            to do so.

        Returns
        -------
        newq : `~astropy.units.Quantity`
            A new object equal to this quantity with units decomposed.
        t   bases(   t
   _decomposeRQ   (   R'   R,  (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt	   decompose3  s    c         C` sr   |  j  j d |  } | rX t | d  rX |  j | j } | | j } |  j | |  S|  j |  j   |  Sd S(   u  
        Generates a new `Quantity` with the units decomposed. Decomposed
        units have only irreducible units in them (see
        `astropy.units.UnitBase.decompose`).

        Parameters
        ----------
        allowscaledunits : bool
            If True, the resulting `Quantity` may have a scale factor
            associated with it.  If False, any scaling in the unit will
            be subsumed into the value of the resulting `Quantity`

        bases : sequence of UnitBase, optional
            The bases to decompose into.  When not provided,
            decomposes down to any irreducible units.  When provided,
            the decomposed result will only contain the given units.
            This will raises a `~astropy.units.UnitsError` if it's not possible
            to do so.

        Returns
        -------
        newq : `~astropy.units.Quantity`
            A new object equal to this quantity with units decomposed.

        R,  u   scaleN(   Rc   R.  R   R3   R   R.   R]   (   R'   t   allowscaledunitsR,  t   new_unitt	   new_value(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR-  I  s    c         G` s   |  j  t t |   j |    S(   N(   R.   R   R\   Rw   (   R'   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRw   s  s    c         C` s   t  d   d  S(   NuI   cannot make a list of Quantities.  Get list of values with q.value.list()(   t   NotImplementedError(   R'   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   tolistv  s    c         C` s!  y | j  |  j  } Wnn t k
 r y t |  j  |  j  } Wq t k
 r } t | d  ry t |  ry | } q |  q Xn X| rt | d d   } |  j	 | k rt
 j | |  j	  } t
 j | d | d t } t
 j t
 j | | k t
 j |    st d   qqn  | S(   Nu   unitu   dtypeRH   R]   u>   cannot convert value type to array type without precision loss(   Rt   Rc   R   R\   R   R   R   RI   R[   RH   R#   Rh   RQ   Rs   t
   logical_ort   isnanRn   (   R'   R3   t   check_precisiont   _valueR   t   value_dtypet   self_dtype_arrayt   value_dtype_array(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR1   z  s*    		c         G` sV   t  |  d k r! t d   n  |  j t j  j | d  |  j | d  f   d  S(   Ni    u'   itemset must have at least one argumenti(   Rr   R   R"   R#   R$   t   itemsetR1   (   R'   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR;    s    u   Cc         C` s   t  d   d  S(   NuK   cannot write Quantities to string.  Write array with q.value.tostring(...).(   R2  (   R'   R^   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   tostring  s    u    u   %sc         C` s   t  d   d  S(   NuF   cannot write Quantities to file.  Write array with q.value.tofile(...)(   R2  (   R'   t   fidR  R8   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   tofile  s    c         C` s   t  d   d  S(   Nu@   cannot dump Quantities to file.  Write array with q.value.dump()(   R2  (   R'   t   file(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   dump  s    c         C` s   t  d   d  S(   NuC   cannot dump Quantities to string.  Write array with q.value.dumps()(   R2  (   R'   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   dumps  s    c         C` s&   |  j  t j  j |  j |   d  S(   N(   R"   R#   R$   t   fillR1   (   R'   R3   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRB    s    c         C` s
   t  |   S(   u(  A 1-D iterator over the Quantity array.

        This returns a ``QuantityIterator`` instance, which behaves the same
        as the `~numpy.flatiter` instance returned by `~numpy.ndarray.flat`,
        and is similar to, but not a subclass of, Python's built-in iterator
        object.
        (   R    (   R'   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR%     s    	c         C` s   |  j    } | | (d  S(   N(   t   ravel(   R'   R3   t   y(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR%     s    u   raisec         C` s,   |  j  t j  j | |  j |  |  d  S(   N(   R"   R#   R$   t   putR1   (   R'   t   indicest   valuest   mode(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRE    s    c         C` s   t  d   d  S(   NuM   cannot choose based on quantity.  Choose using array with q.value.choose(...)(   R2  (   R'   t   choicesR0   RH  (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   choose  s    iu	   quicksortc         C` s(   |  j  t j  j d | d | d |  S(   Nt   axisRv   R^   (   R"   R#   R$   t   argsort(   R'   RK  Rv   R^   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRL    s    c         O` s.   t  j t  j |   |  j | d t | |  S(   NR6  (   R#   t   searchsortedRh   R1   RQ   (   R'   Ra   R   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRM    s    c         C` s   |  j  t j  j | d | S(   NR0   (   R"   R#   R$   t   argmax(   R'   RK  R0   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRN    s    c         C` s   |  j  t j  j | d | S(   NR0   (   R"   R#   R$   t   argmin(   R'   RK  R0   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRO    s    c         O` s   | j  d |  j  } | j  d d  } |  j f t d   | D  } | d k	 r t d   | D  } t | | | d | | d <n  | | |   } |  j | | |  S(   u  Wrap a numpy function that processes self, returning a Quantity.

        Parameters
        ----------
        function : callable
            Numpy function to wrap.
        args : positional arguments
            Any positional arguments to the function beyond the first argument
            (which will be set to ``self``).
        kwargs : keyword arguments
            Keyword arguments to the function.

        If present, the following arguments are treated specially:

        unit : `~astropy.units.Unit`
            Unit of the output result.  If not given, the unit of ``self``.
        out : `~astropy.units.Quantity`
            A Quantity instance in which to store the output.

        Notes
        -----
        Output should always be assigned via a keyword argument, otherwise
        no proper account of the unit is taken.

        Returns
        -------
        out : `~astropy.units.Quantity`
            Result of the function call, with the unit set properly.
        u   unitu   outc         s` s-   |  ]# } t  | t  r! | j n | Vq d  S(   N(   R,   R\   R3   (   RJ   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pys	   <genexpr>  s   c         s` s'   |  ] } t  | t j  r | Vq d  S(   N(   R,   R#   R$   (   RJ   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pys	   <genexpr>  s    R   N(   RC   Rc   R[   R3   R   R   R   (   R'   R   R   R   Rc   R0   R   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   _wrap_function  s    c         C` s.   |  j  t j |  j |  |  j |  d | S(   NR0   (   RP  R#   t   clipR1   (   R'   t   a_mint   a_maxR0   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRQ    s    i   c         C` s"   |  j  t j | | | | d | S(   NR0   (   RP  R#   t   trace(   R'   t   offsett   axis1t   axis2RH   R0   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRT    s    c         C` s/   |  j  t j | | d | d | d |  j d S(   NR0   t   ddofRc   i   (   RP  R#   t   varRc   (   R'   RK  RH   R0   RX  (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRY    s    c         C` s"   |  j  t j | | d | d | S(   NR0   RX  (   RP  R#   t   std(   R'   RK  RH   R0   RX  (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRZ    s    c         C` s   |  j  t j | | d | S(   NR0   (   RP  R#   t   mean(   R'   RK  RH   R0   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR[  !  s    c         C` s   |  j  t j | d | S(   NR0   (   RP  R#   t   ptp(   R'   RK  R0   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR\  $  s    c         C` s   |  j  t j | d | S(   NR0   (   RP  R#   t   round(   R'   t   decimalsR0   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR]  '  s    c         C` s   |  j  t j | d | d | S(   NR0   t   keepdims(   RP  R#   t   max(   R'   RK  R0   R_  (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR`  *  s    c         C` s   |  j  t j | d | d | S(   NR0   R_  (   RP  R#   t   min(   R'   RK  R0   R_  (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRa  -  s    c         C` s"   |  j  t j | | d | d | S(   NR0   R_  (   RP  R#   t   sum(   R'   RK  RH   R0   R_  (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRb  0  s    c         C` s@   |  j  j   s t d   n  |  j t j | | d | d | S(   Nu>   cannot use prod on scaled or non-dimensionless Quantity arraysR0   R_  (   Rc   R	  R   RP  R#   t   prod(   R'   RK  RH   R0   R_  (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRc  4  s    c         C` s8   |  j  t | d t  } |  j t j | d | d | S(   Nu   unitR0   Rc   (   Rc   RI   R   RP  R#   t   dot(   R'   t   bR0   R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRd  ;  s    c         C` s   |  j  t j | | d | S(   NR0   (   RP  R#   t   cumsum(   R'   RK  RH   R0   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRf  ?  s    c         C` s:   |  j  j   s t d   n  |  j t j | | d | S(   NuA   cannot use cumprod on scaled or non-dimensionless Quantity arraysR0   (   Rc   R	  R   RP  R#   t   cumprod(   R'   RK  RH   R0   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRg  B  s    c         C` s   t  d   d  S(   NuO   cannot evaluate truth value of quantities. Evaluate array with q.value.all(...)(   R2  (   R'   RK  R0   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRs   J  s    c         C` s   t  d   d  S(   NuO   cannot evaluate truth value of quantities. Evaluate array with q.value.any(...)(   R2  (   R'   RK  R0   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR   N  s    c         C` s   |  j  t j | |  S(   N(   RP  R#   t   diff(   R'   t   nRK  (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRh  T  s    c         C` s   |  j  t j | |  S(   N(   RP  R#   t   ediff1d(   R'   t   to_endt   to_begin(    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRj  W  s    c         C` s   |  j  t j | d | d | S(   NR0   R_  (   RP  R#   t   nansum(   R'   RK  R0   R_  (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRm  Z  s    c         C` s1   t  j |  j | |  j |  |  } |  j |  S(   uB  
        Insert values along the given axis before the given indices and return
        a new `~astropy.units.Quantity` object.

        This is a thin wrapper around the `numpy.insert` function.

        Parameters
        ----------
        obj : int, slice or sequence of ints
            Object that defines the index or indices before which ``values`` is
            inserted.
        values : array-like
            Values to insert.  If the type of ``values`` is different
            from that of quantity, ``values`` is converted to the matching type.
            ``values`` should be shaped so that it can be broadcast appropriately
            The unit of ``values`` must be consistent with this quantity.
        axis : int, optional
            Axis along which to insert ``values``.  If ``axis`` is None then
            the quantity array is flattened before insertion.

        Returns
        -------
        out : `~astropy.units.Quantity`
            A copy of quantity with ``values`` inserted.  Note that the
            insertion does not occur in-place: a new quantity array is returned.

        Examples
        --------
        >>> import astropy.units as u
        >>> q = [1, 2] * u.m
        >>> q.insert(0, 50 * u.cm)
        <Quantity [ 0.5,  1.,  2.] m>

        >>> q = [[1, 2], [3, 4]] * u.m
        >>> q.insert(1, [10, 20] * u.m, axis=0)
        <Quantity [[  1.,  2.],
                   [ 10., 20.],
                   [  3.,  4.]] m>

        >>> q.insert(1, 10 * u.m, axis=1)
        <Quantity [[  1., 10.,  2.],
                   [  3., 10.,  4.]] m>

        (   R#   t   insertR3   R1   R.   (   R'   R   RG  RK  R   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRn  ^  s    -$N(u   R   R   R   R   R   Ru   R[   R   t   __array_priority__R?   RQ   R   R   R   R   R   R   R   R.   R|   R   R   R   RB   RT   R   Rd   Rt   t   propertyR3   Rc   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R#   R   R   R   R   R   R   R   R*   R+   R4   R   t   PY2R  R  t   __bool__R  R  R  R  R  R  R  R  R&  R+  R.  R-  Rw   R3  R1   R;  R<  R>  R@  RA  RB  R%   t   setterRE  RJ  RL  RM  RN  RO  RP  RQ  RT  RY  RZ  R[  R\  R]  R`  Ra  Rb  Rc  Rd  Rf  Rg  Rs   R   Rh  Rj  Rm  Rn  (    (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR\      s   =w	bX	6	(	9					#				

	"																														
				8	*								,t   SpecificTypeQuantityc           B` s?   e  Z d  Z d Z d Z d Z e j d Z d   Z	 d   Z
 RS(   u  Superclass for Quantities of specific physical type.

    Subclasses of these work just like :class:`~astropy.units.Quantity`, except
    that they are for specific physical types (and may have methods that are
    only appropriate for that type).  Astropy examples are
    :class:`~astropy.coordinates.Angle` and
    :class:`~astropy.coordinates.Distance`

    At a minimum, subclasses should set ``_equivalent_unit`` to the unit
    associated with the physical type.
    i
   c         C` sF   | j  |  j  r" t |   t f St t |   j |  d t f Sd  S(   Ni    (   t   is_equivalentt   _equivalent_unitR-   R?   R   Rt  R   RQ   (   R'   Rc   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR     s    c         C` s   | d  k s | j |  j  re t d j t |   j |  j  | d  k rO d n d j |    n  t t |   j	 |  d  S(   Nu/   {0} instances require units equivalent to '{1}'u   , but no unit was given.u   , so cannot set it to '{0}'.(
   R[   Ru  Rv  R   R8   R-   R   R   Rt  R|   (   R'   Rc   (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyR|     s    N(   R   R   R   R[   Rv  R   Ru   R\   Ro  R   R|   (    (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyRt    s   	(@   R   t
   __future__R    R   R   R   Rj   Ry   t	   fractionsR   R   t   numpyR#   t   externR   t   extern.six.movesR   t   coreR   R   R	   R
   R   R   t   format.latexR   t   utils.compatR   R   t   utils.compat.miscR   t   utils.compat.numpyR   t
   utils.miscR   R   t   utils.data_infoR   t    R   R   t   quantity_helperR   R   R   t   __all__t   __doctest_skip__R  t   arcsint   arccost   arccosht   arctanhR   t   ConfigNamespaceR   R!  t   objectR    R7   RB   t   add_metaclassR$   R\   Rt  (    (    (    s5   lib/python2.7/site-packages/astropy/units/quantity.pyt   <module>   sF   ".		5?     