Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tomotools
tomoscan
Commits
a571caa2
Commit
a571caa2
authored
Feb 03, 2021
by
payno
Browse files
[MetricSystem] add __str__ function
parent
f30087b6
Pipeline
#41116
passed with stages
in 19 minutes and 12 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tomoscan/unitsystem/metricsystem.py
View file @
a571caa2
...
...
@@ -124,6 +124,28 @@ class MetricSystem(_Enum):
else
:
raise
ValueError
(
"Cannot convert: %s"
%
value
)
def
__str__
(
self
):
if
self
==
MetricSystem
.
METER
:
return
"m"
elif
self
==
MetricSystem
.
CENTIMETER
:
return
"cm"
elif
self
==
MetricSystem
.
MILLIMETER
:
return
"mm"
elif
self
==
MetricSystem
.
MICROMETER
:
return
"um"
elif
self
==
MetricSystem
.
NANOMETER
:
return
"nm"
elif
self
==
MetricSystem
.
KILOELECTRONVOLT
:
return
"keV"
elif
self
==
MetricSystem
.
ELECTRONVOLT
:
return
"eV"
elif
self
==
MetricSystem
.
JOULE
:
return
"J"
elif
self
==
MetricSystem
.
KILOJOULE
:
return
"kJ"
else
:
raise
ValueError
(
"Cannot convert: %s"
%
value
)
m
=
MetricSystem
.
METER
meter
=
MetricSystem
.
METER
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment