8.5.4.3. pymodaq_gui.parameter.utils module

class pymodaq_gui.parameter.utils.ParameterWithPath(parameter: Parameter, path: List[str] = None)[source]

Bases: SerializableBase

holds together a Parameter object and its full path

To be used when communicating between TCPIP to reconstruct properly the Parameter

Parameters:
  • parameter (Parameter) – a Parameter object

  • path (full path of the parameter, if None it is constructed from the parameter parents)

Attributes:
parameter
path

Methods

deserialize(bytes_str)

Convert bytes into a ParameterWithPath object

serialize

value

classmethod deserialize(bytes_str: bytes) ParameterWithPath | Tuple[ParameterWithPath, bytes][source]

Convert bytes into a ParameterWithPath object

Returns:

  • ParameterWithPath (the decoded object)

  • bytes (the remaining bytes string if any)

static serialize(param: ParameterWithPath) bytes[source]
value()[source]
property parameter: Parameter
property path: List[str]
pymodaq_gui.parameter.utils.compareParameters(param1: Parameter, param2: Parameter, opts: list = []) bool[source]

Compare the structure and the opts of two parameters with their children, return True if structure and all opts are identical

param1: Parameter param2: Parameter

Returns:
Bool
pymodaq_gui.parameter.utils.compareStructureParameter(param1: Parameter, param2: Parameter) bool[source]

Compare the structure of two parameters with their children, return True if structure is identical :param param1: :type param1: Parameter :param param2: :type param2: Parameter

Return type:

Bool

pymodaq_gui.parameter.utils.compareValuesParameter(param1: Parameter, param2: Parameter) bool[source]

Compare the structure and the values of two parameters with their children, return True if structures and values are identical :param param1: :type param1: Parameter :param param2: :type param2: Parameter

Return type:

Bool

pymodaq_gui.parameter.utils.getOpts(param: Parameter) OrderedDict[source]

Return an OrderedDict with tree structures of all opts for all children of this parameter :param param: :type param: Parameter

Return type:

OrderedDict

pymodaq_gui.parameter.utils.getStruct(param: Parameter) OrderedDict[source]

Return an OrderedDict with tree structures of all children of this parameter :param param: :type param: Parameter

Return type:

OrderedDict

pymodaq_gui.parameter.utils.getValues(param: Parameter) OrderedDict[source]

Return an OrderedDict with tree structures of all values for all children of this parameter :param param: :type param: Parameter

Return type:

OrderedDict

pymodaq_gui.parameter.utils.get_param_dict_from_name(parent_list, name, pop=False)[source]

Get dict under parent whose name is name. The parent_list structure is the one used to init a Parameter object

Parameters:
  • parent_list ((list of dicts) as defined to init Parameter object)

  • name ((str) value to find for the key: name)

  • pop ((bool) if True remove the matched dict from parent)

Return type:

dict the matched dict

pymodaq_gui.parameter.utils.get_param_from_name(parent, name) Parameter[source]

Get Parameter under parent whose name is name

Parameters:
  • parent (Parameter)

  • name (str)

Return type:

Parameter

pymodaq_gui.parameter.utils.get_param_path(param: Parameter) List[str][source]

Get the parameter path from its highest parent down to the given parameter including its identifier (name)

Parameters:

param (Parameter) – The parameter object

Returns:

List[str]

Return type:

the path as a list of parameter identifiers

pymodaq_gui.parameter.utils.get_widget_from_tree(parameter_tree, widget_instance)[source]
pymodaq_gui.parameter.utils.is_name_in_dict(dict_tmp, name)[source]
pymodaq_gui.parameter.utils.iter_children(param, childlist=[], filter_type=(), filter_name=(), select_filter=False) list[source]

Get a list of parameters’ name under a given Parameter (see iter_children_params)

Returns:

The list of the children name from the given node.

Return type:

list

pymodaq_gui.parameter.utils.iter_children_params(param, childlist=[], output_type=None, filter_type=(), filter_name=(), select_filter=False) list[source]

Get a list of parameters under a given Parameter.

Parameters:
  • param (Parameter (pyqtgraph)) – the root node to be coursed

  • childlist (list) – the child/output list

  • output_type (str) – the attribute of parameter that will be added to the output list

  • filter_type (list) – filter children sharing those types

  • filter_name (list) – filter children sharing those names

  • select_filter (bool) – if True, add filtered parameters to output list. if False (default), add non-filtered parameter to output list.

Returns:

The list of the children from the given node.

Return type:

list

pymodaq_gui.parameter.utils.scroll_linear(scroll_val, min_val, max_val)[source]

Convert a scroll value [0-100] to a linear scale between min_val and max_val :param scroll: :param min_val: :param max_val:

pymodaq_gui.parameter.utils.scroll_log(scroll_val, min_val, max_val)[source]

Convert a scroll value [0-100] to a log scale between min_val and max_val :param scroll: :param min_val: :param max_val:

pymodaq_gui.parameter.utils.set_param_from_param(param_old, param_new)[source]

Walk through parameters children and set values using new parameter values.