9.2.5.2. qumada.instrument.mapping.mapping_gui

class qumada.instrument.mapping.mapping_gui.InstrumentTreeView[source]

Bases: QTreeView

QTreeView, that displays qcodes instruments.

add_terminal_to_view(parent, row, terminal_name)[source]
drag_terminal_drop_instr

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

dropEvent(event)[source]

Start mapping based on selected element in terminal tree (dragged from) and selected element in instrument tree (dropped to).

Different mapping behaviour depending on the combination of “types” of elements (see map_given_terminal_instrument_elem_selection).

Return type:

None

focusOutEvent(a0)[source]
Return type:

None

get_all_possible_mapping_names(instrument_elem)[source]

Get all possible mapping names for all children of instrument_elem. None if

Return type:

Optional[list[str]]

get_perfect_mappings(terminal_params, parent_elem=None)[source]

Given a list of terminal_parameters (names) return a list of QStandardItems in InstrumentTree (perfect mapping candidate) that could be mapped perfectly i.e. every terminal_parameter can be mapped uniquely to the list of all children parameters of the perfect mapping candidate.

Return type:

list[QStandardItem]

import_data(components)[source]

Build up tree with provided instruments.

Return type:

None

keyPressEvent(event)[source]
Return type:

None

map_given_terminal_instrument_elem_selection(tree, terminal_tree_traversal, instr_elem)[source]

For a selected item in terminal_tree (given via terminal_tree_traversal) and selected item in instrument_tree (instr_elem) do the mapping process. Behaviour based on combinations like: direct mapping between parameters, automap to all children etc.

Return type:

bool

mouseDoubleClickEvent(event)[source]
Return type:

None

class qumada.instrument.mapping.mapping_gui.MainWindow(components, terminal_parameters, monitoring=False)[source]

Bases: QMainWindow

Main window containing the two trees and buttons

closeEvent(ev)[source]

Before closing check if some things about the mapping (fully mapped, no duplicates). Then close the application

Return type:

None

drag_terminal_drop_instr_slot(instr_elem, terminal_elem)[source]

This receives signal from InstrumentTree if two elements were paired via drag and drop. Mapping is carried out from here (mainwindow)

keyPressEvent(event)[source]

Handles keyboard shortcuts and mapping using enter key. Selecting an instrument in the terminal_tree and pressing enter will switch focus to the instrument_tree and select a suitable mapping candidate. The user can change the selection and press enter again to do the mapping. The focus switches back to the terminal_tree and a new terminal is selected.

Return type:

None

map_automatically()[source]

Map all terminals automatically. The algorithm used is (almost) equivalent to selecting the first terminal and repeatedly pressing the enter key until the last terminal (in the tree) is mapped. This works best if the terminals are in the same order as the instruments that they should be mapped to. Additionally the terminals mapping to channels of an instrument should be ordered the same as the channels (up to the driver but usually something like 0,1,2,…).

map_automatically_unique()[source]

Automatically map all unique terminal_parameter instrument_parameter pairs. If there are multiple terminal_parameters with the same name their unique mapping is impossible.

map_given_terminal_instrument_elem_selection(terminal_tree_traversal, instr_elem)[source]

For a selected item in terminal_tree (given via terminal_tree_traversal) and selected item in instrument_tree (instr_elem) do the mapping process. Behaviour based on combinations like: direct mapping between parameters, automap to all children etc.

Return type:

bool

map_parameter(parameter, traverse)[source]

Maps a instrument parameter to a specific terminal parameter accessed by the given traversal info. Doesn’t do much anymore, but I kept this around for slightly better readability (and easier refactoring if necessary).

monitoring_set_cache_type()[source]
monitoring_set_get_type()[source]
reset_mapping()[source]

Reset all mappings. Reset dictionary which actually holds the mapping. Reset Tree representation.

set_refresh_rate()[source]

Set refresh rate of monitoring via input dialog.

show_help()[source]
toggle_monitoring()[source]
unfold_terminals()[source]

Unfolds all terminals in the terminal_tree (quickly make everything visible). Collapse all if already unfolded

class qumada.instrument.mapping.mapping_gui.MessageBox_duplicates(parent)[source]

Bases: QMessageBox

class qumada.instrument.mapping.mapping_gui.MessageBox_notallmapped(parent)[source]

Bases: QMessageBox

class qumada.instrument.mapping.mapping_gui.MessageBox_overwrite(parent)[source]

Bases: QMessageBox

class qumada.instrument.mapping.mapping_gui.ScrollLabel(text)[source]

Bases: QScrollArea

Scrollable Label for displaying help window

setText(text)[source]
class qumada.instrument.mapping.mapping_gui.TerminalTreeView(monitoring=False)[source]

Bases: QTreeView

QTreeView, that displays QuMADA TerminalParameters datastructure (Mapping[Any, Mapping[Any, Parameter] | Parameter]). Items are draggable to map them to instruments.

import_data(terminal_parameters)[source]

Build up tree with provided terminal parameters.

Return type:

None

keyPressEvent(event)[source]
Return type:

None

mouseDoubleClickEvent(event)[source]
Return type:

None

update_monitoring()[source]

This is called periodically, gets the mapped parameter values and updates the labels

update_tree()[source]

Function that sets all visual elements (labels, colors) based on state of mapping. This is a clean solution (not super efficient) because changing the mapping for one parameter can have an influence on any other visual elements (duplicate markings etc.)

qumada.instrument.mapping.mapping_gui.get_child(parent, text)[source]
Return type:

Optional[QStandardItem]

qumada.instrument.mapping.mapping_gui.get_children(parent)[source]

Return list of children (QStandardItem) of parent

Return type:

list[QStandardItem]

qumada.instrument.mapping.mapping_gui.get_possible_mapping_candidates(terminal_params, instrument_parameters)[source]

For input terminal and collection of instrument_parameters: get dictionary with key: terminal parameter name, value: list(parameters that can be mapped to that terminal parameter) Similar to base.py _map_gate_to_instrument

Return type:

Mapping[Any, list[Parameter]]

qumada.instrument.mapping.mapping_gui.map_terminals_gui(components, terminal_parameters, existing_terminal_parameters=None, metadata=None, monitoring=True, skip_gui_if_mapped=True)[source]

Maps the terminals, that were defined in the MeasurementScript to the instruments, that are initialized in QCoDeS.

Parameters:
  • components (Mapping[Any, Metadatable]) – Instruments/Components in QCoDeS

  • terminal_parameters (Mapping[Any, Union[Mapping[Any, Parameter], Parameter]]) – Terminals, as defined in the measurement script

  • existing_terminal_parameters (Mapping[Any, Union[Mapping[Any, Parameter], Parameter]] | None) – Already existing mapping, that is used to automatically create the mapping for already known terminals without user input.

  • metadata (Metadata | None) – If provided, add mapping to the metadata object.

  • monitoring (bool) – If True the mapped parameters are periodically read out (either by get command (default) or cached value)

  • skip_gui_if_mapped (bool) – If True and existing_terminal_parameters completely covers all terminal_parameters, dont open gui and continue

Return type:

None

qumada.instrument.mapping.mapping_gui.traverse_tree(root, traversal_names)[source]