QFloat#

class astropop.math.physical.QFloat(value, uncertainty=None, unit=None)#

Bases: object

Storing float values with stddev uncertainties and units.

Parameters:
valuenumber, QFloat or array_like

Nominal value(s) of the quantity. Must be a real number, array of real numbers or a QFloat.

uncertaintynumber, array_like or None (optional)

Uncertainty value of the quantity. If None, the quantity will be considered with no errors. Must match value shape.

unitUnit or string (optional)

The data unit. Must be Unit compliant.

Notes

  • This class don’t support memmapping. Is intended to be in memory ops.

  • Units are handled by units.

  • Math operations cares about units and uncertainties.

Attributes Summary

nominal

Nominal value of the quantity.

shape

Shape of the quantity.

sig_digits

Number of significant digits.

size

Number of elements in the quantity.

std_dev

Alias for uncertainty.

uncertainty

Uncertainty of the quantity.

unit

Physical unit of the data.

value

Same as nominal.

Methods Summary

reset(value[, uncertainty, unit])

Reset all the data.

to(unit)

Convert this QFloat to another unit.

Attributes Documentation

nominal#

Nominal value of the quantity.

shape#

Shape of the quantity.

sig_digits#

Number of significant digits.

size#

Number of elements in the quantity.

std_dev#

Alias for uncertainty.

uncertainty#

Uncertainty of the quantity.

unit#

Physical unit of the data.

value#

Same as nominal. For Astropy compatibility.

Methods Documentation

reset(value, uncertainty=None, unit=None)#

Reset all the data.

Parameters:
valuenumber or array_like

Nominal value(s) of the quantity.

uncertaintynumber, array_like or None (optional)

Uncertainty value of the quantity. If None, the quantity will be considered with no errors. Must match value shape.

unitUnit or string (optional)

The data unit. Must be Unit compliant.

to(unit)#

Convert this QFloat to another unit.

Parameters:
- unit: string or `~astropy.units.UnitBase`

Unit to converto to.

Returns:
  • QFloat:

    A new instance of this class, converted to the new unit.