# Parameter classes

The parameter classes are used to define input variables for a `Procedure`. They each inherit from the `Parameter` base class.

class pymeasure.experiment.parameters.BooleanParameter(name, default=None, ui_class=None, group_by=None, group_condition=True)

  `Parameter` sub-class that uses the boolean type to store the value.

  Variables:

    value – The boolean value of the parameter

  Parameters:

    - name – The parameter name

    - default – The default boolean value

    - ui_class – A Qt class to use for the UI of this parameter

  convert(value)

    Convert user input to python data format

    Subclasses are expected to customize this method. Default implementation is the identity function

    Parameters:

      value – value to be converted

    Returns:

      converted value

class pymeasure.experiment.parameters.FloatParameter(name, units=None, minimum=-1000000000.0, maximum=1000000000.0, decimals=15, step=None, **kwargs)

  `Parameter` sub-class that uses the floating point type to store the value.

  Variables:

    value – The floating point value of the parameter

  Parameters:

    - name – The parameter name

    - units – The units of measure for the parameter

    - minimum – The minimum allowed value (default: -1e9)

    - maximum – The maximum allowed value (default: 1e9)

    - decimals – The number of decimals considered (default: 15)

    - default – The default floating point value

    - ui_class – A Qt class to use for the UI of this parameter

    - step – step size for parameter’s UI spinbox. If None, spinbox will have step disabled

  convert(value)

    Convert user input to python data format

    Subclasses are expected to customize this method. Default implementation is the identity function

    Parameters:

      value – value to be converted

    Returns:

      converted value

class pymeasure.experiment.parameters.IntegerParameter(name, units=None, minimum=-1000000000.0, maximum=1000000000.0, step=None, **kwargs)

  `Parameter` sub-class that uses the integer type to store the value.

  Variables:

    value – The integer value of the parameter

  Parameters:

    - name – The parameter name

    - units – The units of measure for the parameter

    - minimum – The minimum allowed value (default: -1e9)

    - maximum – The maximum allowed value (default: 1e9)

    - default – The default integer value

    - ui_class – A Qt class to use for the UI of this parameter

    - step – int step size for parameter’s UI spinbox. If None, spinbox will have step disabled

  convert(value)

    Convert user input to python data format

    Subclasses are expected to customize this method. Default implementation is the identity function

    Parameters:

      value – value to be converted

    Returns:

      converted value

class pymeasure.experiment.parameters.ListParameter(name, choices=None, units=None, **kwargs)

  `Parameter` sub-class that stores the value as a list. String representation of choices must be unique.

  Parameters:

    - name – The parameter name

    - choices – An explicit list of choices, which is disregarded if None

    - units – The units of measure for the parameter

    - default – The default value

    - ui_class – A Qt class to use for the UI of this parameter

  property choices

    Returns an immutable iterable of choices, or None if not set.

  convert(value)

    Convert user input to python data format

    Subclasses are expected to customize this method. Default implementation is the identity function

    Parameters:

      value – value to be converted

    Returns:

      converted value

class pymeasure.experiment.parameters.Measurable(name, fget=None, units=None, measure=True, default=None, **kwargs)

  Encapsulates the information for a measurable experiment parameter with information about the name, fget function and units if supplied. The value property is called when the procedure retrieves a datapoint and calls the fget function. If no fget function is specified, the value property will return the latest set value of the parameter (or default if never set).

  Variables:

    value – The value of the parameter

  Parameters:

    - name – The parameter name

    - fget – The parameter fget function (e.g. an instrument parameter)

    - default – The default value

class pymeasure.experiment.parameters.Metadata(name, fget=None, units=None, default=None, fmt='%s')

  Encapsulates the information for metadata of the experiment with information about the name, the fget function and the units, if supplied. If no fget function is specified, the value property will return the latest set value of the parameter (or default if never set).

  Variables:

    value – The value of the parameter. This returns (if a value is set) the value obtained from the fget (after evaluation) or a manually set value. Returns None if no value has been set

  Parameters:

    - name – The parameter name

    - fget – The parameter fget function; can be provided as a callable, or as a string, in which case it is assumed to be the name of a method or attribute of the Procedure class in which the Metadata is defined. Passing a string also allows for nested attributes by separating them with a period (e.g. to access an attribute or method of an instrument) where only the last attribute can be a method.

    - units – The parameter units

    - default – The default value, in case no value is assigned or if no fget method is provided

    - fmt – A string used to format the value upon writing it to a file. Default is “%s”

  is_set()

    Returns True if the Parameter value is set

class pymeasure.experiment.parameters.Parameter(name, default=None, ui_class=None, group_by=None, group_condition=True)

  Encapsulates the information for an experiment parameter with information about the name, and units if supplied.

  Variables:

    value – The value of the parameter

  Parameters:

    - name – The parameter name

    - default – The default value

    - ui_class – A Qt class to use for the UI of this parameter

    - group_by – Defines the Parameter(s) that controls the visibility of the associated input; can be a string containing the Parameter name, a list of strings with multiple Parameter names, or a dict containing {“Parameter name”: condition} pairs.

    - group_condition – The condition for the group_by Parameter that controls the visibility of this parameter, provided as a value or a (lambda)function. If the group_by argument is provided as a list of strings, this argument can be either a single condition or a list of conditions. If the group_by argument is provided as a dict this argument is ignored.

  property cli_args

    helper for command line interface parsing of parameters

    This property returns a list of data to help formatting a command line interface interpreter, the list is composed of the following elements: - index 0: default value - index 1: List of value to format an help string, that is either, the name of the fields to be documented or a tuple with (helps_string, field) - index 2: type

  convert(value)

    Convert user input to python data format

    Subclasses are expected to customize this method. Default implementation is the identity function

    Parameters:

      value – value to be converted

    Returns:

      converted value

  is_set()

    Returns True if the Parameter value is set

class pymeasure.experiment.parameters.PhysicalParameter(name, uncertaintyType='absolute', **kwargs)

  `VectorParameter` sub-class of 2 dimensions to store a value and its uncertainty.

  Variables:

    value – The value of the parameter as a list of 2 floating point numbers

  Parameters:

    - name – The parameter name

    - uncertainty_type – Type of uncertainty, ‘absolute’, ‘relative’ or ‘percentage’

    - units – The units of measure for the parameter

    - default – The default value

    - ui_class – A Qt class to use for the UI of this parameter

  convert(value)

    Convert user input to python data format

    Subclasses are expected to customize this method. Default implementation is the identity function

    Parameters:

      value – value to be converted

    Returns:

      converted value

class pymeasure.experiment.parameters.VectorParameter(name, length=3, units=None, **kwargs)

  `Parameter` sub-class that stores the value in a vector format.

  Variables:

    value – The value of the parameter as a list of floating point numbers

  Parameters:

    - name – The parameter name

    - length – The integer dimensions of the vector

    - units – The units of measure for the parameter

    - default – The default value

    - ui_class – A Qt class to use for the UI of this parameter

  convert(value)

    Convert user input to python data format

    Subclasses are expected to customize this method. Default implementation is the identity function

    Parameters:

      value – value to be converted

    Returns:

      converted value