ostk.physics.data.Scalar

class Scalar(
self: ostk.physics.data.Scalar,
value: ostk.core.type.Real,
unit: ostk.physics.Unit,
)

Bases: pybind11_object

Scalar quantity.

A scalar quantity is a physical quantity that can be described by a single element of a number field such as a real number, often accompanied by units of measurement.

Reference:

https://en.wikipedia.org/wiki/Scalar_(physics)

Construct a Scalar.

Parameters:
  • value (Real) -- Value.

  • unit (Unit) -- Unit.

Methods

get_unit

Get unit.

get_value

Get value.

in_unit

Convert to unit.

is_defined

Check if the scalar is defined.

to_string

Convert to string.

undefined

Create an undefined scalar.

get_unit(self: ostk.physics.data.Scalar) ostk.physics.Unit

Get unit.

Returns:

Unit.

Return type:

Unit

get_value(self: ostk.physics.data.Scalar) ostk.core.type.Real

Get value.

Returns:

Value.

Return type:

float

in_unit(
self: ostk.physics.data.Scalar,
unit: ostk.physics.Unit,
) ostk.physics.data.Scalar

Convert to unit.

Parameters:

unit (Unit) -- Unit.

Returns:

Scalar in the specified unit.

Return type:

Scalar

is_defined(self: ostk.physics.data.Scalar) bool

Check if the scalar is defined.

Returns:

True if defined.

Return type:

bool

to_string(
self: ostk.physics.data.Scalar,
precision: ostk.core.type.Integer = Integer.Undefined(),
) ostk.core.type.String

Convert to string.

Parameters:

precision (int) -- Precision.

Returns:

String representation.

Return type:

str

static undefined() ostk.physics.data.Scalar

Create an undefined scalar.

Returns:

Undefined scalar.

Return type:

Scalar