The ValueType class (in parametrics.py module) should inherit the UnitRegistry behavior from pint and astropy and still be a subclass of ModelElement. ValueType can be implemented as either a decorated class or subclass that inherits from both UnitRegistry objects/classes.
e.g.,
>>> kesselrun = 12*ValueType('parsecs')
>>> kesselrun
<ValueType(12, 'parsec')>
>>> kesselrun.magnitude
12
>>> str(kesselrun.units)
'parsec'
>>> kesselrun.to('lightyear')
<ValueType(39.138799173399406, 'light_year')>
>>> 2*kesselrun
<ValueType(24, 'parsec')>
>>> type(kesselrun)
ValueType
>>> isinstance(kesselrun, ModelElement)
True
Additional unit tests welcome.
The
ValueTypeclass (inparametrics.pymodule) should inherit theUnitRegistrybehavior from pint and astropy and still be a subclass ofModelElement.ValueTypecan be implemented as either a decorated class or subclass that inherits from bothUnitRegistryobjects/classes.e.g.,
Additional unit tests welcome.