brainunit module#
Data Structures#
Errors#
Exception for operations with incompatible physical units. |
|
Exception for operations with incompatible physical dimensions. |
Constants#
Store the exponents of the 7 basic SI unit dimensions. |
|
A physical unit. |
Getters and Checkers#
Test if a value is dimensionless or not. |
|
Test if a value is unitless or not. |
|
Test whether obj is a scalar (0-d) numeric type. |
|
Return the dimension of any object that has them. |
|
Return the unit of any object that has them. |
|
Return the mantissa of a Quantity or a number. |
|
Return the mantissa of a Quantity or a number. |
|
Display a value in a certain unit with a given precision. |
|
Split a Quantity into its mantissa and unit. |
|
Convert a quantity to a plain number if it is dimensionless. |
|
Compare the dimensions of two objects. |
|
Compare the units of two objects. |
|
Assert that a Quantity has a certain mantissa and unit. |
|
Test if two values have the same dimensions. |
|
Check whether two objects have the same unit. |
|
Align the units of all arguments to the unit of the first argument. |
|
Create a new Quantity with the given unit. |
Decorators#
Decorator to check dimensions of arguments passed to a function |
|
Decorator to check units of arguments passed to a function |
|
Decorator to transform units of arguments passed to a function and optionally assign units to the return value. |
Dimension Utilities#
Create a new Dimension object or get a reference to an existing one. |
|
Return a string representation of a dimension for display purposes. |
|
Register a unit as a standard unit for display purposes. |
Temperature Conversion#
Customized Array Interfaces#
Mathematical functions provided in brainunit are aware of CustomArray.
You can define your own array-like class by inheriting from CustomArray and implementing the required methods.
These customized arrays can seamlessly interact with the unit-aware mathematical functions.
A custom array wrapper providing comprehensive array operations and cross-framework compatibility. |
Equinox Compatibility#
Enable or disable compatibility with the Equinox library. |