Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scimath/units/angle.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

radian.label = 'rad'
radians = radian
rad = radian

grad = degree * 0.9
grad.label = '^g'
Expand All @@ -56,6 +57,7 @@
revolution = 360 * degree
revolution.label = 'r'
revolutions = revolution
rev = revolution
circle = revolution
circles = circle
turn = circle
Expand Down
4 changes: 4 additions & 0 deletions scimath/units/area.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
# fourth edition, John Willey and Sons, 1993

square_meter = meter**2
square_meter.label = 'm2'
square_centimeter = centimeter**2
square_centimeter.label = 'cm2'

square_foot = foot**2
square_inch = inch**2
Expand All @@ -35,6 +37,8 @@
b = barn
bn = barn
barns = barn
m2 = square_meter
cm2 = square_centimeter

# version
__id__ = "$Id: area.py,v 1.1.1.1 2003/07/02 21:39:14 aivazis Exp $"
Expand Down
28 changes: 26 additions & 2 deletions scimath/units/electromagnetism.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@
from copy import copy

from scimath.units.SI import ampere, coulomb, farad, henry, joule, ohm, \
meter, micro, milli, pico, siemens, tesla, volt, watt, weber
meter, micro, milli, pico, siemens, tesla, volt, watt, weber, kilo

###############################################################################
# electric charge
###############################################################################

C = coulomb

###############################################################################
# electric current
###############################################################################

A = ampere
amp = ampere
amps = ampere
amperes = ampere
Expand All @@ -24,18 +31,27 @@

volts = volt
v = volt
V = volt

millivolt = milli * volt
millivolt.label = 'mV'
millivolt.label = 'mv'
milli_volt = millivolt
mv = millivolt
mV = millivolt
millivolts = millivolt

kilovolt = kilo * volt
kilovolt.label = 'kv'
kv = kilovolt
kV = kilovolt

###############################################################################
# resistivity
###############################################################################

ohms = ohm
Ohm = ohm
Ohms = ohms
ohmm = ohm * meter
ohmm.label = 'ohmm'
ohm_m = ohmm
Expand All @@ -47,19 +63,24 @@
# capacitance
###############################################################################

F = farad

micro_farad = micro * farad
micro_farad.label = 'uf'
mf = micro_farad
mF = micro_farad

pico_farad = pico * farad
pico_farad.label = 'pf'
pf = pico_farad
pF = pico_farad

###############################################################################
# conductivity
###############################################################################

siemen = siemens
S = siemens
mSiemens = milli * siemens
mSiemens.label = 'mS'
mSiemen = mSiemens
Expand All @@ -80,15 +101,18 @@
###############################################################################

henrys = henry
H = henry

###############################################################################
# Magnetic Flux
###############################################################################

webers = weber
Wb = weber

###############################################################################
# Magnetic Field
###############################################################################

teslas = tesla
T = tesla
33 changes: 28 additions & 5 deletions scimath/units/energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#

from __future__ import absolute_import
from .SI import joule, kilo, mega, giga
from .SI import joule, kilo, mega, giga, tera, milli


#
Expand All @@ -35,24 +35,47 @@

calorie = 4.1858 * joule
Calorie = 1000 * calorie
kilowatt_hour = 3.6e6 * joule
watt_hour = 3.6e3 * joule

electron_volt = 1.60218e-19 * joule


# aliases

J = joule
kJ = kilo * joule
MJ = mega * joule
millijoule = milli * joule
kilojoule = kilo * joule
megajoule = mega * joule
gigajoule = giga * joule
terajoule = tera * joule

mJ = millijoule
kJ = kilojoule
MJ = megajoule
GJ = gigajoule
TJ = terajoule

eV = electron_volt
KeV = kilo * eV
MeV = mega * eV
GeV = giga * eV

cal = calorie
kcal = kilo * calorie
kilocalorie = kilo * calorie
kcal = kilocalorie

watt_second = joule
kilowatt_hour = kilo * watt_hour
megawatt_hour = mega * watt_hour
gigawatt_hour = giga * watt_hour
terawatt_hour = tera * watt_hour

Ws = watt_second
Wh = watt_hour
kWh = kilowatt_hour
MWh = megawatt_hour
GWh = gigawatt_hour
TWh = terawatt_hour


# version
Expand Down
9 changes: 8 additions & 1 deletion scimath/units/force.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@
from __future__ import absolute_import
from copy import copy

from .SI import newton
from .SI import newton, milli, kilo, mega

N = newton
millinewton = milli * newton
kilonewton = kilo * newton
meganewton = mega * newton

mN = millinewton
kN = kilonewton
MN = meganewton

lbf = 4.44822 * newton
lbf.label = 'lbf'
Expand Down
11 changes: 9 additions & 2 deletions scimath/units/frequency.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
# Date: 05/22/2005
# Description: Define units of frequency
#
# Symbols defined: hz, khz
# Symbols defined: hz, khz, kHz, MHz, GHz
#
#------------------------------------------------------------------------------

