units#

scaling_factor(Q_rescale, Q_compare)[source]#

Computes the scaling factor to multiply a quantity with, if it is to be expressed in units of another quantity.

Arguments

Q_rescale:

The quantity instance or unit-string that is to be rescaled.

Q_compare:

The quantity instance or unit-string whose units are desired.

Returns

Factor by which Q_rescale is to be multiplied with, if expressed in units of Q_compare

scaling_factor_du(Q_rescale, default_units)[source]#

Computes the scaling factor to multiply a quantity with, if it is to be expressed in the default units provided.

Arguments

Q_rescale:

The quantity instance or unit-string that is to be rescaled.

default_units:

The default units as dictionary, e.g.: {‘length’: ‘m’, ‘mass’: ‘kg’, ‘time’: ‘s’}

Returns

Factor by which Q_rescale is to be multiplied with, if expressed in the default units.