Skip to content

Commit 717c389

Browse files
committed
updated information, substance and temperature
1 parent 7957b7d commit 717c389

File tree

3 files changed

+60
-22
lines changed

3 files changed

+60
-22
lines changed

quantities/units/information.py

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,36 @@
11
"""
22
"""
33

4-
from quantities.units.unitquantity import UnitQuantity, UnitInformation
4+
from quantities.units.unitquantity import UnitQuantity, UnitInformation, \
5+
dimensionless
56
from quantities.units.time import s
67

7-
bit = bits = \
8-
UnitInformation('bit')
9-
count = counts = \
10-
UnitInformation('counts')
11-
Bd = baud = \
12-
UnitQuantity('Bd', 1/s)
13-
bps = \
14-
UnitQuantity('bps', bit/s)
15-
cps = \
16-
UnitQuantity('cps', 1/s)
8+
bit = UnitInformation(
9+
'bit',
10+
1*dimensionless,
11+
aliases=['bits']
12+
)
13+
B = byte = o = octet = UnitInformation(
14+
'byte',
15+
8*bit,
16+
symbol='B',
17+
aliases=['bytes', 'o', 'octet', 'octets']
18+
)
19+
count = counts = UnitInformation(
20+
'count',
21+
1*dimensionless,
22+
symbol='ct',
23+
aliases=['cts', 'counts']
24+
)
1725

18-
del UnitQuantity, s
26+
Bd = baud = bps = UnitQuantity(
27+
'baud',
28+
bit/s,
29+
symbol='Bd',
30+
)
31+
cps = UnitQuantity(
32+
'counts_per_second',
33+
count/s
34+
)
35+
36+
del UnitQuantity, s, dimensionless

quantities/units/substance.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33

44
from quantities.units.unitquantity import UnitSubstance
55

6-
mol = mole = \
7-
UnitSubstance('mol')
6+
mol = mole = UnitSubstance(
7+
'mole',
8+
symbol='mol'
9+
)

quantities/units/temperature.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
1+
# -*- coding: utf-8 -*-
12
"""
23
"""
34

45
from quantities.units.unitquantity import UnitTemperature
56

6-
K = degK = kelvin = Kelvin = \
7-
UnitTemperature('K')
8-
degR = rankine = Rankine = \
9-
UnitTemperature('Rankine', K/1.8)
10-
degC = celsius = Celsius = \
11-
UnitTemperature('degC', K)
12-
degF = fahrenheit = Fahrenheit = \
13-
UnitTemperature('degF', degR)
7+
K = degK = kelvin = Kelvin = UnitTemperature(
8+
'Kelvin',
9+
symbol='K',
10+
aliases=['degK', 'kelvin']
11+
)
12+
degR = rankine = Rankine = UnitTemperature(
13+
'Rankine',
14+
K/1.8,
15+
symbol='°R',
16+
aliases=['degR', 'rankine']
17+
)
18+
degC = celsius = Celsius = UnitTemperature(
19+
'Celsius',
20+
K,
21+
symbol='°C',
22+
aliases=['degC', 'celsius']
23+
)
24+
degF = fahrenheit = Fahrenheit = UnitTemperature(
25+
'Fahrenheit',
26+
K,
27+
symbol='°F',
28+
aliases=['degF', 'fahrenheit']
29+
)
30+
# Unicode has special compatibility characters for ℃ ℉, but their use is
31+
# discouraged by the unicode consortium.

0 commit comments

Comments
 (0)