mudu.dimensions
mudu module, defines dimensions (quantities).
For more information, read the documenation using
in your cli
Attributes
Classes
Base class for all dimensions model. |
|
Base class for all derived quantities. As an example, |
|
Base class for all fundamental quantities. As an example, |
|
Base class for all fundamental quantities. As an example, |
|
Base class for all fundamental quantities. As an example, |
|
Base class for all fundamental quantities. As an example, |
|
Base class for all fundamental quantities. As an example, |
|
Base class for all fundamental quantities. As an example, |
|
Base class for all fundamental quantities. As an example, |
|
Base class for all derived quantities. As an example, |
|
Base class for all derived quantities. As an example, |
|
Base class for all derived quantities. As an example, |
|
Base class for all derived quantities. As an example, |
|
Base class for all derived quantities. As an example, |
|
Base class for all derived quantities. As an example, |
|
Base class for all derived quantities. As an example, |
|
Base class for all derived quantities. As an example, |
|
Base class for all derived quantities. As an example, |
|
Base class for all derived quantities. As an example, |
|
Custom units |
Functions
|
Converts from one unit to another, provided that there is a conversion standard |
Module Contents
- mudu.dimensions._unit_conversion(self, _to)
Converts from one unit to another, provided that there is a conversion standard defined for the units involved.
- Parameters:
unit_type (_UnitType) – The _UnitType instance to be converted to.
return (_DimensionType object with the unit_type as the unit.)
- class mudu.dimensions._DimensionUnitBase
Base class for all dimensions model.
- _conversion_standards
Conversion table definition of conversion standards for converting from one unit to another provided that the units are of the same dimension.
- Type:
- _dimension
The dimension represented by the dimension model e.g. METER, LENGTH, TIME
- Type:
str
- _check_and_convert
Performs an arithemetic or boolean operation on a _DimensionUnitBase child object. Makes sure of unit homogeniety by implicitly converting units where required before performing the operation.
- Type:
_DimensionUnitBase | int | float | bool
- convert_to
Converts from one unit to another, provided that there is a conversion standard defined for the units involved.
- Type:
_DimensionUnitBase | bool
- _conversion_standards: mudu.base._ConversionTableType = None
- _dimension: str = None
- __repr__()
- __str__()
- __int__()
- __float__()
- __add__(x)
- __radd__(x)
- __sub__(x)
- __rsub__(x)
- __mul__(x)
- __rmul__(x)
- __truediv__(x)
- __rtruediv__(x)
- __floordiv__(x)
- __rfloordiv__(x)
- __pow__(x)
- __round__(y=0)
- __lt__(x)
- __gt__(x)
- __le__(x)
- __ge__(x)
- __eq__(x)
- _check_and_convert(x: Any, _operator: Callable) Self | bool | int | float
Performs an arithemetic or boolean operation on a _DimensionUnitBase child object. Makes sure of unit homogeniety by implicitly converting units where required before performing the operation.
- Parameters:
x (Any) – Object to perform operation on.
_operator (Callable) – Operator representing operation to be performed
return (_DimensionUnitBase | bool | int | float)
- convert_to(_to: mudu.base._UnitType)
Converts from one unit to another, provided that there is a conversion standard defined for the units involved.
- Parameters:
unit_type (_UnitType) – The _UnitType instance to be converted to.
return (_DimensionUnitBase object with the unit_type as the unit.)
- class mudu.dimensions.DerivedQuantity(value: int | float, unit_definition: mudu.base._UnitType, quantity: str = GENERIC_QUANTITY)
Bases:
_DimensionUnitBaseBase class for all derived quantities. As an example, Force class is a child class of DerivedQuantity. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
- _check_and_convert
same as the base class ((_DimensionUnitBase))
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- _conversion_standards: mudu.base._ConversionTableType = None
- value
- unit_type
- symbol
- quantity: str
- classmethod create_unit(**kwargs)
Internal class method to create a new DerivedQuantity object, the same argument signature as init.
- dimension
- property __value_not_seq
value is not a sequence
- __repr__()
- __str__()
- __len__()
- __iter__()
- __round__(y=0)
- __mul__(x)
- __truediv__(x)
- __rtruediv__(x)
- __pow__(x)
- _check_and_convert(x, _operator: Callable) Self
Performs an arithemetic or boolean operation on a DerivedQuantity child object. Makes sure of unit homogeniety by implicitly converting units where required before performing the operation.
- Parameters:
x (Any) – Object to perform operation on.
_operator (Callable) – Operator representing operation to be performed
return (DerivedQuantity | bool | int | float)
- class mudu.dimensions._DimensionType(unit: mudu.base._UnitType, value: int | float | collections.abc.Sequence)
Bases:
_DimensionUnitBaseBase class for all fundamental quantities. As an example, Length class, Mass class and Time`class are child classes of `_DimensionType. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
_DimensiionType
- _check_and_convert
same as the base class (_DimensionUnitBase)
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- _conversion_standards: mudu.base._ConversionTableType = None
- _dimension = None
- _base_unit_standard = None
- dimension
- unit_type
- unit
- symbol
- value
- classmethod create_unit(**kwargs)
- property __value_not_seq
value is not a sequence
- __repr__()
- __str__()
- __len__()
- __iter__()
- __round__(y=0)
- __mul__(x)
- __truediv__(x)
- __rtruediv__(x)
- __pow__(x)
- _check_and_convert(x, _operator: Callable) Self | bool
Performs an arithemetic or boolean operation on a _DimensionType object. Makes sure of unit homogeniety by implicitly converting units where required before performing the operation.
- Parameters:
x (Any) – Object to perform operation on.
_operator (Callable) – Operator representing operation to be performed
return (_DimensionType | bool | int | float)
- class mudu.dimensions.Length(value, unit)
Bases:
_DimensionTypeBase class for all fundamental quantities. As an example, Length class, Mass class and Time`class are child classes of `_DimensionType. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
_DimensiionType
- _check_and_convert
same as the base class (_DimensionUnitBase)
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- _conversion_standards
- _dimension
- _base_unit_standard
- class mudu.dimensions.Mass(value, unit)
Bases:
_DimensionTypeBase class for all fundamental quantities. As an example, Length class, Mass class and Time`class are child classes of `_DimensionType. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
_DimensiionType
- _check_and_convert
same as the base class (_DimensionUnitBase)
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- _conversion_standards
- _dimension
- _base_unit_standard
- class mudu.dimensions.Time(value, unit)
Bases:
_DimensionTypeBase class for all fundamental quantities. As an example, Length class, Mass class and Time`class are child classes of `_DimensionType. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
_DimensiionType
- _check_and_convert
same as the base class (_DimensionUnitBase)
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- _conversion_standards
- _dimension
- _base_unit_standard
- class mudu.dimensions.Temperature(value, unit)
Bases:
_DimensionTypeBase class for all fundamental quantities. As an example, Length class, Mass class and Time`class are child classes of `_DimensionType. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
_DimensiionType
- _check_and_convert
same as the base class (_DimensionUnitBase)
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- _conversion_standards
- _dimension
- _base_unit_standard
- class mudu.dimensions.Angle(value, unit)
Bases:
_DimensionTypeBase class for all fundamental quantities. As an example, Length class, Mass class and Time`class are child classes of `_DimensionType. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
_DimensiionType
- _check_and_convert
same as the base class (_DimensionUnitBase)
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- _conversion_standards
- _dimension
- class mudu.dimensions.GenericUnit(value, unit)
Bases:
_DimensionTypeBase class for all fundamental quantities. As an example, Length class, Mass class and Time`class are child classes of `_DimensionType. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
_DimensiionType
- _check_and_convert
same as the base class (_DimensionUnitBase)
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- _dimension
- mudu.dimensions.SolidAngle
- mudu.dimensions.ElectricCurrent
- mudu.dimensions.AmountOfSubstance
- mudu.dimensions.LuminousIntensity
- class mudu.dimensions.Force(value, unit_definition)
Bases:
DerivedQuantityBase class for all derived quantities. As an example, Force class is a child class of DerivedQuantity. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
- _check_and_convert
same as the base class ((_DimensionUnitBase))
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- _conversion_standards
- class mudu.dimensions.Speed(value, unit_definition)
Bases:
DerivedQuantityBase class for all derived quantities. As an example, Force class is a child class of DerivedQuantity. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
- _check_and_convert
same as the base class ((_DimensionUnitBase))
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- _conversion_standards
- class mudu.dimensions.Pressure(value, unit_definition)
Bases:
DerivedQuantityBase class for all derived quantities. As an example, Force class is a child class of DerivedQuantity. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
- _check_and_convert
same as the base class ((_DimensionUnitBase))
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- _conversion_standards
- class mudu.dimensions.Energy(value, unit_definition)
Bases:
DerivedQuantityBase class for all derived quantities. As an example, Force class is a child class of DerivedQuantity. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
- _check_and_convert
same as the base class ((_DimensionUnitBase))
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- _conversion_standards
- class mudu.dimensions.Density(value, unit_definition)
Bases:
DerivedQuantityBase class for all derived quantities. As an example, Force class is a child class of DerivedQuantity. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
- _check_and_convert
same as the base class ((_DimensionUnitBase))
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- _conversion_standards
- class mudu.dimensions.Power(value, unit_definition)
Bases:
DerivedQuantityBase class for all derived quantities. As an example, Force class is a child class of DerivedQuantity. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
- _check_and_convert
same as the base class ((_DimensionUnitBase))
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- _conversion_standards
- class mudu.dimensions.Radioactivity(value, unit_definition)
Bases:
DerivedQuantityBase class for all derived quantities. As an example, Force class is a child class of DerivedQuantity. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
- _check_and_convert
same as the base class ((_DimensionUnitBase))
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- _conversion_standards
- class mudu.dimensions.AbsorbedDose(value, unit_definition)
Bases:
DerivedQuantityBase class for all derived quantities. As an example, Force class is a child class of DerivedQuantity. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
- _check_and_convert
same as the base class ((_DimensionUnitBase))
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- _conversion_standards
- class mudu.dimensions.DoseEquivalent(value, unit_definition)
Bases:
DerivedQuantityBase class for all derived quantities. As an example, Force class is a child class of DerivedQuantity. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
- _check_and_convert
same as the base class ((_DimensionUnitBase))
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- _conversion_standards
- class mudu.dimensions.GenericUnit2(value, unit_definition)
Bases:
DerivedQuantityBase class for all derived quantities. As an example, Force class is a child class of DerivedQuantity. Check the documenation at by running mudu –doc on the cli on how to extend this class.
- _conversion_standards
Same as in _DimensionUnitBase
- Type:
- _dimension
Same as in DimensionUnitBase
- Type:
str
- symbol
Symbolic representation of the quantity unit
- Type:
sympy.Symbol
- create_unit
Internal class method for creating a new DerivedQuantity object instance with the same argument signature as init.
- Type:
- _check_and_convert
same as the base class ((_DimensionUnitBase))
- Type:
x: Any, operator: Callable
- convert_to
same as the base class (_DimensionUnitBase)
- Type:
_to
- mudu.dimensions.Voltage
- mudu.dimensions.Capacitance
- mudu.dimensions.Inductance
- mudu.dimensions.MagneticFlux
- mudu.dimensions.Resistance
- mudu.dimensions.Conductance
- mudu.dimensions.MageneticFieldStrength
- mudu.dimensions.Illuminance
- class mudu.dimensions.custom_unit(value: int | float, *, num: collections.abc.Sequence[mudu.base._UnitType], per: collections.abc.Sequence[int] | collections.abc.Sequence[mudu.base._UnitType] = (1,), quantity=GENERIC_QUANTITY)
Bases:
DerivedQuantityCustom units
- __numerator_unit = 1
- __denominator_unit = 1
- __numerator = []
- __denominator = []
- __unit_definition = 1.0
- __check_condition(_from, allow_int=False)
- __list2unit(_from: int | collections.abc.Sequence[mudu.base._UnitType], allow_int=False)
- __repr_only_one_quantity(_from: collections.abc.Sequence, is_denum=False)
Ensure that each unit represent exclusively only one quanitity
- abstractmethod convert_to(num: collections.abc.Sequence, per: collections.abc.Sequence)
Converts from one unit to another, provided that there is a conversion standard defined for the units involved.
- Parameters:
unit_type (_UnitType) – The _UnitType instance to be converted to.
return (_DimensionType object with the unit_type as the unit.)