sunpeek.common.unit_uncertainty#

Collection of utility functions for handling unit and uncertainty within HarvestIT.

Functions

assert_compatible(uQ1, uQ2)

Asserts if 2 unit strings and/or pint Quantities are compatible in units.

check_quantity(q[, unit, min_limit, ...])

Check that q is a valid pint Quantity object.

parse_quantity(value)

to_dict(q)

"Return dictionary with keys ['magnitude', 'units'], parsable by parse_quantity.

to_numpy(s[, unit_str])

Return the unit-aware pd.Series s to a numpy array after converting it to unit_str.

to_pint(s[, unit, absolute_uncertainty, ...])

Converts pandas Series s to a pint Quantity object, holding unit and uncertainty.

to_s(num_arr_or_q[, unit_str])

Return the input numeric array converted to pd.Series with dtype pint[unit_str].