BioSimSpace.Types.Angle

class BioSimSpace.Types.Angle(*args)

An angle type.

__init__(*args)

Constructor.

*args can be a magnitude and unit, or a string representation of the angle, e.g. “3 radians”.

Parameters
  • magnitude (float) – The magnitude.

  • unit (str) – The unit.

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

Examples

Create an object representing an angle of 3.14 radians then print the length in degrees.

>>> import BioSimSpace as BSS
>>> length = BSS.Types.Angle(3.14, "R")
>>> print(length.degrees())

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

>>> import BioSimSpace as BSS
>>> length = BSS.Types.Angle("3.14 R")
>>> print(length.degrees())

The string matching is extremeley flexible, so all of the following would be valid arguments: “3.14 R”, “3.14 radians”, “314e-2 Radians”.

Methods

__init__(*args)

Constructor.

degrees()

Return the angle in degrees.

magnitude()

Return the magnitude.

radians()

Return the angle in radians.

unit()

Return the unit.

degrees()

Return the angle in degrees.

Returns

angle – The angle in degrees.

Return type

Angle

magnitude()

Return the magnitude.

Returns

magnitude – The magnitude of the type.

Return type

float

radians()

Return the angle in radians.

Returns

angle – The angle in radians.

Return type

Angle

unit()

Return the unit.

Returns

unit – The unit of the type.

Return type

str