Skip to content

Commit

Permalink
ScalarQuantity now converts strings to floats (#934)
Browse files Browse the repository at this point in the history
i.e. ```"2" | units.m``` is now equally valid as ```2 | units.m```.
  • Loading branch information
rieder committed Mar 7, 2023
1 parent 1edc358 commit 610ffe8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/amuse/units/quantities.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ def __init__(self, number, unit):
# Quantity.__init__(self, unit)
# commented out super call, this speeds thing up
self.unit = unit
if isinstance(number, str):
number = float(number)
if unit.dtype is None:
self.number = number
else:
Expand Down

0 comments on commit 610ffe8

Please sign in to comment.