ostk.physics.Unit

class Unit

Bases: pybind11_object

A unit of measurement is a definite magnitude of a quantity, defined and adopted by convention or by law, that is used as a standard for measurement of the same kind of quantity. Any other quantity of that kind can be expressed as a multiple of the unit of measurement.

See:

https://en.wikipedia.org/wiki/Unit_of_measurement

Methods

derived

Create a derived unit.

get_type

Get the unit type.

is_defined

Check if the unit is defined.

is_none

Check if the unit is none.

length

Create a length unit.

none

Create a none unit.

ratio_to

Get the ratio to another unit.

string_from_type

Get the string representation of a unit type.

to_string

Get the string representation of the unit.

undefined

Create an undefined unit.

class Type(self: ostk.physics.Unit.Type, value: int)

Bases: pybind11_object

Members:

Undefined :

Undefined unit type.

None :

None unit type.

Length :

Length unit type.

Mass :

Mass unit type.

Time :

Time unit type.

Temperature :

Temperature unit type.

ElectricCurrent :

Electric current unit type.

LuminousIntensity :

Luminous intensity unit type.

Derived :

Derived unit type.

property name
static derived(derived_unit: ostk::physics::unit::Derived::Unit) ostk.physics.Unit

Create a derived unit.

Parameters:

derived_unit (unit.Derived.Unit) -- A derived unit.

Returns:

Derived unit.

Return type:

Unit

get_type(self: ostk.physics.Unit) ostk.physics.Unit.Type

Get the unit type.

Returns:

Unit type.

Return type:

Type

is_defined(self: ostk.physics.Unit) bool

Check if the unit is defined.

Returns:

True if defined.

Return type:

bool

is_none(self: ostk.physics.Unit) bool

Check if the unit is none.

Returns:

True if none.

Return type:

bool

static length(length_unit: ostk::physics::unit::Length::Unit) ostk.physics.Unit

Create a length unit.

Parameters:

length_unit (unit.Length.Unit) -- A length unit.

Returns:

Length unit.

Return type:

Unit

static none() ostk.physics.Unit

Create a none unit.

Returns:

None unit.

Return type:

Unit

ratio_to(self: ostk.physics.Unit, unit: ostk.physics.Unit) ostk.core.type.Real

Get the ratio to another unit.

Parameters:

unit (Unit) -- Another unit.

Returns:

Ratio to another unit.

Return type:

float

static string_from_type(type: ostk.physics.Unit.Type) ostk.core.type.String

Get the string representation of a unit type.

Parameters:

type (Type) -- Unit type.

Returns:

String representation.

Return type:

str

to_string(self: ostk.physics.Unit) ostk.core.type.String

Get the string representation of the unit.

Returns:

String representation.

Return type:

str

static undefined() ostk.physics.Unit

Create an undefined unit.

Returns:

Undefined unit.

Return type:

Unit