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

__add__(other)

Addition operator.

__delattr__

Implement delattr(self, name).

__dir__

Default dir() implementation.

__eq__(other)

Equals to operator.

__format__

Default object formatter.

__ge__(other)

Greater than or equal to operator.

__getattribute__

Return getattr(self, name).

__gt__(other)

Gretear than operator.

__init__(*args)

Constructor.

__init_subclass__

This method is called when a class is subclassed.

__le__(other)

Less than or equal to operator.

__lt__(other)

Less than operator.

__mul__(other)

Multiplication operator.

__ne__(other)

Not equals to operator.

__neg__()

Unary - operator.

__new__

Create and return a new object.

__pos__()

Unary + operator.

__reduce__

Helper for pickle.

__reduce_ex__

Helper for pickle.

__repr__()

Return a human readable string representation of the object.

__rmul__(other)

Multiplication operator.

__setattr__

Implement setattr(self, name, value).

__sizeof__

Size of object in memory, in bytes.

__str__()

Return a human readable string representation of the object.

__sub__(other)

Subtraction operator.

__subclasshook__

Abstract classes can override this to customize issubclass().

__truediv__(other)

Division operator.

_convert_to(unit)

Return the area in a different unit.

_default_unit([mag])

Internal method to return an object of the same type in the default unit.

_from_string(string)

Convert a string to an object of the same type.

_validate_unit(unit)

Validate that the unit is supported.

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.

Attributes

__dict__

__doc__

__hash__

__module__

__weakref__

list of weak references to the object (if defined)

_abbreviations

_doc_strings

_null_unit

_print_format

_supported_units