<s> """<STR_LIT>""" <EOL> from __future__ import division , print_function , absolute_import <EOL> """<STR_LIT>""" <EOL> import math as _math <EOL> from . codata import value as _cd <EOL> import numpy as _np <EOL> pi = _math . pi <EOL> golden = golden_ratio = ( <NUM_LIT:1> + _math . sqrt ( <NUM_LIT:5> ) ) / <NUM_LIT:2> <EOL> yotta = <NUM_LIT> <EOL> zetta = <NUM_LIT> <EOL> exa = <NUM_LIT> <EOL> peta = <NUM_LIT> <EOL> tera = <NUM_LIT> <EOL> giga = <NUM_LIT> <EOL> mega = <NUM_LIT> <EOL> kilo = <NUM_LIT> <EOL> hecto = <NUM_LIT> <EOL> deka = <NUM_LIT> <EOL> deci = <NUM_LIT> <EOL> centi = <NUM_LIT> <EOL> milli = <NUM_LIT> <EOL> micro = <NUM_LIT> <EOL> nano = <NUM_LIT> <EOL> pico = <NUM_LIT> <EOL> femto = <NUM_LIT> <EOL> atto = <NUM_LIT> <EOL> zepto = <NUM_LIT> <EOL> kibi = <NUM_LIT:2> ** <NUM_LIT:10> <EOL> mebi = <NUM_LIT:2> ** <NUM_LIT:20> <EOL> gibi = <NUM_LIT:2> ** <NUM_LIT:30> <EOL> tebi = <NUM_LIT:2> ** <NUM_LIT> <EOL> pebi = <NUM_LIT:2> ** <NUM_LIT:50> <EOL> exbi = <NUM_LIT:2> ** <NUM_LIT> <EOL> zebi = <NUM_LIT:2> ** <NUM_LIT> <EOL> yobi = <NUM_LIT:2> ** <NUM_LIT> <EOL> c = speed_of_light = _cd ( '<STR_LIT>' ) <EOL> mu_0 = <NUM_LIT> * pi <EOL> epsilon_0 = <NUM_LIT:1> / ( mu_0 * c * c ) <EOL> h = Planck = _cd ( '<STR_LIT>' ) <EOL> hbar = h / ( <NUM_LIT:2> * pi ) <EOL> G = gravitational_constant = _cd ( '<STR_LIT>' ) <EOL> g = _cd ( '<STR_LIT>' ) <EOL> e = elementary_charge = _cd ( '<STR_LIT>' ) <EOL> R = gas_constant = _cd ( '<STR_LIT>' ) <EOL> alpha = fine_structure = _cd ( '<STR_LIT>' ) <EOL> N_A = Avogadro = _cd ( '<STR_LIT>' ) <EOL> k = Boltzmann = _cd ( '<STR_LIT>' ) <EOL> sigma = Stefan_Boltzmann = _cd ( '<STR_LIT>' ) <EOL> Wien = _cd ( '<STR_LIT>' ) <EOL> Rydberg = _cd ( '<STR_LIT>' ) <EOL> gram = <NUM_LIT> <EOL> metric_ton = <NUM_LIT> <EOL> grain = <NUM_LIT> <EOL> lb = pound = <NUM_LIT> * grain <EOL> oz = ounce = pound / <NUM_LIT:16> <EOL> stone = <NUM_LIT> * pound <EOL> long_ton = <NUM_LIT> * pound <EOL> short_ton = <NUM_LIT> * pound <EOL> troy_ounce = <NUM_LIT> * grain <EOL> troy_pound = <NUM_LIT:12> * troy_ounce <EOL> carat = <NUM_LIT> <EOL> m_e = electron_mass = _cd ( '<STR_LIT>' ) <EOL> m_p = proton_mass = _cd ( '<STR_LIT>' ) <EOL> m_n = neutron_mass = _cd ( '<STR_LIT>' ) <EOL> m_u = u = atomic_mass = _cd ( '<STR_LIT>' ) <EOL> degree = pi / <NUM_LIT> <EOL> arcmin = arcminute = degree / <NUM_LIT> <EOL> arcsec = arcsecond = arcmin / <NUM_LIT> <EOL> minute = <NUM_LIT> <EOL> hour = <NUM_LIT> * minute <EOL> day = <NUM_LIT> * hour <EOL> week = <NUM_LIT:7> * day <EOL> year = <NUM_LIT> * day <EOL> Julian_year = <NUM_LIT> * day <EOL> inch = <NUM_LIT> <EOL> foot = <NUM_LIT:12> * inch <EOL> yard = <NUM_LIT:3> * foot <EOL> mile = <NUM_LIT> * yard <EOL> mil = inch / <NUM_LIT:1000> <EOL> pt = point = inch / <NUM_LIT> <EOL> survey_foot = <NUM_LIT> / <NUM_LIT> <EOL> survey_mile = <NUM_LIT> * survey_foot <EOL> nautical_mile = <NUM_LIT> <EOL> fermi = <NUM_LIT> <EOL> angstrom = <NUM_LIT> <EOL> micron = <NUM_LIT> <EOL> au = astronomical_unit = <NUM_LIT> <EOL> light_year = Julian_year * c <EOL> parsec = au / arcsec <EOL> atm = atmosphere = _cd ( '<STR_LIT>' ) <EOL> bar = <NUM_LIT> <EOL> torr = mmHg = atm / <NUM_LIT> <EOL> psi = pound * g / ( inch * inch ) <EOL> hectare = <NUM_LIT> <EOL> acre = <NUM_LIT> * foot ** <NUM_LIT:2> <EOL> litre = liter = <NUM_LIT> <EOL> gallon = gallon_US = <NUM_LIT> * inch ** <NUM_LIT:3> <EOL> fluid_ounce = fluid_ounce_US = gallon_US / <NUM_LIT> <EOL> bbl = barrel = <NUM_LIT> * gallon_US <EOL> gallon_imp = <NUM_LIT> <EOL> fluid_ounce_imp = gallon_imp / <NUM_LIT> <EOL> kmh = <NUM_LIT> / hour <EOL> mph = mile / hour <EOL> mach = speed_of_sound = <NUM_LIT> <EOL> knot = nautical_mile / hour <EOL> zero_Celsius = <NUM_LIT> <EOL> degree_Fahrenheit = <NUM_LIT:1> / <NUM_LIT> <EOL> eV = electron_volt = elementary_charge <EOL> calorie = calorie_th = <NUM_LIT> <EOL> calorie_IT = <NUM_LIT> <EOL> erg = <NUM_LIT> <EOL> Btu_th = pound * degree_Fahrenheit * calorie_th / gram <EOL> Btu = Btu_IT = pound * degree_Fahrenheit * calorie_IT / gram <EOL> ton_TNT = <NUM_LIT> * calorie_th <EOL> hp = horsepower = <NUM_LIT> * foot * pound * g <EOL> dyn = dyne = <NUM_LIT> <EOL> lbf = pound_force = pound * g <EOL> kgf = kilogram_force = g <EOL> def convert_temperature ( val , old_scale , new_scale ) : <EOL> """<STR_LIT>""" <EOL> if old_scale . lower ( ) in [ '<STR_LIT>' , '<STR_LIT:c>' ] : <EOL> tempo = _np . asanyarray ( val ) + zero_Celsius <EOL> elif old_scale . lower ( ) in [ '<STR_LIT>' , '<STR_LIT:k>' ] : <EOL> tempo = _np . asanyarray ( val ) <EOL> elif old_scale . lower ( ) in [ '<STR_LIT>' , '<STR_LIT:f>' ] : <EOL> tempo = ( _np . asanyarray ( val ) - <NUM_LIT> ) * <NUM_LIT> / <NUM_LIT> + zero_Celsius <EOL> elif old_scale . lower ( ) in [ '<STR_LIT>' , '<STR_LIT:r>' ] : <EOL> tempo = _np . asanyarray ( val ) * <NUM_LIT> / <NUM_LIT> <EOL> else : <EOL> raise NotImplementedError ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" % old_scale ) <EOL> if new_scale . lower ( ) in [ '<STR_LIT>' , '<STR_LIT:c>' ] : <EOL> res = tempo - zero_Celsius <EOL> elif new_scale . lower ( ) in [ '<STR_LIT>' , '<STR_LIT:k>' ] : <EOL> res = tempo <EOL> elif new_scale . lower ( ) in [ '<STR_LIT>' , '<STR_LIT:f>' ] : <EOL> res = ( tempo - zero_Celsius ) * <NUM_LIT> / <NUM_LIT> + <NUM_LIT> <EOL> elif new_scale . lower ( ) in [ '<STR_LIT>' , '<STR_LIT:r>' ] : <EOL> res = tempo * <NUM_LIT> / <NUM_LIT> <EOL> else : <EOL> raise NotImplementedError ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" % new_scale ) <EOL> return res <EOL> @ _np . deprecate ( message = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def C2K ( C ) : <EOL> """<STR_LIT>""" <EOL> return _np . asanyarray ( C ) + zero_Celsius <EOL> @ _np . deprecate ( message = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def K2C ( K ) : <EOL> """<STR_LIT>""" <EOL> return _np . asanyarray ( K ) - zero_Celsius <EOL> @ _np . deprecate ( message = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def F2C ( F ) : <EOL> """<STR_LIT>""" <EOL> return ( _np . asanyarray ( F ) - <NUM_LIT:32> ) / <NUM_LIT> <EOL> @ _np . deprecate ( message = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def C2F ( C ) : <EOL> """<STR_LIT>""" <EOL> return <NUM_LIT> * _np . asanyarray ( C ) + <NUM_LIT:32> <EOL> @ _np . deprecate ( message = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def F2K ( F ) : <EOL> """<STR_LIT>""" <EOL> return C2K ( F2C ( _np . asanyarray ( F ) ) ) <EOL> @ _np . deprecate ( message = "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def K2F ( K ) : <EOL> """<STR_LIT>""" <EOL> return C2F ( K2C ( _np . asanyarray ( K ) ) ) <EOL> def lambda2nu ( lambda_ ) : <EOL> """<STR_LIT>""" <EOL> return _np . asanyarray ( c ) / lambda_ <EOL> def nu2lambda ( nu ) : <EOL> """<STR_LIT>""" <EOL> return c / _np . asanyarray ( nu ) </s>
