# BioSimSpace.Types.Temperature¶

class BioSimSpace.Types.Temperature(*args)

A temperature type.

__init__(*args)

Constructor.

*args can be a value and unit, or a string representation of the temperature, e.g. “298 K”.

Parameters
• value (float) – The value.

• unit (str) – The unit.

• string (str) – A string representation of the temperature.

Examples

Create an object representing a temperature of 298 Kelvin then print the temperature in Celsius.

>>> import BioSimSpace as BSS
>>> temperature = BSS.Types.Temperature(298, "K")
>>> print(temperature.celsius())


The same as above, except passing a string representation of the temperature to the constructor.

>>> import BioSimSpace as BSS
>>> time = BSS.Types.Temperature("298 K")
>>> print(temperature.celsius())


The string matching is extremeley flexible, so all of the following would be valid arguments: “298 K”, “298 kelvin”, “2.98e2 k”.

Methods

 __init__(*args) Constructor. Return the power in the ‘angle’ dimension. Return the temperature in Celsius. Return the power in the ‘charge’ dimension. Return the dimensions of this type. Return the temperature in Fahrenheit. Return the temperature in Kelvin. Return the power in the ‘length’ dimension. Return the power in the ‘mass’ dimension. Return the power in the ‘quantity’ dimension. Return the power in the ‘temperature’ dimension. Return the power in the ‘time’ dimension. Return the unit. Return the value.
classmethod angle()

Return the power in the ‘angle’ dimension.

Returns

angle – The power in the ‘angle’ dimension.

Return type

int

celsius()

Return the temperature in Celsius.

Returns

temperature – The temperature in Celsius.

Return type

Temperature

classmethod charge()

Return the power in the ‘charge’ dimension.

Returns

charge – The power in the ‘charge’ dimension.

Return type

int

classmethod dimensions()

Return the dimensions of this type. This is a tuple containing the power in each dimension.

Returns(int, int, int, int, int, int)

The power in each dimension: ‘angle’, ‘charge’, ‘length’, ‘mass’, ‘quantity’, ‘temperature’, and ‘time’.

fahrenheit()

Return the temperature in Fahrenheit.

Returns

temperature – The temperature in Fahrenheit.

Return type

Temperature

kelvin()

Return the temperature in Kelvin.

Returns

temperature – The temperature in Kelvin.

Return type

Temperature

classmethod length()

Return the power in the ‘length’ dimension.

Returns

length – The power in the ‘length’ dimension.

Return type

int

classmethod mass()

Return the power in the ‘mass’ dimension.

Returns

mass – The power in the ‘mass’ dimension.

Return type

int

classmethod quantity()

Return the power in the ‘quantity’ dimension.

Returns

quantity – The power in the ‘quantity’ dimension.

Return type

int

classmethod temperature()

Return the power in the ‘temperature’ dimension.

Returns

temperature – The power in the ‘temperature’ dimension.

Return type

int

classmethod time()

Return the power in the ‘time’ dimension.

Returns

time – The power the ‘time’ dimension.

Return type

int

unit()

Return the unit.

Returns

unit – The unit of the type.

Return type

str

value()

Return the value.

Returns

value – The value of the type.

Return type

float