Stress¶
- class Stress(value: float | int, unit: str)¶
Bases:
UnitBaseStressobject.Attributes¶
Methods¶
to()It converts actual
valueto a new value computed usingtarget_unitas the reference unit of measurement.
- to(target_unit: str, inplace: bool = False) Stress¶
It converts actual
valueto a new value computed usingtarget_unitas the reference unit of measurement.If
inplaceisTrue, it overrides actualvalueandunit, otherwise it returns a new instance with the convertedvalueand thetarget_unitasunit.Parameters¶
Returns¶
StressConverted stress.
Raises
Examples
Stressinstantiation.>>> from gearpy.units import Stress >>> s = Stress(1, 'GPa') >>> s 1 GPa
Conversion from giga-pascal to mega-pascal with
inplace=Falseby default, so it does not override the current value.>>> s.to('MPa') 1000.0 MPa >>> s 1 GPa
Conversion from giga-pascal to mega-pascal with
inplace=True, in order to override the current value.>>> s.to('MPa', inplace=True) 1000.0 MPa >>> s 1000.0 MPa