AngularAcceleration

class AngularAcceleration(value: float | int, unit: str)

Bases: UnitBase

AngularAcceleration object.

Attributes

unitstr

Symbol of the unit of measurement for angular acceleration.

valuefloat or int

Angular acceleration numerical value.

Methods

to()

It converts actual value to a new value computed using target_unit as the reference unit of measurement.

to(target_unit: str, inplace: bool = False) AngularAcceleration

It converts actual value to a new value computed using target_unit as the reference unit of measurement.

If inplace is True, it overrides actual value and unit, otherwise it returns a new instance with the converted value and the target_unit as unit.

Parameters

target_unitstr

Target unit to which convert the current value.

inplacebool, optional

Whether to override the current instance value. Default is False, so it does not override the current value.

Returns

AngularAcceleration

Converted angular acceleration.

Raises

TypeError
  • If target_unit is not a str,

  • if inplace is not a bool.

KeyError

If the target_unit is not among available ones.

Examples

AngularAcceleration instantiation.

>>> from gearpy.units import AngularAcceleration
>>> a = AngularAcceleration(180, 'deg/s^2')
>>> a
180 deg/s^2

Conversion from degree per second squared to radian per second squared with inplace=False by default, so it does not override the current value.

>>> a.to('rad/s^2')
3.141592653589793 rad/s^2
>>> a
180 deg/s^2

Conversion from degree per second squared to radian per second squared with inplace=True, in order to override the current value.

>>> a.to('rad/s^2', inplace=True)
3.141592653589793 rad/s^2
>>> a
3.141592653589793 rad/s^2
property unit: str

Symbol of the unit of measurement for angular acceleration. It must be a str. Available units are:

  • 'rad/s^2' for radian per second squared,

  • 'deg/s^2' for degree per second squared,

  • 'rot/s^2' for rotation per second squared.

Returns

str

Symbol of the unit of measurement for angular acceleration.

Raises

TypeError

If unit is not a str.

KeyError

If the unit is not among available ones.

property value: float | int

Angular acceleration numerical value. The relative unit is expressed by the unit property.

Returns

float or int

Angular acceleration numerical value.

Raises

TypeError

If value is not a float or an int.