vrtulka23/scinumtools

Numerical quantity check

vrtulka23 opened this issue · 1 comments

Implement a quick check if dimensions are zero to substitute

assert unit1.baseunits.dimensions != Dimensions()

with e.g.:

assert unit1.baseunits.dimensionless

Quantities, BaseUnits and Dimensions can be directly checked if they have some base or dimensions using following:

>>> q = Quantity(1,'cm/s')
>>> q.baseunits.nodim      # check if all dimensions are zero
False
>>> q.baseunits.dimensions.nodim 
False
>>> q.baseunits.nobase    # check if there are no base units (also dimensionless)
False