#############################################################################
# Imports:
#############################################################################
from __future__ import absolute_import
from .SI import hertz, kilo
from .SI import hertz, kilo, mega, giga
from .time import minute

#############################################################################
Expand All @@ -30,6 +30,10 @@
hertz.label = 'Hz'
kilohertz = kilo * hertz
kilohertz.label = 'kHz'
megahertz = mega * hertz
megahertz.label = 'MHz'
gigahertz = giga * hertz
gigahertz.label = 'GHz'

rpm = 1 / minute
rpm.label = 'rpm'
Expand All @@ -42,5 +46,8 @@
hz = hertz
Hz = hertz
khz = kilohertz
kHz = kilohertz
MHz = megahertz
GHz = gigahertz

#### EOF ######################################################################
21 changes: 19 additions & 2 deletions scimath/units/power.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,34 @@
#

from __future__ import absolute_import
from .SI import watt, kilo
from .SI import watt, kilo, mega, giga, tera, milli

#
# Definitions of common power units
# Data taken from Appendix F of Halliday, Resnick, Walker, "Fundamentals of Physics",
# fourth edition, John Willey and Sons, 1993

milliwatt = milli * watt
milliwatt.label = 'mW'
kilowatt = kilo * watt
kw = kilowatt
kilowatt.label = 'kW'
megawatt = mega * watt
megawatt.label = 'MW'
gigawatt = giga * watt
gigawatt.label = 'GW'
terawatt = tera * watt
terawatt.label = 'TW'
horsepower = 745.7 * watt

# aliases

mW = milliwatt
W = watt
kW = kilowatt
MW = megawatt
GW = gigawatt
TW = terawatt


# version
__id__ = "$Id: power.py,v 1.1.1.1 2003/07/02 21:39:14 aivazis Exp $"
Expand Down
30 changes: 20 additions & 10 deletions scimath/units/pressure.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#

from __future__ import absolute_import
from .SI import pascal, kilo, mega, giga
from .SI import pascal, hecto, kilo, mega, giga
from scimath.units.force import lbf
from scimath.units.length import inch
from scimath.units.unit import unit
Expand All @@ -29,21 +29,27 @@


# aliases

pascal.label = 'Pa'
Pa = pascal
Pa.label = 'Pa'

kPa = kilo * pascal
kPa.label = 'kPa'
hectopascal = hecto * pascal
hectopascal.label = 'hPa'
hPa = hectopascal

kilopascal = kilo * pascal
kilopascal.label = 'kPa'
kPa = kilopascal

MPa = mega * pascal
MPa.label = 'MPa'
megapascal = mega * pascal
megapascal.label = 'MPa'
MPa = megapascal
mpa = MPa
Mpa = MPa
MPA = MPa

GPa = giga * pascal
GPa.label = 'GPa'
gigapascal = giga * pascal
gigapascal.label = 'GPa'
GPa = gigapascal
gpa = GPa
Gpa = GPa
GPA = GPa
Expand All @@ -61,10 +67,14 @@
kbars = kbar

millibar = 100 * pascal
millibar.label = 'mbar'
mbar = millibar

torr = 133.3 * pascal
atmosphere = 101325 * pascal
torr.label = 'torr'

atmosphere = 101325 * pascal
atmosphere.label = 'atm'
atm = atmosphere

pounds_per_square_inch = lbf / inch ** 2
Expand Down
16 changes: 15 additions & 1 deletion scimath/units/speed.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
#############################################################################

from __future__ import absolute_import
from .time import hour, second, millisecond
from .time import hour, minute, second, millisecond
from .length import foot, kilometer, meter, nautical_mile, mile
from .angle import radian, revolution

#############################################################################
# Definitions:
Expand All @@ -47,9 +48,22 @@
meters_per_millisecond.label = 'm/msec'
kilometers_per_second = kilometer / second
kilometers_per_second.label = 'km/s'
kilometers_per_hour = kilometer / hour
kilometers_per_hour.label = 'km/h'
miles_per_hour = mile / hour
miles_per_hour.label = 'mph'

# angular speeds
radians_per_second = radian / second
radians_per_second.label = 'rad/s'
radians_per_minute = radian / minute
radians_per_minute.label = 'rad/min'
revolutions_per_second = revolution / second
revolutions_per_second.label = 'rev/s'
revolutions_per_minute = revolution / minute
revolutions_per_minute.label = 'rev/min'
rpm = revolutions_per_minute

#############################################################################
# Aliases:
#############################################################################
Expand Down
3 changes: 3 additions & 0 deletions scimath/units/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@
milliseconds = millisecond

minutes = minute
min = minute
hours = hour
h = hour
days = day
d = day
weeks = week
years = year

Expand Down
Loading