From f4a875baeeca7b7e558fdd8541bfa25d5e5e8eb0 Mon Sep 17 00:00:00 2001 From: Corran Webster Date: Fri, 2 Jul 2021 08:58:38 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Add=20alternate=20names=20with=20`=C2=B5`?= =?UTF-8?q?=20for=20micro=20instead=20of=20`u`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This keeps the old names around, so no code should break. --- scimath/units/electromagnetism.py | 4 ++-- scimath/units/geo_units.py | 4 ++-- scimath/units/time.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scimath/units/electromagnetism.py b/scimath/units/electromagnetism.py index 4cc1913..318301e 100644 --- a/scimath/units/electromagnetism.py +++ b/scimath/units/electromagnetism.py @@ -57,8 +57,8 @@ ############################################################################### micro_farad = micro * farad -micro_farad.label = 'uf' -mf = micro_farad +micro_farad.label = 'µf' +µf = uf = micro_farad pico_farad = pico * farad pico_farad.label = 'pf' diff --git a/scimath/units/geo_units.py b/scimath/units/geo_units.py index f80755d..e55a04f 100644 --- a/scimath/units/geo_units.py +++ b/scimath/units/geo_units.py @@ -93,5 +93,5 @@ ############################################################################### # psonic ############################################################################### -us_per_ft = microsecond / foot -us_per_ft.label = 'us/ft' +µs_per_ft = us_per_ft = microsecond / foot +µs_per_ft.label = 'µs/ft' diff --git a/scimath/units/time.py b/scimath/units/time.py index e53dddd..d94cd75 100644 --- a/scimath/units/time.py +++ b/scimath/units/time.py @@ -59,7 +59,7 @@ s = sec = second ps = picosecond ns = nanosecond -us = usec = microsecond +µs = µsec = us = usec = microsecond ms = msec = millisecond # plural aliases From 250d3d4657663c38a415721a793c5dd988f6ba02 Mon Sep 17 00:00:00 2001 From: Corran Webster Date: Fri, 2 Jul 2021 09:06:45 +0100 Subject: [PATCH 2/3] =?UTF-8?q?Add=20`=C2=B5m`=20for=20`micrometer`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scimath/units/length.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scimath/units/length.py b/scimath/units/length.py index 3ec74b0..5aed34e 100644 --- a/scimath/units/length.py +++ b/scimath/units/length.py @@ -71,7 +71,7 @@ m = meter nm = nanometer -um = micrometer +µm = um = micrometer micron = micrometer mm = millimeter cm = centimeter From 1381977a4d4a4e1561fd9bd9d3e68814651c7d90 Mon Sep 17 00:00:00 2001 From: Corran Webster Date: Tue, 16 Aug 2022 10:25:49 +0100 Subject: [PATCH 3/3] Test parsing MICRO SIGN and GREEK SMALL LETTER MU; fix other tests. --- scimath/units/tests/test_units.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scimath/units/tests/test_units.py b/scimath/units/tests/test_units.py index 7f26cd7..c313dd6 100644 --- a/scimath/units/tests/test_units.py +++ b/scimath/units/tests/test_units.py @@ -256,12 +256,18 @@ def test_unit_parser_non_python(self): angle.grad, angle.minutes, acceleration.m_per_s2, - electromagnetism.mf, + electromagnetism.uf, volume.cm3, ] for u in odd_units: self.assertEqual(parse(u.label), u) + def test_unit_parser_micro_sign(self): + parse = lambda s: unit_parser.parse_unit(s, suppress_unknown=False) + micrometer_symbols = ["\N{MICRO SIGN}m", "\N{GREEK SMALL LETTER MU}m"] + for symbol in micrometer_symbols: + self.assertEqual(parse(symbol), length.µm) + def test_unit_parser_offsets(self): parse = lambda s: unit_parser.parse_unit(s, suppress_unknown=False) offset_units = [