Nodetree and Parameters¶
Nodetree¶
-
class
zhinst.toolkit.control.node_tree.
NodeTree
(device)¶ Bases:
zhinst.toolkit.control.node_tree.Node
Recreates the device’s nodetree.
Implements a
NodeTree
data structure used to access the settings (Parameter
) of any Zurich Instruments device. ANodeTree
is created for every instrument when it is connected to the data server. In this way the available settings always directly correspond to theNodes
that are available on the device.Inherits from the
Node
class. On initialization theNodeTree
retireves a nested dictionary from the device representing its nodetree heirarchy and then recursively addsNodes
andParameters
as attributes to theNode
.>>> hdawg.nodetree <zhinst.toolkit.tools.nodetree.NodeTree object at 0x0000021E467D3BA8> nodes: - stats - oscs - status - sines - awgs - dio - system - sigouts - triggers - features - cnts parameters: - clockbase
- Parameters
device (
BaseInstrument
) – A reference to the instrument that theNodeTree
belongs to. Used for getting and setting of eachParameter
.
-
device
¶ The associated device.
- Type
BaseInstrument
-
nodetree_dict
¶ A nested dictionary created from the dict returned by daq.listNodesJSON(…) of the
zhinst.ziPython
Python API.- Type
dict
Node¶
-
class
zhinst.toolkit.control.node_tree.
Node
(parent)¶ Implements a node in the
NodeTree
of a device.A
Node
has a parent node and a device it is associated with. It can hold otherNodes
as well asParameters
. The data structure of the deviceNodeTree
is recreated by recursively adding either otherNodes
orParameters
as attributes to theNode
.To make it easier fo the user to navigate the device
NodeTree
, eachNode
has the attributes nodes and parameters taht holds a list its children. Also the __repr__() method is overwritten such that the output in the console is useful:>>> hdawg.nodetree.sigouts[0] <zhinst.toolkit.tools.nodetree.Node object at 0x0000021E49397470> nodes: - precompensation parameters: - on - range - direct - over ...
Node List¶
-
class
zhinst.toolkit.control.node_tree.
NodeList
¶ Implements a list of
Nodes
.Simply inherits from
List
and overrides the __repr__() method to make it look nice in the console or in a notebook.>>> hdawg.nodetree.sigouts Iterable node with 8 items: Node 1: <zhinst.toolkit.tools.nodetree.Node object at 0x0000021E49397470> nodes: - precompensation parameters: - on - range - direct - over ... >>> for sigout in hdawg.nodetree.sigouts: >>> sigout.range(1.5)
Parameter¶
-
class
zhinst.toolkit.control.node_tree.
Parameter
(parent, params: Dict, device=None, set_parser: Callable = <function Parameter.<lambda>>, get_parser: Callable = <function Parameter.<lambda>>, mapping: Dict = None)¶ Implements a
zhinst-toolkit
Parameter
.Implements a callable
Parameter
as leaves in theNodeTree
with a parentNode
and a device. It holds the information from the daq.listNodesJSON(…) method of the Zurich Instruments Python API such as the node path, the description, properties, etc. The __repr__() method returns a string with a summary of theParameter
.>>> uhfqa.nodetree.osc.freq Node: /DEV2266/OSCS/0/FREQ Description: Frequency control of the oscillator. Type: Double Properties: Read, Write, Setting Options: none Unit: Hz Value: none
Setting and getting a
Parameter
is easy. Just call theParameter
with or without an argument:>>> uhfqa.nodetree.osc.freq(10e6) >>> uhfqa.nodetree.osc.freq() 10000000.00
- Parameters
parent (
BaseInstrument
,NodeTree
orNode
) – The parent object that theParameter
is associated to.params (dict) – Dictionary with a definition of the
Parameter
. It must contain the item ‘Node’ corresponding to the node path of the parameter on the device that is used for getting and setting theParameter
value. It may contain the items ‘Description’, ‘Properties’, ‘Options’, ‘Unit’, ‘Type’.
- Keyword Arguments
device (
BaseInstruemnt
) – The device driver that theParameter
is associated to. The device is eventually used to set(…) and get(…) the node. (default: None)set_parser (Callable) – A parser function that is called with the set value before setting the value and returns the parsed parameter value. (default: ‘lambda v: v’)
set_parser – A parser function that is called with the gotten value from the device before returning it by the getter. It returns the parsed parameter value. (default: ‘lambda v: v’)
mapping (dict) – A value mapping for keyword to integer conversion. (default: None)