Closed lmmentel closed 1 month ago
Units from Isotope.half_life_unit are not standardize and therefore are incorrectly parsed when using tools like pint.
Isotope.half_life_unit
pint
Steps to reproduce the behavior:
from pint import UnitRegistry from mendeleev.db import get_session, get_engine from mendeleev.models import Isotope ureg = UnitRegistry() session.query(Isotope.half_life_unit).distinct().all() session = get_session() session.query(Isotope.half_life_unit).distinct().all() units = session.query(Isotope.half_life_unit).distinct().all() for unit in [u for u, in units]: try: print(unit, ureg(unit)) except: print(f"Coundn't parse:' {unit}'") None 1 dimensionless Coundn't parse:' y' ys 1 yoctosecond ms 1 millisecond zs 1 zeptosecond d 1 day as 1 attosecond Coundn't parse:' My' s 1 second m 1 meter Coundn't parse:' ky' ps 1 picosecond h 1 hour Gy 1 gray Coundn't parse:' Ey' Coundn't parse:' Py' ns 1 nanosecond us 1 microsecond Coundn't parse:' Zy' Coundn't parse:' Ty' Coundn't parse:' Yy'
Units should be compatible with the unit registry from pint.
Describe the bug
Units from
Isotope.half_life_unit
are not standardize and therefore are incorrectly parsed when using tools likepint
.To Reproduce
Steps to reproduce the behavior:
pint
Expected behavior
Units should be compatible with the unit registry from pint.
Specification