physpyx.qty
Module Contents
Classes
This class should be used as a context manager. |
Data
API
- physpyx.qty.logger
“getLogger(…)”
- class physpyx.qty.Qty(fname: str, context: str = '')
Bases:
physpyx.manager.PTManagerThis class should be used as a context manager.
Initialization
- Paramètres:
fname – name of the « .pyx » file saved on exit
context –
Pintfeature that allows unit conversion. For Instance, if the parameter is set to « energy », it will be possible to convert mass to energy and vice-versa.
- __call__(value: pint._typing.Scalar | list[pint._typing.Scalar] | str, unit: str | None = None, to: str | None = None, fmt: str = 'g', base: bool = False, compact: bool = False, preferred: bool = False, alt: physpyx.quantity.AltDict | bool = False) physpyx.quantity.SiunitxQuantity
Return an instance of SiunitxQuantity
- Paramètres:
value –
Behaves differently according to its type:
Scalar: defines the magnitude of a scalar quantity
list[Scalar]: defines the magnitudes of a numpy.NDArray quantity
str: look for a constant whose name matches value
unit – Assigns the unit if any (ignored for constants).
to – Immediately converts unit.
fmt – Sets the « f-string » format of the magnitude.
base – If true, converts the unit into SI units.
compact – As described in the
Pintdocumentation « returns a rescaled, human-readable unit ».preferred – If true, attempts to convert unit into simpler one. For instance (kg.m/s2 will be converted to N). Note that, this defaults to « False » only here.
alt – If provided, writes an additional alternative output with different formatting. The string “_alt” is added to the base name.