BioSimSpace.Gateway.Float¶
-
class
BioSimSpace.Gateway.
Float
(help=None, default=None, minimum=None, maximum=None, allowed=None)¶ A floating point requirement.
Examples
Create a float requirement with an allowed range and no default.
>>> import BioSimSpace as BSS >>> my_float = BSS.Gateway.Float(help="A float requirement.", minimum=-13.2, maximum=27.3)
Create a float requirement with a given set of allowed values.
>>> import BioSimSpace as BSS >>> my_float = BSS.Gateway.Float(help="A float requirement.", allowed=[1.0,3.5,12.8])
Create a float requirement with a maximum value of 57.3 and default of 18.2.
>>> import BioSimSpace as BSS >>> my_float = BSS.Gateway.Float(help="A float requirement.", default=18.2, maximum=57.3)
-
__init__
(help=None, default=None, minimum=None, maximum=None, allowed=None)¶ Constructor.
- Parameters
help (str) – The help string.
default (float) – The default value.
minimum (float) – The minimum allowed value.
maximum (float) – The maximum allowed value.
allowed ([float]) – A list of allowed values.
Methods
__init__
([help, default, minimum, maximum, …])Constructor.
Return the allowed values.
The command-line argument type.
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.
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.
-
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.
-