ó
šßÈ[c           @` sn  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 m	 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 d d d d d d d d d d d d g Z d „  Z d „  Z d „  Z d „  Z d d „ Z d  „  Z d! „  Z d" „  Z d# „  Z d$ „  Z d% „  Z  d& „  Z! d' „  Z" d( „  Z# d) „  Z$ d* „  Z% d S(+   u-   A set of standard astronomical equivalencies.i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsNi   (   t   sii   (   t   cgs(   t	   astrophys(   t   units(   t   dimensionless_unscaled(   t
   UnitsErroru   parallaxu   spectralu   spectral_densityu   doppler_radiou   doppler_opticalu   doppler_relativisticu   mass_energyu   brightness_temperatureu   dimensionless_anglesu   logarithmicu   temperatureu   temperature_energyu   molar_mass_amuu   pixel_scaleu   plate_scalec           C` s   t  j d f g S(   u  Allow angles to be equivalent to dimensionless (with 1 rad = 1 m/m = 1).

    It is special compared to other equivalency pairs in that it
    allows this independent of the power to which the angle is raised,
    and independent of whether it is part of a more complicated unit.
    N(   R   t   radiant   None(    (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   dimensionless_angles   s    c           C` s   t  t j t j d „  f g S(   uB   Allow logarithmic units to be converted to dimensionless fractionsc         S` s   d |  S(   Ng      $@(    (   t   x(    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   <lambda>(   s    (   R   t   function_unitst   dext   npt   log10(    (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   logarithmic$   s    	c           C` s   t  j t j d „  f g S(   uq   
    Returns a list of equivalence pairs that handle the conversion
    between parallax angle and distance.
    c         S` s   d |  S(   Ng      ð?(    (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   2   s    (   R   t	   arcsecondR   t   parsec(    (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   parallax,   s    c          ` sd  t  j j t  j j ‰  d t j ‰ t j d }  t j t j } t j t j	 d „  f t j t j
 ‡  f d †  f t j	 t j
 d „  d „  f t j |  d „  f t j	 |  d „  d	 „  f t j
 |  ‡  f d
 †  ‡  f d †  f |  | ‡ f d †  ‡ f d †  f t j | ‡ f d †  f t j	 | ‡ f d †  ‡ f d †  f t j
 | ‡  ‡ f d †  ‡  ‡ f d †  f g
 S(   u«  
    Returns a list of equivalence pairs that handle spectral
    wavelength, wave number, frequency, and energy equivalences.

    Allows conversions between wavelength units, wave number units,
    frequency units, and energy units as they relate to light.

    There are two types of wave number:

        * spectroscopic - :math:`1 / \lambda` (per meter)
        * angular - :math:`2 \pi / \lambda` (radian per meter)

    g       @iÿÿÿÿc         S` s   t  j j |  S(   N(   t   _sit   ct   value(   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   J   s    c         ` s   ˆ  |  S(   N(    (   R   (   t   hc(    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   K   s    c         S` s   t  j j |  S(   N(   R   t   hR   (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   L   s    c         S` s   |  t  j j S(   N(   R   R   R   (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   L   s    c         S` s   d |  S(   Ng      ð?(    (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   M   s    c         S` s   |  t  j j S(   N(   R   R   R   (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   N   s    c         S` s   t  j j |  S(   N(   R   R   R   (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   O   s    c         ` s   |  ˆ  S(   N(    (   R   (   R   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   P   s    c         ` s   ˆ  |  S(   N(    (   R   (   R   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   P   s    c         ` s   |  ˆ  S(   N(    (   R   (   t   two_pi(    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   Q   s    c         ` s   |  ˆ  S(   N(    (   R   (   R   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   Q   s    c         ` s   ˆ  |  S(   N(    (   R   (   R   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   R   s    c         ` s   ˆ  |  t  j j S(   N(   R   R   R   (   R   (   R   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   S   s    c         ` s   t  j j |  ˆ  S(   N(   R   R   R   (   R   (   R   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   T   s    c         ` s   |  ˆ ˆ  S(   N(    (   R   (   R   R   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   U   s    c         ` s   ˆ  |  ˆ S(   N(    (   R   (   R   R   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   U   s    (   R   R   R   R   R   t   piR   t   mR
   t   Hzt   J(   t
   inv_m_spect	   inv_m_ang(    (   R   R   s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   spectral6   s     	$!c   -      ` sá  d d l  m } t ˆ | ƒ rG | d k r: t d ƒ ‚ n  | ˆ ‰ n  t j j t j	 t j
 ƒ ‰  t j j j ‰ ˆ  ˆ ‰ t j t j t j d t j
 } t j t j t j d t j
 } t j t j d t j
 } | } t j t j d t j
 t j	 } t j t j d t j
 t j } t j t j
 t j }	 t j t j
 t j }
 t j t j
 } | } t j t j
 t j	 } t j t j
 t j } ‡  ‡ f d †  } ‡  ‡ f d †  } ‡ f d †  } ‡ f d †  } ‡ f d	 †  } ‡ f d
 †  } ‡ ‡ f d †  } ‡ ‡ f d †  } ‡ ‡ f d †  } ‡ ‡ f d †  } ‡  ‡ f d †  } ‡  ‡ f d †  } | } | } ‡  ‡ ‡ f d †  } ‡  ‡ ‡ f d †  } | } | }  | }! | }" | }# | }$ | }% | }& | }' | }( | }) | }* | }+ | }, | | | | f | | | | f | | | | f | | | | f | | | | f | | | | f | | | | f | | | | f |
 |	 | | f |	 | | |  f |
 | |! |" f | |
 |# |$ f | |	 |% |& f | | |' |( f | |	 |) |* f | |
 |+ |, f g S(   u	  
    Returns a list of equivalence pairs that handle spectral density
    with regard to wavelength and frequency.

    Parameters
    ----------
    wav : `~astropy.units.Quantity`
        `~astropy.units.Quantity` associated with values being converted
        (e.g., wavelength or frequency).

    Notes
    -----
    The ``factor`` argument is left for backward-compatibility with the syntax
    ``spectral_density(unit, factor)`` but users are encouraged to use
    ``spectral_density(factor * unit)`` instead.

    i   (   t   UnitBaseu7   If `wav` is specified as a unit, `factor` should be seti   c         ` s"   |  ˆ j  t j t ƒ  ƒ d ˆ  S(   Ni   (   t   to_valueR   t   AAR#   (   R   (   t   c_Apst   wav(    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt	   converter‡   s    c         ` s"   |  ˆ j  t j t ƒ  ƒ d ˆ  S(   Ni   (   R%   R   R&   R#   (   R   (   R'   R(   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt
   iconverterŠ   s    c         ` s   |  ˆ  j  t j t ƒ  ƒ S(   N(   R%   R   R   R#   (   R   (   R(   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   converter_f_nu_to_nu_f_nu   s    c         ` s   |  ˆ  j  t j t ƒ  ƒ S(   N(   R%   R   R   R#   (   R   (   R(   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   iconverter_f_nu_to_nu_f_nu   s    c         ` s   |  ˆ  j  t j t ƒ  ƒ S(   N(   R%   R   R&   R#   (   R   (   R(   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   converter_f_la_to_la_f_la“   s    c         ` s   |  ˆ  j  t j t ƒ  ƒ S(   N(   R%   R   R&   R#   (   R   (   R(   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   iconverter_f_la_to_la_f_la–   s    c         ` s   ˆ  |  ˆ j  t j t ƒ  ƒ S(   N(   R%   R   R&   R#   (   R   (   R   R(   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   converter_phot_f_la_to_f_la™   s    c         ` s   |  ˆ j  t j t ƒ  ƒ ˆ  S(   N(   R%   R   R&   R#   (   R   (   R   R(   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   iconverter_phot_f_la_to_f_laœ   s    c         ` s   ˆ  |  ˆ j  t j t ƒ  ƒ S(   N(   R%   R   R&   R#   (   R   (   t   h_cgsR(   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   converter_phot_f_la_to_f_nuŸ   s    c         ` s   |  ˆ j  t j t ƒ  ƒ ˆ  S(   N(   R%   R   R&   R#   (   R   (   R1   R(   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   iconverter_phot_f_la_to_f_nu¢   s    c         ` s"   |  ˆ j  t j t ƒ  ƒ d ˆ  S(   Ni   (   R%   R   R&   R#   (   R   (   R'   R(   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   converter_phot_f_la_phot_f_nu¥   s    c         ` s"   ˆ  |  ˆ j  t j t ƒ  ƒ d S(   Ni   (   R%   R   R&   R#   (   R   (   R'   R(   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   iconverter_phot_f_la_phot_f_nu¨   s    c         ` s&   |  ˆ ˆ  ˆ j  t j t ƒ  ƒ d S(   Ni   (   R%   R   R&   R#   (   R   (   R'   R   R(   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   converter_phot_f_nu_to_f_la®   s    c         ` s&   |  ˆ j  t j t ƒ  ƒ d ˆ ˆ  S(   Ni   (   R%   R   R&   R#   (   R   (   R'   R   R(   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   iconverter_phot_f_nu_to_f_la±   s    N(   t   coreR$   t
   isinstanceR   t
   ValueErrorR   R   R%   R   R&   t   sR   R   R   t   ergt   angstromt   cmR   R   t   photon(-   R(   t   factorR$   t   f_lat   f_nut   nu_f_nut   la_f_lat	   phot_f_lat	   phot_f_nut   L_nut   L_lat   nu_L_nut   la_L_lat	   phot_L_lat	   phot_L_nuR)   R*   R+   R,   R-   R.   R/   R0   R2   R3   R4   R5   t   converter_phot_f_nu_to_f_nut   iconverter_phot_f_nu_to_f_nuR6   R7   t   converter_L_nu_to_nu_L_nut   iconverter_L_nu_to_nu_L_nut   converter_L_la_to_la_L_lat   iconverter_L_la_to_la_L_lat   converter_phot_L_la_to_L_lat   iconverter_phot_L_la_to_L_lat   converter_phot_L_la_to_L_nut   iconverter_phot_L_la_to_L_nut   converter_phot_L_la_phot_L_nut   iconverter_phot_L_la_phot_L_nut   converter_phot_L_nu_to_L_nut   iconverter_phot_L_nu_to_L_nut   converter_phot_L_nu_to_L_lat   iconverter_phot_L_nu_to_L_la(    (   R'   R1   R   R(   s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   spectral_densityY   s†    
""""c         ` sà   t  ˆ ƒ t j j d ƒ ‰  ‡  ‡ f d †  } ‡  ‡ f d †  } ‡  ‡ f d †  } ‡  ‡ f d †  } ‡  ‡ f d †  } ‡  ‡ f d †  } t j t j t j | | f t j t j t j | | f t j	 t j t j | | f g S(   u«  
    Return the equivalency pairs for the radio convention for velocity.

    The radio convention for the relation between velocity and frequency is:

    :math:`V = c \frac{f_0 - f}{f_0}  ;  f(V) = f_0 ( 1 - V/c )`

    Parameters
    ----------
    rest : `~astropy.units.Quantity`
        Any quantity supported by the standard spectral equivalencies
        (wavelength, energy, frequency, wave number).

    References
    ----------
    `NRAO site defining the conventions <http://www.gb.nrao.edu/~fghigo/gbtdoc/doppler.html>`_

    Examples
    --------
    >>> import astropy.units as u
    >>> CO_restfreq = 115.27120*u.GHz  # rest frequency of 12 CO 1-0 in GHz
    >>> radio_CO_equiv = u.doppler_radio(CO_restfreq)
    >>> measured_freq = 115.2832*u.GHz
    >>> radio_velocity = measured_freq.to(u.km/u.s, equivalencies=radio_CO_equiv)
    >>> radio_velocity  # doctest: +FLOAT_CMP
    <Quantity -31.209092088877583 km / s>
    u   km/sc         ` s+   ˆ j  t j d t ƒ  ƒ} | |  | ˆ  S(   Nt   equivalencies(   R%   R   R   R#   (   R   t   restfreq(   t   ckmst   rest(    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   to_vel_freqü   s    c         ` s1   ˆ j  t j d t ƒ  ƒ} |  ˆ  } | d | S(   NR^   i   (   R%   R   R   R#   (   R   R_   t   voverc(   R`   Ra   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   from_vel_freq   s    
c         ` s(   ˆ j  t j t ƒ  ƒ } |  | |  ˆ  S(   N(   R%   R   R&   R#   (   R   t   restwav(   R`   Ra   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt
   to_vel_wav  s    c         ` s(   ˆ j  t j t ƒ  ƒ } | ˆ  ˆ  |  S(   N(   R%   R   R&   R#   (   R   Re   (   R`   Ra   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   from_vel_wav	  s    c         ` s+   ˆ j  t j d t ƒ  ƒ} | |  | ˆ  S(   NR^   (   R%   R   t   eVR#   (   R   t   resten(   R`   Ra   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt	   to_vel_en  s    c         ` s1   ˆ j  t j d t ƒ  ƒ} |  ˆ  } | d | S(   NR^   i   (   R%   R   Rh   R#   (   R   Ri   Rc   (   R`   Ra   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   from_vel_en  s    
(
   t   assert_is_spectral_unitR   R   R%   R   R   t   kmR;   R&   Rh   (   Ra   Rb   Rd   Rf   Rg   Rj   Rk   (    (   R`   Ra   s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   doppler_radioÛ   s    
c         ` sà   t  ˆ ƒ t j j d ƒ ‰  ‡  ‡ f d †  } ‡  ‡ f d †  } ‡  ‡ f d †  } ‡  ‡ f d †  } ‡  ‡ f d †  } ‡  ‡ f d †  } t j t j t j | | f t j t j t j | | f t j	 t j t j | | f g S(   u½  
    Return the equivalency pairs for the optical convention for velocity.

    The optical convention for the relation between velocity and frequency is:

    :math:`V = c \frac{f_0 - f}{f  }  ;  f(V) = f_0 ( 1 + V/c )^{-1}`

    Parameters
    ----------
    rest : `~astropy.units.Quantity`
        Any quantity supported by the standard spectral equivalencies
        (wavelength, energy, frequency, wave number).

    References
    ----------
    `NRAO site defining the conventions <http://www.gb.nrao.edu/~fghigo/gbtdoc/doppler.html>`_

    Examples
    --------
    >>> import astropy.units as u
    >>> CO_restfreq = 115.27120*u.GHz  # rest frequency of 12 CO 1-0 in GHz
    >>> optical_CO_equiv = u.doppler_optical(CO_restfreq)
    >>> measured_freq = 115.2832*u.GHz
    >>> optical_velocity = measured_freq.to(u.km/u.s, equivalencies=optical_CO_equiv)
    >>> optical_velocity  # doctest: +FLOAT_CMP
    <Quantity -31.20584348799674 km / s>
    u   km/sc         ` s+   ˆ j  t j d t ƒ  ƒ} ˆ  | |  |  S(   NR^   (   R%   R   R   R#   (   R   R_   (   R`   Ra   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyRb   =  s    c         ` s1   ˆ j  t j d t ƒ  ƒ} |  ˆ  } | d | S(   NR^   i   (   R%   R   R   R#   (   R   R_   Rc   (   R`   Ra   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyRd   A  s    
c         ` s(   ˆ j  t j t ƒ  ƒ } ˆ  |  | d S(   Ni   (   R%   R   R&   R#   (   R   Re   (   R`   Ra   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyRf   F  s    c         ` s.   ˆ j  t j t ƒ  ƒ } |  ˆ  } | d | S(   Ni   (   R%   R   R&   R#   (   R   Re   Rc   (   R`   Ra   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyRg   J  s    
c         ` s+   ˆ j  t j d t ƒ  ƒ} ˆ  | |  |  S(   NR^   (   R%   R   Rh   R#   (   R   Ri   (   R`   Ra   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyRj   O  s    c         ` s1   ˆ j  t j d t ƒ  ƒ} |  ˆ  } | d | S(   NR^   i   (   R%   R   Rh   R#   (   R   Ri   Rc   (   R`   Ra   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyRk   S  s    
(
   Rl   R   R   R%   R   R   Rm   R;   R&   Rh   (   Ra   Rb   Rd   Rf   Rg   Rj   Rk   (    (   R`   Ra   s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   doppler_optical  s    
c         ` sà   t  ˆ ƒ t j j d ƒ ‰  ‡  ‡ f d †  } ‡  ‡ f d †  } ‡  ‡ f d †  } ‡  ‡ f d †  } ‡  ‡ f d †  } ‡  ‡ f d †  } t j t j t j | | f t j t j t j | | f t j	 t j t j | | f g S(   u·  
    Return the equivalency pairs for the relativistic convention for velocity.

    The full relativistic convention for the relation between velocity and frequency is:

    :math:`V = c \frac{f_0^2 - f^2}{f_0^2 + f^2} ;  f(V) = f_0 \frac{\left(1 - (V/c)^2\right)^{1/2}}{(1+V/c)}`

    Parameters
    ----------
    rest : `~astropy.units.Quantity`
        Any quantity supported by the standard spectral equivalencies
        (wavelength, energy, frequency, wave number).

    References
    ----------
    `NRAO site defining the conventions <http://www.gb.nrao.edu/~fghigo/gbtdoc/doppler.html>`_

    Examples
    --------
    >>> import astropy.units as u
    >>> CO_restfreq = 115.27120*u.GHz  # rest frequency of 12 CO 1-0 in GHz
    >>> relativistic_CO_equiv = u.doppler_relativistic(CO_restfreq)
    >>> measured_freq = 115.2832*u.GHz
    >>> relativistic_velocity = measured_freq.to(u.km/u.s, equivalencies=relativistic_CO_equiv)
    >>> relativistic_velocity  # doctest: +FLOAT_CMP
    <Quantity -31.207467619351537 km / s>
    >>> measured_velocity = 1250 * u.km/u.s
    >>> relativistic_frequency = measured_velocity.to(u.GHz, equivalencies=relativistic_CO_equiv)
    >>> relativistic_frequency  # doctest: +FLOAT_CMP
    <Quantity 114.79156866993588 GHz>
    >>> relativistic_wavelength = measured_velocity.to(u.mm, equivalencies=relativistic_CO_equiv)
    >>> relativistic_wavelength  # doctest: +FLOAT_CMP
    <Quantity 2.6116243681798923 mm>
    u   km/sc         ` s?   ˆ j  t j d t ƒ  ƒ} | d |  d | d |  d ˆ  S(   NR^   i   (   R%   R   R   R#   (   R   R_   (   R`   Ra   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyRb   †  s    c         ` s=   ˆ j  t j d t ƒ  ƒ} |  ˆ  } | d | d | d S(   NR^   i   g      à?(   R%   R   R   R#   (   R   R_   Rc   (   R`   Ra   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyRd   Š  s    
c         ` s<   ˆ j  t j t ƒ  ƒ } |  d | d | d |  d ˆ  S(   Ni   (   R%   R   R&   R#   (   R   Re   (   R`   Ra   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyRf     s    c         ` s:   ˆ j  t j t ƒ  ƒ } |  ˆ  } | d | d | d S(   Ni   g      à?(   R%   R   R&   R#   (   R   Re   Rc   (   R`   Ra   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyRg   “  s    
c         ` s<   ˆ j  t j t ƒ  ƒ } | d |  d | d |  d ˆ  S(   Ni   (   R%   R   Rh   R#   (   R   Ri   (   R`   Ra   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyRj   ˜  s    c         ` s:   ˆ j  t j t ƒ  ƒ } |  ˆ  } | d | d | d S(   Ni   g      à?(   R%   R   Rh   R#   (   R   Ri   Rc   (   R`   Ra   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyRk   œ  s    
(
   Rl   R   R   R%   R   R   Rm   R;   R&   Rh   (   Ra   Rb   Rd   Rf   Rg   Rj   Rk   (    (   R`   Ra   s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   doppler_relativistic^  s    $
c           C` s   t  j t  j t j f g S(   u=   
    Returns the equivalence between amu and molar mass.
    (   R   t   gt   molR   t   u(    (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   molar_mass_amu§  s    c           C` sª   t  j t  j d „  d „  f t  j t  j d t  j t  j d d „  d „  f t  j t  j d t  j t  j d d „  d „  f t  j t  j t  j t  j d	 „  d
 „  f g S(   ue   
    Returns a list of equivalence pairs that handle the conversion
    between mass and energy.
    c         S` s   |  t  j j d S(   Ni   (   R   R   R   (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   ¶  s    c         S` s   |  t  j j d S(   Ni   (   R   R   R   (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   ·  s    i   c         S` s   |  t  j j d S(   Ni   (   R   R   R   (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   ¹  s    c         S` s   |  t  j j d S(   Ni   (   R   R   R   (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   º  s    i   c         S` s   |  t  j j d S(   Ni   (   R   R   R   (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   ¼  s    c         S` s   |  t  j j d S(   Ni   (   R   R   R   (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   ½  s    c         S` s   |  t  j j d S(   Ni   (   R   R   R   (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   ¾  s    c         S` s   |  t  j j d S(   Ni   (   R   R   R   (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   ¿  s    (   R   t   kgR    R   R;   (    (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   mass_energy°  s    	"	"	 c         ` sg   |  j  t j ƒ ‰  | j t j t ƒ  ƒ ‰ ‡  ‡ f d †  } ‡  ‡ f d †  } t j t j | | f g S(   u  
    Defines the conversion between Jy/beam and "brightness temperature",
    :math:`T_B`, in Kelvins.  The brightness temperature is a unit very
    commonly used in radio astronomy.  See, e.g., "Tools of Radio Astronomy"
    (Wilson 2009) eqn 8.16 and eqn 8.19 (these pages are available on `google
    books
    <http://books.google.com/books?id=9KHw6R8rQEMC&pg=PA179&source=gbs_toc_r&cad=4#v=onepage&q&f=false>`__).

    :math:`T_B \equiv S_\nu / \left(2 k \nu^2 / c^2 \right)`

    However, the beam area is essential for this computation: the brightness
    temperature is inversely proportional to the beam area

    Parameters
    ----------
    beam_area : Beam Area equivalent
        Beam area in angular units, i.e. steradian equivalent
    disp : `~astropy.units.Quantity` with spectral units
        The observed `spectral` equivalent `~astropy.units.Unit` (e.g.,
        frequency or wavelength)

    Examples
    --------
    Arecibo C-band beam::

        >>> import numpy as np
        >>> from astropy import units as u
        >>> beam_sigma = 50*u.arcsec
        >>> beam_area = 2*np.pi*(beam_sigma)**2
        >>> freq = 5*u.GHz
        >>> equiv = u.brightness_temperature(beam_area, freq)
        >>> u.Jy.to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP
        3.526294429423223
        >>> (1*u.Jy).to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP
        <Quantity 3.526294429423223 K>

    VLA synthetic beam::

        >>> bmaj = 15*u.arcsec
        >>> bmin = 15*u.arcsec
        >>> fwhm_to_sigma = 1./(8*np.log(2))**0.5
        >>> beam_area = 2.*np.pi*(bmaj*bmin*fwhm_to_sigma**2)
        >>> freq = 5*u.GHz
        >>> equiv = u.brightness_temperature(beam_area, freq)
        >>> u.Jy.to(u.K, equivalencies=equiv)  # doctest: +FLOAT_CMP
        217.2658703625732
    c         ` s?   d t  j t j ˆ d t  j d j t j ƒ } |  ˆ  | S(   Ni   (   R   t   k_BR   t   KR   R%   R   t   Jy(   t   x_jybmR@   (   t   beamt   nu(    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   convert_Jy_to_Kö  s    3c         ` s?   t  j d t j ˆ d t j d j t j ƒ } |  ˆ  | S(   Ni   (   R   Ry   R   Rw   R   R%   R   Rx   (   t   x_KR@   (   R{   R|   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   convert_K_to_Jyú  s    3(	   R%   R   t   srt   tot   GHzR#   R   Ry   Rx   (   t	   beam_areat   dispR}   R   (    (   R{   R|   s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   brightness_temperatureÃ  s
    0c          C` s_   d d l  m }  t j t j d „  d „  f t j |  d „  d „  f t j |  d „  d „  f g S(	   uˆ   Convert between Kelvin, Celsius, and Fahrenheit here because
    Unit and CompositeUnit cannot do addition or subtraction properly.
    i   (   t   deg_Fc         S` s   |  d S(   Ngfffffq@(    (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR     s    c         S` s   |  d S(   Ngfffffq@(    (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR     s    c         S` s   |  d d S(   NgÍÌÌÌÌÌü?g      @@(    (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR     s    c         S` s   |  d d S(   Ng      @@gÍÌÌÌÌÌü?(    (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR     s    c         S` s   |  d d d S(   Ngfffffq@gÍÌÌÌÌÌü?g      @@(    (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   	  s    c         S` s   |  d d d S(   Ng      @@gÍÌÌÌÌÌü?gfffffq@(    (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   
  s    (   t   imperialR†   R   Rx   t   deg_C(   R†   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   temperature  s
    c           C` s   t  j t  j d „  d „  f g S(   u;   Convert between Kelvin and keV(eV) to an equivalent amount.c         S` s   |  t  j j t  j j S(   N(   R   t   eR   Rw   (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR     s    c         S` s   |  t  j j t  j j S(   N(   R   RŠ   R   Rw   (   R   (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR     s    (   R   Rx   Rh   (    (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   temperature_energy  s    c         C` sF   y |  j  t j t ƒ  ƒ Wn% t t f k
 rA } t d ƒ ‚ n Xd  S(   NuR   The 'rest' value must be a spectral equivalent (frequency, wavelength, or energy).(   R   R   R   R#   t   AttributeErrorR	   (   R   t   ex(    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyRl     s    c         ` s«   |  j  j t j t j ƒ r8 |  j t j t j ƒ ‰  nH |  j  j t j t j ƒ rt d |  j t j t j ƒ ‰  n t d ƒ ‚ t j t j ‡  f d †  ‡  f d †  f g S(   u  
    Convert between pixel distances (in units of ``pix``) and angular units,
    given a particular ``pixscale``.

    Parameters
    ----------
    pixscale : `~astropy.units.Quantity`
        The pixel scale either in units of angle/pixel or pixel/angle.
    i   u5   The pixel scale must be in angle/pixel or pixel/anglec         ` s   |  ˆ  S(   N(    (   t   px(   t   pixscale_val(    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   .  s    c         ` s   |  ˆ  S(   N(    (   t   rad(   R   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   .  s    (	   t   unitt   is_equivalentR   t   arcsecR   t   pixR%   R
   R	   (   t   pixscale(    (   R   s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   pixel_scale  s    
 c         ` s«   |  j  j t j t j ƒ r8 |  j t j t j ƒ ‰  nH |  j  j t j t j ƒ rt d |  j t j t j ƒ ‰  n t d ƒ ‚ t j t j ‡  f d †  ‡  f d †  f g S(   u!  
    Convert between lengths (to be interpreted as lengths in the focal plane)
    and angular units with a specified ``platescale``.

    Parameters
    ----------
    platescale : `~astropy.units.Quantity`
        The pixel scale either in units of distance/pixel or distance/angle.
    i   u;   The pixel scale must be in angle/distance or distance/anglec         ` s   |  ˆ  S(   N(    (   t   d(   t   platescale_val(    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   C  s    c         ` s   |  ˆ  S(   N(    (   R   (   R˜   (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyR   C  s    (   R‘   R’   R   R“   R   R%   R
   R	   (   t
   platescale(    (   R˜   s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   plate_scale1  s    
 (&   t   __doc__t
   __future__R    R   R   R   t   numpyR   t	   constantsR   R   t    R   R   t   functionR   R   R   R8   R	   t   __all__R   R   R   R#   R   R]   Rn   Ro   Rp   Rt   Rv   R…   R‰   R‹   Rl   R–   Rš   (    (    (    s:   lib/python2.7/site-packages/astropy/units/equivalencies.pyt   <module>   s<   "		
		
	#‚	A	B	I				>				