def __init__(self,prefix,unit): const.__init__(self,prefix + 'Gunters') # English Units # length self.chain = unit.chain; self.chains = self.chain;
def __init__(self,prefix,unit): const.__init__(self,prefix + 'nautical') self.mile = 1852*unit.meters; self.miles = self.mile; self.nm = self.mile; self.league = 3.0*self.miles; self.leagues = self.league;
def __init__(self,prefix,unit): const.__init__(self,prefix + 'statute') self.mile = 5280.0*unit.feet; self.miles = self.mile; self.mi = self.mile; self.league = 3.0*self.miles; self.leagues = self.league;
def __init__(self, prefix, unit): const.__init__(self, prefix + "engineers") # English Units # length self.link = unit.foot self.links = self.link self.chain = 100.0 * unit.feet self.chains = self.chain
def __init__(self,prefix,arc): const.__init__(self,prefix + 'centesimal') self.minute = arc.grade/100.0; self.minutes = self.minute; self.min = self.minute; self.second = arc.grade/10000.0; self.seconds = self.second; self.sec = self.second;
def __init__(self,prefix,unit): const.__init__(self,prefix + 'dry') self.pint = 550.61047*unit.cc; self.pints = self.pint; self.pt = self.pint; self.quart = 2.0*self.pints; self.quarts = self.quart; self.qt = self.quart;
def __init__(self,prefix,unit): const.__init__(self,prefix + 'metric') # mass self.carat = unit.gram/5.0; self.carats = self.carat; self.ton = 1000.0*unit.kilograms; self.tons = self.ton; self.t = self.ton;
def __init__(self,prefix,unit): const.__init__(self,prefix + 'dose') # energy self.Gray = unit.Joule/unit.kilogram; self.Grays = self.Gray; self.Gy = self.Gray; self.Sievert = self.Gray; self.Sieverts = self.Sievert; self.rad = self.Gray/100.0; self.rads = self.rad; self.rd = self.rad;
def __init__(self,prefix,unit): const.__init__(self,prefix + 'avoirdupois') # weight self.pound = 7000.0*unit.grains; self.pounds = self.pound; self.lb = self.pound; self.ounce = self.pound/16.0; self.ounces = self.ounce; self.oz = self.ounce; self.dram = self.ounce/16.0; self.drams = self.dram; self.dr = self.dram;
def __init__(self,prefix,unit): const.__init__(self,prefix + 'apothecary') # weight self.scruple = 20.0*unit.grains; self.scruples = self.scruple; self.s = self.scruple; self.dram = 3.0*self.scruples; self.drams = self.dram; self.dr = self.dram; self.ounce = 8.0*self.drams; self.ounces = self.ounce; self.oz = self.ounce; self.pound = 12.0*self.ounces; self.pounds = self.pound; self.lb = self.pound;
def __init__(self,prefix,unit): const.__init__(self,prefix + 'equivalent') # light intensity self.lux = unit.lux/unit.pi; self.luxes = self.lux; self.luces = self.lux; self.lx = self.lux; self.lumen = unit.lumen/unit.pi; self.lumens = self.lumen; self.lm = self.lumen; self.phot = unit.apostilb/unit.pi; self.phots = self.phot; self.foot_candle = unit.foot_candle/unit.pi; self.foot_candles = self.foot_candle; self.fc = self.foot_candle;
def __init__(self,prefix,unit): const.__init__(self,prefix + 'US') #length self.cable_length = 120.0*unit.fathoms; self.cable_lengths = self.cable_length; #mass # short self.hundredweight = 100.0*unit.avoirdupois.pounds; self.cwt = self.hundredweight; self.quarter = self.hundredweight/4.0; self.quarters = self.quarter; self.qr = self.quarter; self.ton = 20.0*self.hundredweight; self.tons = self.ton; self.tn = self.ton; self.deadweight = self.ton; #volume self.liquid = liquid.liquid(prefix + 'US.', unit) self.dry = dry.dry(prefix + 'US.', unit) self.peck = 8.0*self.dry.quarts; self.pecks = self.peck; self.pk = self.peck; self.bushel = 4.0*self.pecks; self.bushels = self.bushel; self.bu = self.bushel; self.barrel = 31.5*self.liquid.gallons; self.barrels = self.barrel; self.bbl = self.barrel; self.bl = self.barrel; # do some trickery to get modules set to instantiated classes # We expect each submodule to do likewise for those not already taken # care of here. self.liquid.__name__ = liquid.__name__ sys.modules[liquid.__name__] = self.liquid self.dry.__name__ = dry.__name__ sys.modules[dry.__name__] = self.dry
def __init__(self, prefix, constant, unit): mkElement = ElementMaker(self, prefix + 'element.', constant, unit) mkElement('hydrogen', 'H', 1, 1.00794, 13.5984 ) mkElement('helium', 'He', 2, 4.002602, 24.5874 ) mkElement('lithium', 'Li', 3, 6.941, 5.3917 ) mkElement('beryllium', 'Be', 4, 9.012182, 9.3227 ) mkElement('boron', 'B', 5, 10.812, 8.2980 ) mkElement('carbon', 'C', 6, 12.0107, 11.2603 ) mkElement('nitrogen', 'N', 7, 14.0067, 14.5341 ) mkElement('oxygen', 'O', 8, 15.9994, 13.6181 ) mkElement('fluorine', 'F', 9, 18.9984032, 17.4228 ) mkElement('neon', 'Ne', 10, 20.1797, 21.5645 ) mkElement('sodium', 'Na', 11, 22.989770, 5.1391 ) mkElement('magnesium', 'Mg', 12, 24.3051, 7.6462 ) mkElement('aluminium', 'Al', 13, 26.981538, 5.9858 ) mkElement('silicon', 'Si', 14, 28.0855, 8.1517 ) mkElement('phosphorus', 'P', 15, 30.973761, 10.4867 ) mkElement('sulfur', 'S', 16, 32.065, 10.3600 ) mkElement('chlorine', 'Cl', 17, 35.453, 12.9676 ) mkElement('argon', 'Ar', 18, 39.948, 15.7596 ) mkElement('potassium', 'K', 19, 39.0983, 4.3407 ) mkElement('calcium', 'Ca', 20, 40.078, 6.1132 ) mkElement('scandium', 'Sc', 21, 44.955911, 6.5615 ) mkElement('titanium', 'Ti', 22, 47.867, 6.8281 ) mkElement('vanadium', 'V', 23, 50.9415, 6.7462 ) mkElement('chromium', 'Cr', 24, 51.9961, 6.7665 ) mkElement('manganese', 'Mn', 25, 54.9380499, 7.4340 ) mkElement('iron', 'Fe', 26, 55.845, 7.9024 ) mkElement('cobalt', 'Co', 27, 58.9332009, 7.8810 ) mkElement('nickel', 'Ni', 28, 58.6934, 7.6398 ) mkElement('copper', 'Cu', 29, 63.546, 7.7264 ) mkElement('zinc', 'Zn', 30, 65.409, 9.3942 ) mkElement('krypton', 'Kr', 36, 83.798, 13.9996 ) mkElement('rubidium', 'Rb', 37, 85.4678, 4.1771 ) mkElement('xenon', 'Xe', 54, 131.293, 12.1298 ) mkElement('cesium', 'Cs', 55, 132.90545, 3.8939 ) mkElement('mercury', 'Hg', 80, 200.59, 10.4375 ) mkElement('francium', 'Fr', 87, 223, 4.0727 ) const.__init__(self, prefix + 'element')
def __init__(self,prefix,unit): const.__init__(self,prefix + 'arc') self.degree = unit.pi/180.0; self.degrees = self.degree; self.minute = self.degree/60.0; self.minutes = self.minute; self.min = self.minute; self.second = self.minute/60.0; self.seconds = self.second; self.sec = self.second; self.grade = 0.9*self.degrees; self.grades = self.grade; self.centesimal = centesimal.centesimal(prefix + "arc.",self) # do some trickery to get modules set to instantiated classes # We expect each submodule to do likewise for those not already taken # care of here. self.centesimal.__name__ = centesimal.__name__ sys.modules[centesimal.__name__] = self.centesimal
def __init__(self,prefix,unit): const.__init__(self,prefix + 'fluid') #volume self.drachm = 60.0*unit.minims; self.drachms = self.drachm; self.dr = self.drachm; self.ounce = 8.0*self.drachms; self.ounces = self.ounce; self.oz = self.ounce; self.gill = 5.0*self.ounces; self.gills = self.gill; self.gi = self.gill; self.pint = 4.0*self.gills; self.pints = self.pint; self.pt = self.pint; self.quart = 2.0*self.pints; self.quarts = self.quart; self.qt = self.quart; self.gallon = 4.0*self.quarts; self.gallons = self.gallon; self.gal = self.gallon;
def __init__(self,prefix,unit): const.__init__(self,prefix + 'liquid') self.dram = 60.0*unit.minims; self.drams = self.dram; self.dr = self.dram; self.ounce = 8.0*self.drams; self.ounces = self.ounce; self.oz = self.ounce; self.gill = 4.0*self.ounces; self.gills = self.gill; self.gl = self.gill; self.pint = 4.0*self.gills; self.pints = self.pint; self.pt = self.pint; self.quart = 2.0*self.pints; self.quarts = self.quart; self.qt = self.quart; self.magnum = 2.0*self.quarts; self.magnums = self.magnum; self.gallon = 4.0*self.quarts; self.gallons = self.gallon; self.gal = self.gallon;
def __init__(self,prefix,unit): const.__init__(self,prefix + 'British') #volume self.fluid = fluid.fluid(prefix + 'British.',unit) self.peck = 2.0*self.fluid.gallons; self.pecks = self.peck; self.pk = self.peck; self.bushel = 4.0*self.pecks; self.bushels = self.bushel; self.bu = self.bushel; self.barrel = 36.0*self.fluid.gallons; self.barrels = self.barrel; self.bbl = self.barrel; self.bl = self.barrel; #length self.cable_length = 100.0*unit.fathoms; self.cable_lengths = self.cable_length; #mass self.hundredweight = 112.0*unit.avoirdupois.pounds; self.cwt = self.hundredweight; self.quarter = self.hundredweight/4.0; self.quarters = self.quarter; self.qr = self.quarter; self.ton = 20.0*self.hundredweight; self.tons = self.ton; self.tn = self.ton; # do some trickery to get modules set to instantiated classes # We expect each submodule to do likewise for those not already taken # care of here. self.fluid.__name__ = fluid.__name__ sys.modules[fluid.__name__] = self.fluid
def __init__(self,prefix,unit): const.__init__(self,prefix + 'bakers') self.dozen = 13.0; self.doz = self.dozen; self.dz = self.dozen;
def __init__(self,prefix,unit): const.__init__(self,prefix + 'admiralty') #speed self.knot = 6980.0*unit.feet/unit.hour; self.knots = self.knot;
def __init__(self,prefix,unit): const.__init__(self,prefix + 'Hefner') self.candle = 0.9*unit.candles; self.candles = self.candle;
def __init__(self, prefix, name, number, mass, ionization): const.__init__(self, prefix + name) self.number = number self.mass = mass self.ionization = ionization
def __init__(self,prefix, unit): const.__init__(self,prefix + 'constant') self.c = 2.99792458e8*unit.meters/unit.second; self.c.name = 'speed of light'; self.Mach = 331.46*unit.meters/unit.second; self.Mach.name = 'speed of sound'; self.h = 6.6260755e-34*unit.Joule*unit.seconds; self.h.name = 'Planck constant'; self.h_bar = self.h/(2.0*unit.pi); self.h_bar.name = 'Planck constant'; self.g = unit.gravity; self.g.name = 'standard gravitational acceleration at sea level'; self.e = 1.60217733e-19*unit.Coulombs; self.e.name = 'electron charge'; # energy # electron Volt self.eV = self.e*unit.V; self.eV.name = 'electron Volt'; self.keV = 1000.0*self.eV; self.keV.name = 'kilo-electron Volt'; self.MeV = 1000000.0*self.eV; self.MeV.name = 'Mega-electron Volt'; self.GeV = 1000000000.0*self.eV; self.GeV.name = 'Giga-electron Volt'; self.Rydberg = 13.6054*self.eV; self.Rydberg.name = 'Rydberg energy'; self.Rydbergs = self.Rydberg; # mass # electron mass self.m_e = 9.1093897e-31*unit.kilograms; self.m_e.name = 'electron mass'; # proton mass self.m_P = 1.6726231e-27*unit.kilograms; self.m_P.name = 'proton mass'; # deuteron mass self.m_D = 1875.61339*self.MeV/(self.c*self.c); self.m_D.name = 'deuteron mass'; # unified atomic mass unit self.atomic_mass_unit = 1.6605402e-27*unit.kilograms; self.atomic_mass_unit.name = 'unified atomic mass unit'; self.atomic_mass_units = self.atomic_mass_unit; self.amu = self.atomic_mass_unit; self.Dalton = self.atomic_mass_unit; self.Daltons = self.Dalton; self.epsilon = 8.854187817e-12*unit.Farads/unit.meter; self.epsilon.name = 'permittivity of free space'; self.mu = 12.566370614e-7*unit.Newtons/(unit.A*unit.A); self.mu.name = 'permeability of free space'; self.alpha = Quantity(1.0/137.0359895,{}); self.alpha.name = 'fine-structure constant'; self.r_e = 2.81794092e-15*unit.meters; self.r_e.name = 'classical electron radius'; self.lambda_bar = 3.86159323e-13*unit.meters; self.lambda_bar.name = 'electron Compton wavelength'; self.a_0 = 0.529177249e-10*unit.meters; self.a_0.name = 'Bohr radius'; self.lambda_1eV = 1.23984244e-6*unit.meters; self.lambda_1eV.name = 'wavelength of 1 eV/c particle'; self.sigma_0 = 0.66524616*unit.barns; self.sigma_0.name = 'Thomson cross section'; self.mu_B = 5.78838263e-11*self.MeV/unit.Tesla; self.mu_B.name = 'Bohr magnetron'; self.mu_N = 3.15245166e-14*self.MeV/unit.Tesla; self.mu_N.name = 'nuclear magnetron'; self.E_M_e = 1.75881962e11*unit.C/unit.kg*(unit.rad/(unit.s*unit.T)); self.E_M_e.name = 'electron cyclotron frequency/field'; self.E_M_P = 9.5788309e7*unit.C/unit.kg*(unit.rad/(unit.s*unit.T)); self.E_M_P.name = 'proton cyclotron frequency/field'; self.G = 6.67259e-11*unit.m*unit.m*unit.m/(unit.kg*unit.s*unit.s); self.G.name = 'gravitational constant'; self.N_A = Quantity(6.0221367e23,{}); self.N_A.name = 'Avogadro\'s constant'; self.K_B = 1.380658e-23*unit.Joules/unit.Kelvin; self.K_B.name = 'Boltzmann constant'; self.V_molar = 2.897756e-3*unit.meter*unit.Kelvins; self.V_molar.name = 'molar volume, ideal gas at standard temperature and pressure'; self.sigma_SB = 5.67051e-8*unit.W/(unit.m*unit.m*unit.K*unit.K*unit.K*unit.K); self.sigma_SB.name = 'Stefan-Boltzmann constant';
def __init__(self,prefix, unit): const.__init__(self,prefix + 'constant') self.pi = Quantity(unit.pi.coeff, {}, 'unitless pi constant') self.c = 2.99792458e8*unit.meters/unit.second; self.c.name = 'speed of light'; self.Mach = 331.46*unit.meters/unit.second; self.Mach.name = 'speed of sound'; self.h = 6.6260755e-34*unit.Joule*unit.seconds; self.h.name = 'Planck constant'; self.h_bar = self.h/(2.0*unit.pi); self.h_bar.name = 'Planck constant'; self.g = unit.gravity; self.g.name = 'standard gravitational acceleration at sea level'; self.e = 1.60217733e-19*unit.Coulombs; self.e.name = 'electron charge'; # energy # electron Volt self.eV = self.e*unit.V; self.eV.name = 'electron Volt'; self.keV = 1000.0*self.eV; self.keV.name = 'kilo-electron Volt'; self.MeV = 1000000.0*self.eV; self.MeV.name = 'Mega-electron Volt'; self.GeV = 1000000000.0*self.eV; self.GeV.name = 'Giga-electron Volt'; self.Rinfinity = 10973731.568527/unit.m; self.Rinfinity.name = 'Rydberg constant (R_inf)'; self.Rydberg = self.h * self.c * self.Rinfinity; self.Rydberg.name = 'Rydberg energy'; self.Rydbergs = self.Rydberg; self.Hartree = 2. * self.Rydberg; self.Hartree.name = 'Atomic energy unit'; self.Hartrees = self.Hartree; # mass # electron mass self.m_e = 9.10938215e-31*unit.kilograms; self.m_e.name = 'electron mass'; # proton mass self.m_p = 1.672621637e-27*unit.kilograms; self.m_p.name = 'proton mass'; # deuteron mass self.m_d = 1875.612793*self.MeV/(self.c*self.c); self.m_d.name = 'deuteron mass'; # unified atomic mass unit self.atomic_mass_unit = 1.660538782e-27*unit.kilograms; self.atomic_mass_unit.name = 'unified atomic mass unit'; self.atomic_mass_units = self.atomic_mass_unit; self.amu = self.atomic_mass_unit; self.Dalton = self.atomic_mass_unit; self.Daltons = self.Dalton; self.epsilon0 = 8.854187817e-12*unit.Farads/unit.meter; self.epsilon0.name = 'permittivity of free space'; self.k_E = 1. / ( 4. * self.pi * self.epsilon0 ); self.k_E.name = 'Coulomb constant'; self.mu0 = 4 * self.pi * 1e-7 * unit.Newtons / unit.A**2; self.mu0.name = 'permeability of free space'; self.alpha = Quantity(7.2973525376e-3, {}, 'fine-structure constant') self.g_e = Quantity(-2.0023193043622, {}, 'electron g-factor') self.g_d = Quantity(0.8574382308, {}, 'deuteron g-factor') self.r_e = 2.81794092e-15*unit.meters; self.r_e.name = 'classical electron radius'; self.lambda_C = self.h / (self.m_e * self.c); self.lambda_C.name = 'Compton wavelength'; self.lambda_C_bar = self.lambda_C / (2 *unit.pi); self.lambda_C_bar.name = 'Compton wavelength (over 2pi)'; self.a_0 = self.alpha / (4*self.pi * self.Rinfinity); self.a_0.name = 'Bohr radius'; self.lambda_1eV = self.h / (self.eV / self.c); self.lambda_1eV.name = 'wavelength of 1 eV/c particle'; self.sigma_0 = 0.6652458558*unit.barns; self.sigma_0.name = 'Thomson cross section'; self.mu_B = 5.7883818e-11*self.MeV/unit.Tesla; self.mu_B.name = 'Bohr magneton'; self.mu_N = 3.1524513e-14*self.MeV/unit.Tesla; self.mu_N.name = 'nuclear magneton'; self.e_m_e = self.e / self.m_e; self.e_m_e.name = 'electron cyclotron frequency/field'; self.e_m_p = self.e / self.m_p; self.e_m_p.name = 'proton cyclotron frequency/field'; self.G = 6.67428e-11* unit.m**3 /(unit.kg * unit.s**2); self.G.name = 'gravitational constant'; self.N_A = Quantity(6.02214179e23, {}, "Avogadro's constant") self.K_B = 1.3806504e-23*unit.Joules/unit.Kelvin; self.K_B.name = 'Boltzmann constant'; self.stdtemp = 273.15 * unit.Kelvin; self.stdtemp.name = 'standard temperature'; self.R = self.K_B * self.N_A; self.R.name = 'universal gas constant'; self.V_molar = self.R * self.stdtemp / unit.atm self.V_molar.name = 'molar volume, ideal gas, 273.15 K, 101.325 kPa' self.n_0 = self.N_A / self.V_molar self.n_0.name = 'Loschmidt constant, ideal gas, 273.15 K, 101.325 kPa' self.sigma_SB = 5.670400e-8*unit.W/(unit.m**2 * unit.K**4); self.sigma_SB.name = 'Stefan-Boltzmann constant'; self.z0 = self.c * self.mu0 self.z0.name = 'impedance of free space'
def __init__(self,prefix,unit): const.__init__(self,prefix + 'displacement') self.ton = unit.stere; self.tons = self.ton; self.t = self.ton;
def __init__(self, prefix): const.__init__(self,prefix + 'unit'); # #### BEGIN OF UNIT CREATION #### # # for each submodule, we pass in self to allow dependence on values # previously set. # conversion factor self.radian = Quantity(1,{'radian':1}); self.radians = self.radian; self.rad = self.radian; self.steradian = Quantity(1,{'steradian':1}); self.steradians = self.steradian; self.sr = self.steradian; # money self.dollar = Quantity(1,{'dollar':1}); self.dollars = self.dollar; self.cent = self.dollar/100.0; self.cents = self.cent; self.dozen = 12.0; self.doz = self.dozen; self.dz = self.dozen; self.gross = 12.0*self.dozen; self.gro = self.gross; self.quire = 25.0; self.quires = self.quire; self.ream = 500.0; self.reams = self.ream; self.percent = 1.0/100.0; self.proof = self.percent/2.0; self.karat = 1.0/24.0; self.karats = self.karat; self.mole = 6.0221367e+23; self.moles = self.mole; self.mol = self.mole; self.pi = 3.14159265358979323846*self.radians; # SI units (mks) # length self.meter = Quantity(1,{'m':1}); self.meters = self.meter; self.m = self.meter; self.kilometer = 1000.0*self.meters; self.kilometers = self.kilometer; self.km = self.kilometer; self.decimeter = self.meters/10.0; self.decimeters = self.decimeter; self.dm = self.decimeter; self.centimeter = self.meters/100.0; self.centimeters = self.centimeter; self.cm = self.centimeter; self.millimeter = self.meters/1000.0; self.millimeters = self.millimeter; self.mm = self.millimeter; self.micron = self.meter/1000000.0; self.microns = self.micron; self.um = self.micron; self.nanometer = self.meter/1000000000.0; self.nanometers = self.nanometer; self.nm = self.nanometer; self.decinanometer = self.meter/10000000000.0; self.decinanometers = self.decinanometer; self.Angstrom = self.decinanometer; self.Angstroms = self.Angstrom; self.Xunit = 1.00202e-13*self.meters; self.Xunits = self.Xunit; self.Fermi = self.meter/1000000000000000.0; self.Fermis = self.Fermi; # area self.hectare = 10000.0*self.meter*self.meter; self.hectares = self.hectare; self.ha = self.hectare; # volume self.stere = self.meter*self.meter*self.meter; self.steres = self.stere; self.liter = self.stere/1000.0; self.liters = self.liter; self.l = self.liter; self.milliliter = self.stere/1000000.0; self.milliliters = self.milliliter; self.ml = self.milliliter; self.cc = self.milliliter; # mass self.kilogram = Quantity(1,{'kg':1}); self.kilograms = self.kilogram; self.kg = self.kilogram; self.quintal = 100.0*self.kilograms; self.quintals = self.quintal; self.doppelzentner = self.quintal; self.doppelzentners = self.doppelzentner; self.gram = self.kilograms/1000.0; self.grams = self.gram; self.g = self.gram; self.milligram = self.kilogram/1000000.0; self.milligrams = self.milligram; self.mg = self.milligram; # time self.second = Quantity(1,{'s':1}); self.seconds = self.second; self.sec = self.second; self.s = self.second; self.millisecond = self.second/1000.0; self.milliseconds = self.millisecond; self.ms = self.millisecond; self.microsecond = self.second/1000000.0; self.microseconds = self.microsecond; self.us = self.microsecond; self.nanosecond = self.second/1000000000.0; self.nanoseconds = self.nanosecond; self.picosecond = self.second/1000000000000.0; self.picoseconds = self.picosecond; self.minute = 60.0*self.seconds; self.minutes = self.minute; self.min = self.minute; self.hour = 60.0*self.minutes; self.hours = self.hour; self.hr = self.hour; self.day = 24.0*self.hours; self.days = self.day; self.da = self.day; self.week = 7.0*self.days; self.weeks = self.week; self.fortnight = 2.0*self.weeks; self.fortnights = self.fortnight; self.year = 365.2421896698*self.days; self.years = self.year; self.yr = self.year; self.month = self.year/12.0; self.months = self.month; self.mo = self.month; self.decade = 10.0*self.years; self.decades = self.decade; self.century = 100.0*self.years; self.centuries = self.century; self.millenium = 1000.0*self.years; self.millenia = self.millenium; # temporal frequency self.Hertz = 1.0/self.second; self.Hz = self.Hertz; self.kiloHertz = 1000.0*self.Hertz; self.kHz = self.kiloHertz; self.megaHertz = 1000000.0*self.Hertz; self.MHz = self.megaHertz; self.gigaHertz = 1000000000.0*self.Hertz; self.GHz = self.gigaHertz; self.teraHertz = 1000000000000.0*self.Hertz; self.THz = self.teraHertz; # spacial frequency self.diopter = 1.0/self.meter; self.diopters = self.diopter; # speed self.kph = self.kilometers/self.hour; # radioactivity self.Becquerel = 1.0/self.second; self.Becquerels = self.Becquerel; self.Bq = self.Becquerel; self.Rutherford = 1000000.0*self.Becquerels; self.Rutherfords = self.Rutherford; self.Curie = 3.7e+10*self.Becquerels; self.Curies = self.Curie; self.Ci = self.Curie; # force self.Newton = self.kilogram*self.meter/(self.second*self.second); self.Newtons = self.Newton; self.N = self.Newton; self.dyne = self.Newton/100000.0; self.dynes = self.dyne; self.dyn = self.dyne; # pressure self.Pascal = self.Newton/(self.meter*self.meter); self.Pascals = self.Pascal; self.Pa = self.Pascal; self.Barie = self.Pascal/10.0; self.Baries = self.Barie; self.Barye = self.Barie; self.Baryes = self.Barye; self.pieze = 1000.0*self.Pascals; self.piezes = self.pieze; self.pz = self.pieze; self.bar = 10000.0*self.Pascals; self.bars = self.bar; self.Torr = 133.3224*self.Pascals; self.atmosphere = 760.0*self.Torr; self.atmospheres = self.atmosphere; self.atm = self.atmosphere; # energy self.Joule = self.Newton*self.meter; self.Joules = self.Joule; self.J = self.Joule; self.erg = self.Joule/10000000.0; self.ergs = self.erg; self.kiloWatthour = 3600000.0*self.Joules; self.kiloWatthours = self.kiloWatthour; self.kWh = self.kiloWatthour; # power self.Watt = self.Joule/self.second; self.Watts = self.Watt; self.W = self.Watt; self.kiloWatt = 1000.0*self.Watts; self.kiloWatts = self.kiloWatt; self.kW = self.kiloWatt; self.megaWatt = 1000000.0*self.Watts; self.megaWatts = self.megaWatt; self.MW = self.megaWatt; self.milliWatt = self.Watt/1000.0; self.milliWatts = self.milliWatt; self.mW = self.milliWatt; self.microWatt = self.Watt/1000000.0; self.microWatts = self.microWatt; self.uW = self.microWatt; self.nanoWatt = self.Watt/1000000000.0; self.nanoWatts = self.nanoWatt; self.nW = self.nanoWatt; # electrical current self.Ampere = Quantity(1,{'A':1}); self.Amperes = self.Ampere; self.A = self.Ampere; self.Biot = 10.0*self.Amperes; self.Biots = self.Biot; self.abAmpere = self.Biot self.abAmperes = self.abAmpere self.abAmp = self.abAmpere self.aA = self.abAmpere self.statAmpere = self.Biot * 3.335641e-11 # == Biot * (cm/s)/c self.statAmperes = self.statAmpere self.statAmp = self.statAmpere self.statA = self.statAmpere # electrical potential self.Volt = self.Watt/self.Ampere; self.Volts = self.Volt; self.V = self.Volt; self.statVolt = self.erg / (self.statAmp * self.s) self.statVolts = self.statVolt self.statV = self.statVolt self.abVolt = (self.dyne * self.cm) / (self.abAmp * self.s) # electrical resistance self.Ohm = self.Volt/self.Ampere; self.Ohms = self.Ohm; self.statOhm = self.statVolt/self.statAmpere self.abOhm = self.abVolt/self.abAmpere # electrical conductance self.mho = 1.0/self.Ohm; self.mhos = self.mho; self.Siemens = self.mho; self.S = self.Siemens; # electrical charge self.Coulomb = self.Ampere*self.second; self.Coulombs = self.Coulomb; self.C = self.Coulomb; self.statCoulomb = self.statAmpere * self.second self.statCoulombs = self.statCoulomb self.statCoul = self.statCoulomb self.statC = self.statCoulomb self.abCoulomb = self.abAmpere * self.second self.abCoulombs = self.abCoulomb self.abCoul = self.abCoulomb self.Franklin = self.statCoulombs; self.Franklins = self.Franklin; # electrical capacity self.Farad = self.Coulomb/self.Volt; self.Farads = self.Farad; self.F = self.Farad; # magnetic flux self.Weber = self.Volt*self.second; self.Webers = self.Weber; self.Wb = self.Weber; self.Maxwell = self.Weber/100000000.0; self.Maxwells = self.Maxwell; self.M = self.Maxwell; self.statMaxwell = self.statVolt * self.second self.statMaxwells = self.statMaxwell self.statM = self.statMaxwell # magnetic field B self.Tesla = self.Weber/(self.meter*self.meter); self.Teslas = self.Tesla; self.T = self.Tesla; #self.Gauss = self.Tesla/10000.0; self.Gauss = self.abVolt * self.second / self.cm**2 self.gamma = self.Tesla/1000000000.0; # magnetic field H self.Oerstedt = 79.57747*self.Ampere/self.meter; # = Gauss/mu0 self.Oerstedts = self.Oerstedt; self.Oe = self.Oerstedt; # magnetic inductance self.Henry = self.Weber/self.Ampere; self.Henrys = self.Henry; self.H = self.Henry; self.milliHenry = self.Henry/1000.0; self.milliHenrys = self.milliHenry; self.mH = self.milliHenry; # temperature self.Kelvin = Quantity(1,{'K':1}); self.Kelvins = self.Kelvin; self.K = self.Kelvin; self.milliKelvin = self.Kelvin*1e-3; self.mK = self.milliKelvin; self.microKelvin = self.Kelvin*1e-6; self.uK = self.microKelvin; self.nanoKelvin = self.Kelvin*1e-9; self.nK = self.nanoKelvin; # luminous intensity self.candela = Quantity(1,{'candela':1}); self.candelas = self.candela; self.cd = self.candela; self.apostilb = self.candelas/self.meter/self.meter; self.apostilbs = self.apostilb; self.nit = self.apostilb; self.nits = self.nit; self.skot = self.apostilb/1000.0; self.skots = self.skot; self.stilb = 10000.0*self.apostilbs; self.stilbs = self.stilb; self.Blondel = self.apostilb/self.pi; self.Blondels = self.Blondel; self.Lambert = 10000.0*self.Blondels; self.Lamberts = self.Lambert; # light flux self.lumen = self.candela*self.steradian; self.lumens = self.lumen; self.lm = self.lumen; # light intensity self.lux = self.lumens/self.meter/self.meter; self.luxes = self.lux; self.luces = self.lux; self.lx = self.lux; self.nox = self.lux/1000.0; self.phot = self.lumens/self.centimeter/self.centimeter; self.phots = self.phot; # acceleration self.Galileo = self.centimeters/self.second/self.second; self.Galileos = self.Galileo; # standard gravitational acceleration at sea level self.gravity = 9.80665*self.meters/self.second/self.second; # mass self.kilohyl = self.kilogram*self.gravity*self.second*self.second/self.meter; self.kilohyls = self.kilohyl; self.hyl = self.kilohyl/1000.0; self.hyls = self.hyl; # English Units # length self.inch = 0.0254*self.meters; self.inches = self.inch; #self.in = self.inch; self.mil = self.inch/1000.0; self.mils = self.mil; self.point = self.inch/72.27; self.points = self.point; self.pt = self.point; self.bottommeasure = self.inch/40.0; self.bottommeasures = self.bottommeasure; self.line = self.inch/12.0; self.lines = self.line; self.pica = 12.0*self.points; self.picas = self.pica; self.barleycorn = self.inch/3.0; self.barleycorns = self.barleycorn; self.finger = 7.0*self.inches/8.0; self.fingers = self.finger; self.palm = 3.0*self.inches; self.palms = self.palm; self.hand = 4.0*self.inches; self.hands = self.hand; self.link = 7.92*self.inches; self.links = self.link; self.li = self.link; self.span = 9.0*self.inches; self.spans = self.span; self.foot = 12.0*self.inches; self.feet = self.foot; self.ft = self.foot; self.cubit = 18.0*self.inches; self.cubits = self.cubit; self.yard = 3.0*self.feet; self.yards = self.yard; self.yd = self.yard; self.nail = self.yard/16.0; self.nails = self.nail; self.ell = 45.0*self.inches; self.ells = self.ell; self.pace = 5.0*self.feet; self.paces = self.pace; self.fathom = 6.0*self.feet; self.fathoms = self.fathom; self.fm = self.fathom; self.rod = 198.0*self.inches; self.rods = self.rod; self.rd = self.rod; self.pole = self.rod; self.poles = self.pole; self.p = self.pole; self.perch = self.rod; self.perches = self.perch; self.rope = 20.0*self.feet; self.ropes = self.rope; self.bolt = 40.0*self.yards; self.bolts = self.bolt; self.chain = 4.0*self.rods; self.chains = self.chain; self.ch = self.chain; self.skein = 120*self.yards; self.skeins = self.skein; self.furlong = 220*self.yards; self.furlongs = self.furlong; self.spindle = 14400*self.yards; self.spindles = self.spindle; self.statute = statute.statute(prefix + 'unit.', self); self.parasang = 3.5*self.statute.miles; self.parasangs = self.parasang; self.arpentcan = 27.52*self.statute.miles; self.arpentcans = self.arpentcan; self.arpentlin = 191.835*self.feet; self.arpentlins = self.arpentlin; self.astronomical_unit = 1.49597871e11*self.meters; self.astronomical_units = self.astronomical_unit; self.AU = self.astronomical_unit; self.lightyear = 9.4605e15*self.meters; self.lightyears = self.lightyear; self.ly = self.lightyear; self.arc = arc.arc(prefix + 'unit.', self); self.parsec = self.AU*self.radians/self.arc.second; self.parsecs = self.parsec; self.pc = self.parsec; # area self.barn = 1.0e-28*self.meter*self.meter; self.barns = self.barn; self.b = self.barn; self.circular_inch = 0.25*self.pi*self.inch*self.inch; self.circular_inches = self.circular_inch; self.circular_mil = 0.25*self.pi*self.mil*self.mil; self.circular_mils = self.circular_mil; self.sabin = self.foot*self.foot; self.sabins = self.sabin; self.square = 100.0*self.sabin; self.squares = self.square; self.are = 100.0*self.meter*self.meter; self.ares = self.are; self.a = self.are; self.rood = 40.0*self.rod*self.rod; self.roods = self.rood; self.ro = self.rood; self.acre = 4.0*self.roods; self.acres = self.acre; self.section = self.statute.mile*self.statute.mile; self.sections = self.section; self.homestead = self.section/4.0; self.homesteads = self.homestead; self.township = 36.0*self.sections; self.townships = self.township; # mass self.grain = 0.06479891*self.grams; self.grains = self.grain; self.gr = self.grain; self.pennyweight = 24.0*self.grains; self.dwt = self.pennyweight; # volume self.minim = 6.161152e-8*(self.m*self.m*self.m); self.minims = self.minim; self.drop = 0.03*self.cc; self.drops = self.drop; self.teaspoon = 4.928922*self.cc; self.teaspoons = self.teaspoon; self.tablespoon = 3.0*self.teaspoons; self.tablespoons = self.tablespoon; self.avoirdupois = avoirdupois.avoirdupois(prefix + 'unit.', self); self.avdp = self.avoirdupois self.av = self.avoirdupois self.US = US.US(prefix + 'unit.', self); self.noggin = 2.0*self.US.liquid.ounces; self.noggins = self.noggin; self.cup = 8.0*self.US.liquid.ounces; self.cups = self.cup; self.fifth = self.US.liquid.gallon/5.0; self.fifths = self.fifth; self.jeroboam = 4.0*self.fifths; self.jeroboams = self.jeroboam; self.firkin = 9.0*self.US.liquid.gallons; self.firkins = self.firkin; self.kilderkin = 18.0*self.US.liquid.gallons; self.kilderkins = self.kilderkin; self.strike = 2.0*self.US.bushels; self.strikes = self.strike; self.sack = 3.0*self.US.bushels; self.sacks = self.sack; self.coomb = 4.0*self.US.bushels; self.coombs = self.coomb; self.seam = 8.0*self.US.bushels; self.seams = self.seam; self.wey = 40.0*self.US.bushels; self.weys = self.wey; self.last = 80.0*self.US.bushels; self.lasts = self.last; self.register_ton = 100.0*(self.ft*self.ft*self.ft); self.register_tons = self.register_ton; self.register_tn = self.register_ton; self.cord = 128.0*(self.ft*self.ft*self.ft); self.cords = self.cord; self.cordfoot = self.cord; self.cordfeet = self.cordfoot; self.boardfoot = 144.0*self.inch*self.inch*self.inch; self.boardfeet = self.boardfoot; self.timberfoot = self.foot*self.foot*self.foot; self.timberfeet = self.timberfoot; self.hogshead = 2.0*self.US.barrels; self.hogsheads = self.hogshead; self.pipe = 4.0*self.US.barrels; self.pipes = self.pipe; self.tun = 8.0*self.US.barrels; self.tuns = self.tun; self.stone = 14.0*self.avoirdupois.pounds; self.stones = self.stone; self.st = self.stone; self.crith = 0.0906*self.grams; self.criths = self.crith; self.bag = 94.0*self.avoirdupois.pounds; self.bags = self.bag; self.cental = 100.0*self.avoirdupois.pounds; self.centals = self.cental; self.weymass = 252.0*self.avoirdupois.pounds; # rate self.mgd = 1000000.0*self.US.liquid.gallons/self.day; self.cfs = self.foot*self.foot*self.foot/self.second; self.minersinch = 1.5*self.foot*self.foot*self.foot/self.minute; self.mpg = self.statute.miles/self.US.liquid.gallon; self.nautical = nautical.nautical(prefix + 'unit.', self); # speed self.mph = self.statute.miles/self.hour; self.knot = self.nautical.miles/self.hour; self.knots = self.knot; # force self.poundal = self.avdp.pound*self.foot/(self.second*self.second); self.poundals = self.poundal; self.pdl = self.poundal; self.lbf = self.avoirdupois.pound*self.gravity; # pressure self.psi = self.lbf/(self.inch*self.inch); # energy self.calorie = 4.1868*self.Joules; self.calories = self.calorie; self.cal = self.calorie; self.kilocalorie = 1000.0*self.calories; self.kilocalories = self.kilocalorie; self.kcal = self.kilocalorie; self.Frigorie = self.kilocalorie; self.Frigories = self.Frigorie; self.Btu = 1055.06*self.Joules; self.therm = 10000.0*self.Btu; self.therms = self.therm; self.thermie = 1000000.0*self.calories; self.thermies = self.thermie; # power self.horsepower = 735.49875*self.Watts; self.HP = self.horsepower; # electrical current self.Gilbert = 0.795775*self.Amperes; self.Gilberts = self.Gilbert; # temperature self.Rankin = 1.8*self.Kelvins; self.Rankins = self.Rankin; self.R= self.Rankin; # luminous intensity self.candle = 1.02*self.candelas; self.candles = self.candle; # light intensity self.foot_candle = self.lumens/self.foot/self.foot; self.foot_candles = self.foot_candle; self.fc = self.foot_candle; self.foot_Lambert = self.candelas/self.foot/self.foot/self.pi; self.foot_Lamberts = self.foot_Lambert; # and now load all of the sub-modules that don't have # interdependencies with other unit stuff. self.admiralty = admiralty.admiralty(prefix + 'unit.', self); self.apothecary = apothecary.apothecary(prefix + 'unit.', self); self.bakers = bakers.bakers(prefix + 'unit.', self); self.British = British.British(prefix + 'unit.', self); self.displacement = displacement.displacement(prefix + 'unit.', self); self.dose = dose.dose(prefix + 'unit.', self); self.engineers = engineers.engineers(prefix + 'unit.', self); self.equivalent = equivalent.equivalent(prefix + 'unit.', self); self.geodetic = geodetic.geodetic(prefix + 'unit.', self); self.geographical = geographical.geographical(prefix + 'unit.', self); self.Gunters = Gunters.Gunters(prefix + 'unit.', self); self.Hefner = Hefner.Hefner(prefix + 'unit.', self); self.metric = metric.metric(prefix + 'unit.', self); # #### END OF UNIT CREATION #### # # do some trickery to get modules set to instantiated classes # We expect each submodule to do likewise for those not already taken # care of here. self.admiralty.__name__ = admiralty.__name__ sys.modules[admiralty.__name__] = self.admiralty self.apothecary.__name__ = apothecary.__name__ sys.modules[apothecary.__name__] = self.apothecary sys.modules[ap.__name__] = self.apothecary sys.modules[troy.__name__] = self.apothecary sys.modules[t.__name__] = self.apothecary self.arc.__name__ = arc.__name__ sys.modules[arc.__name__] = self.arc self.avoirdupois.__name__ = avoirdupois.__name__ sys.modules[avoirdupois.__name__] = self.avoirdupois # fix dummies for avoirdupois sys.modules[avdp.__name__] = self.avoirdupois sys.modules[av.__name__] = self.avoirdupois self.bakers.__name__ = bakers.__name__ sys.modules[bakers.__name__] = self.bakers self.British.__name__ = British.__name__ sys.modules[British.__name__] = self.British sys.modules[English.__name__] = self.British sys.modules[Imperial.__name__] = self.British self.displacement.__name__ = displacement.__name__ sys.modules[displacement.__name__] = self.displacement self.dose.__name__ = dose.__name__ sys.modules[dose.__name__] = self.dose self.engineers.__name__ = engineers.__name__ sys.modules[engineers.__name__] = self.engineers self.equivalent.__name__ = equivalent.__name__ sys.modules[equivalent.__name__] = self.equivalent self.geodetic.__name__ = geodetic.__name__ sys.modules[geodetic.__name__] = self.geodetic self.geographical.__name__ = geographical.__name__ sys.modules[geographical.__name__] = self.geographical self.Gunters.__name__ = Gunters.__name__ sys.modules[Gunters.__name__] = self.Gunters self.Hefner.__name__ = Hefner.__name__ sys.modules[Hefner.__name__] = self.Hefner self.metric.__name__ = metric.__name__ sys.modules[metric.__name__] = self.metric self.nautical.__name__ = nautical.__name__ sys.modules[nautical.__name__] = self.nautical sys.modules[marine.__name__] = self.nautical self.statute.__name__ = statute.__name__ sys.modules[statute.__name__] = self.statute self.US.__name__ = US.__name__ sys.modules[US.__name__] = self.US
def __init__(self,prefix,unit): const.__init__(self,prefix + 'geographical') self.mile = unit.nautical.mile; self.miles = self.mile; self.mi = self.mile;
def __init__(self,prefix,unit): const.__init__(self,prefix + 'geodetic') self.foot = (1200.0/3937.0)*unit.meters; self.feet = self.foot; self.ft = self.foot;