Quantities and Units
The Quantity module provides two classes to work with quantities and units.
Attributes
quantities
module-attribute
quantities = {
"pressure": (
"Pressure",
"pascal",
True,
"p",
"$p$",
REFERENCE_PRESSURE,
)
}
Dictionary with quantities. Each quantity is stored as a tuple.
units
module-attribute
Dictionary with units. Each unit is stored as a tuple.
Classes
Unit
Unit of quantity.
Note
Perhaps inherit from tuple or collections.namedtuple?
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Name of the unit.
TYPE:
|
symbol
|
Symbol of the unit.
TYPE:
|
symbol_latex
|
Symbol of the unit in LaTeX.
TYPE:
|
Source code in acoustic_toolbox/quantity.py
Quantity
Quantity(
name: str,
unit: Unit,
dynamic: bool,
symbol: str | None = None,
symbol_latex: str | None = None,
reference: float = 1.0,
)
Quantity.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Name of the quantity.
TYPE:
|
unit
|
Unit of the quantity.
TYPE:
|
dynamic
|
Dynamic quantity (
TYPE:
|
symbol
|
Symbol of the quantity.
TYPE:
|
symbol_latex
|
Symbol of the quantity in LaTeX.
TYPE:
|
reference
|
Reference value of the quantity.
TYPE:
|
Source code in acoustic_toolbox/quantity.py
Attributes
Functions
Functions
get_quantity
Get quantity by name. Returns instance of Quantity.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Name of the quantity.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Quantity
|
Instance of |
Source code in acoustic_toolbox/quantity.py
:::