BioSimSpace.Gateway.Length

class BioSimSpace.Gateway.Length(help=None, default=None, unit=None, minimum=None, maximum=None, allowed=None)

A length requirement.

Examples

Create a length requirement with a default of 10 Angstrom.

>>> import BioSimSpace as BSS
>>> my_length = BSS.Gateway.Length(help="A length requirement", default=10, unit="angstrom")

The same, but explicitly passing a Length for the default.

>>> import BioSimSpace as BSS
>>> my_length = BSS.Gateway.Length(help="A length requirement",
...                                default=10*BSS.Units.Length.angstrom)

Create a length requirement with a default of 10 Angstrom and a maximum of 50 nanometers. Note that the unit is taken from the default value.

>>> import BioSimSpace as BSS
>>> my_length = BSS.Gateway.Length(help="A length requirement",
...                                default=10*BSS.Units.Length.angstrom,
...                                maximum=50*BSS.Units.Length.nanometer)
__init__(help=None, default=None, unit=None, minimum=None, maximum=None, allowed=None)

Constructor.

Parameters
  • help (str) – The help string.

  • default (Length) – The default value.

  • unit (str) – The unit.

  • minimum (Length) – The minimum allowed value.

  • maximum (Length) – The maximum allowed value.

  • allowed ([Length]) – A list of allowed values.

Methods

__init__([help, default, unit, minimum, …])

Constructor.

getAllowedValues()

Return the allowed values.

getArgType()

The command-line argument type.

getDefault()

Return the default value.

getHelp()

Return the documentation string.

getMax()

Return the maximum allowed value.

getMin()

Return the minimum allowed value.

getUnit()

Return the unit.

getValue()

Return the value.

isMulti()

Whether the requirement has multiple values.

isOptional()

Whether the requirement is optional.

setValue(value[, name])

Validate and set the value.

getAllowedValues()

Return the allowed values.

Returns

allowed – The list of allowed values that the requirement can take.

Return type

list

getArgType()

The command-line argument type.

Returns

arg_type – The command-line argument type.

Return type

bool, int, float, str

getDefault()

Return the default value.

getHelp()

Return the documentation string.

Returns

help – The help string.

Return type

str

getMax()

Return the maximum allowed value.

getMin()

Return the minimum allowed value.

getUnit()

Return the unit.

Returns

unit – The unit associated with the requirement.

Return type

str

getValue()

Return the value.

Returns

value – The value of the requirement.

Return type

Length

isMulti()

Whether the requirement has multiple values.

Returns

is_multi – Whether the requirement has multiple values.

Return type

bool

isOptional()

Whether the requirement is optional.

Returns

is_optional – Whether the requirement is optional.

Return type

bool

setValue(value, name=None)

Validate and set the value.

Parameters
  • value – The value of the input requirement.

  • name (str) – The name of the requirement.