BioSimSpace.Types.Area

class BioSimSpace.Types.Area(*args)

An area type.

__init__(*args)

Constructor.

*args can be a magnitude and unit, or a string representation of the area, e.g. “30 nm^2”.

Parameters:
  • magnitude (float) – The magnitude.
  • unit (str) – The unit.
  • string (str) – A string representation of the area.

Examples

Create an object representing an area of 30 square nanometers then print the area in square Angstrom.

>>> import BioSimSpace as BSS
>>> area = BSS.Types.Area(30, "nm^2")
>>> print(area.angstroms2())

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

>>> import BioSimSpace as BSS
>>> area = BSS.Types.Area("30 nm^2")
>>> print(area.angstroms2())

The string matching is extremeley flexible, so all of the following would be valid arguments: “30 nm^2”, “30 square nanometers”, “30 nanometers squared”.

Methods

__init__(*args) Constructor.
angstroms2() Return the area in square Angstrom.
magnitude() Return the magnitude.
meters2() Return the area in square meters.
nanometers2() Return the area in square nanometers.
picometers2() Return the area in square picometers.
unit() Return the unit.
angstroms2()

Return the area in square Angstrom.

Returns:area – The area in square Angstrom.
Return type:Area
magnitude()

Return the magnitude.

Returns:magnitude – The magnitude of the type.
Return type:float
meters2()

Return the area in square meters.

Returns:area – The area in square meters.
Return type:Area
nanometers2()

Return the area in square nanometers.

Returns:area – The area in square nanometers.
Return type:Area
picometers2()

Return the area in square picometers.

Returns:area – The area in square picometers.
Return type:Area
unit()

Return the unit.

Returns:unit – The unit of the type.
Return type:str