physpyx.quantity

Module Contents

Classes

AltDict

SiunitxQuantity

SiunitxUnitRegistry

Constants

Data

logger

API

physpyx.quantity.logger

“getLogger(…)”

class physpyx.quantity.AltDict

Bases: typing.TypedDict

fmt: str

None

base: bool

None

preferred: bool

None

compact: bool

None

to: str

None

alt: physpyx.quantity.AltDict

None

class physpyx.quantity.SiunitxQuantity

Bases: pint.registry.Quantity

__new__(value: pint._typing.Magnitude, units: pint._typing.UnitLike | None = None, fmt: str = 'g', base: bool = False, compact: bool = False, preferred: bool = True, alt: physpyx.quantity.AltDict | bool = False) physpyx.quantity.SiunitxQuantity

Return an instance of SiunitxQuantity

Paramètres:
  • value – defines the magnitudes of the quantity

  • unit – Assigns the unit if any.

  • fmt – Sets the amplitude « f-string » format.

  • base – If true, converts the unit into SI units.

  • compact – As described in the Pint documentation « returns a rescaled to compact, human-readable units ».

  • preferred – If true, attempts to convert units into preferred ones. For instance (kg.m/s2 will be converted to N). Note that, this defaults to « True » which means that all SiunitxQuantity resulting from mathematical operations, will be converted.

  • alt – If provided, writes an additional alternative output with different formatting. The string “_alt” is added to the base name.

__str__() str
__neg__() physpyx.quantity.SiunitxQuantity
export(name: str) Generator[tuple[str, str], None, None]
fmtex(*, to: str | None = None, fmt: str | None = None, base: bool | None = None, compact: bool | None = None, preferred: bool | None = None, alt: physpyx.quantity.AltDict | bool = False) physpyx.quantity.SiunitxQuantity
norm() physpyx.quantity.SiunitxQuantity
unit_vector() physpyx.quantity.SiunitxQuantity
cross(other: object) physpyx.quantity.SiunitxQuantity
class physpyx.quantity.SiunitxUnitRegistry(system: str | None = None, **kwargs)

Bases: pint.registry.GenericUnitRegistry

Quantity: type

None

Unit: type

None

class physpyx.quantity.Constants(fname: pathlib.Path | None)

Initialization

__call__(name: str, fmt: str) tuple[float, str, str]