BioSimSpace.Types.Pressure

class BioSimSpace.Types.Pressure(*args)

A pressure type.

__init__(*args)

Constructor.

*args can be a magnitude and unit, or a string representation of the pressure, e.g. “1.38 bar”.

Parameters
  • magnitude (float) – The magnitude.

  • unit (str) – The unit.

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

Examples

Create an object representing a pressure of 3.1 atmosphere then print the pressure in bar.

>>> import BioSimSpace as BSS
>>> pressure = BSS.Types.Pressure(3.1, "atm")
>>> print(pressure.bar())

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

>>> import BioSimSpace as BSS
>>> pressure = BSS.Types.Pressure("3.1 atm")
>>> print(pressure.nanoseconds())

The string matching is extremeley flexible, so all of the following would be valid arguments: “3.1 atm”, “3.1 atmosphere”, “0.31e1 atm”.

Methods

__init__(*args)

Constructor.

atm()

Return the atmospheric pressure.

bar()

Return the pressure in bar.

magnitude()

Return the magnitude.

unit()

Return the unit.

atm()

Return the atmospheric pressure.

Returns

pressure – The pressure in atomospheres.

Return type

Pressure

bar()

Return the pressure in bar.

Returns

pressure – The pressure in bar.

Return type

Pressure

magnitude()

Return the magnitude.

Returns

magnitude – The magnitude of the type.

Return type

float

unit()

Return the unit.

Returns

unit – The unit of the type.

Return type

str