libpyvinyl.Parameter

class libpyvinyl.Parameter(name, unit='', comment=None)[source]

Description of a single parameter.

The parameter is defined by:
  • name: when added to a parameter collection, it can be accessed by this name

  • value: can be a boolean, a string, a pint.Quantity, an int or float (the latter internally converted to pint.Quantity)

  • unit: a string that is internally converted into a pint.Unit

  • comment: a string with a brief description of the parameter and additional informations

Creates parameter with given name, optionally unit and comment

Parameters:
  • name (str) – name of the parameter

  • unit (str) – physical units returning the parameter value

  • comment (Optional[str]) – brief description of the parameter

__init__(name, unit='', comment=None)[source]

Creates parameter with given name, optionally unit and comment

Parameters:
  • name (str) – name of the parameter

  • unit (str) – physical units returning the parameter value

  • comment (Optional[str]) – brief description of the parameter

Methods

__init__(name[, unit, comment])

Creates parameter with given name, optionally unit and comment

add_interval(min_value, max_value, ...)

Sets an interval for this parameter: [min_value, max_value] The interval is closed on both sides: min_value and and max_value are included.

add_option(option, options_are_legal)

Sets allowed values for this parameter

clear_intervals()

Clear the intervals of this parameter.

clear_options()

Clear the option values of this parameter.

from_dict(param_dict)

Helper class method creating a new object from a dictionary providing

get_intervals()

get_intervals_are_legal()

get_options()

get_options_are_legal()

is_legal([values])

Checks whether or not given or contained value is legal given constraints.

print_line()

returns string with one line description of parameter

print_parameter_constraints()

Print the legal and illegal intervals of this parameter.

Attributes

pint_value

Returning the value as a pint object if available, an error otherwise

unit

Returning the units as a string

value

Returns the magnitude of a Quantity or the stored value otherwise

value_no_conversion

Returning the object stored in value with no conversions