qcodespp.instrument_drivers.QDevil.QSwitch
Attributes
Classes
Functions
Module Contents
- qcodespp.instrument_drivers.QDevil.QSwitch.State
- qcodespp.instrument_drivers.QDevil.QSwitch.OneOrMore
- qcodespp.instrument_drivers.QDevil.QSwitch.channel_list_to_state(channel_list: str) State
- qcodespp.instrument_drivers.QDevil.QSwitch.state_to_expanded_list(state: State) str
- qcodespp.instrument_drivers.QDevil.QSwitch.state_to_compressed_list(state: State) str
- qcodespp.instrument_drivers.QDevil.QSwitch.expand_channel_list(channel_list: str) str
- qcodespp.instrument_drivers.QDevil.QSwitch.compress_channel_list(channel_list: str) str
- qcodespp.instrument_drivers.QDevil.QSwitch.relay_lines = 24
- qcodespp.instrument_drivers.QDevil.QSwitch.relays_per_line = 10
- class qcodespp.instrument_drivers.QDevil.QSwitch.QSwitch(name: str, address: str, **kwargs: Unpack[InstrumentBaseKWArgs])
Bases:
qcodes.instrument.visa.InstrumentBase class for all QCodes instruments.
- Args:
- name: an identifier for this instrument, particularly for
attaching it to a Station.
- metadata: additional static metadata to add to this
instrument’s JSON snapshot.
- label: nicely formatted name of the instrument; if None, the
nameis used.
- locked_relays = []
- reset() None
- soft_reset(force=False) None
- Resets the relays to the default state excluding the relays in self.locked_relays
The check for locked relays prevents accidentally reseting e.g. a gate in the case that the kernel is restarted but the locked_relays parameter is not updated.
- Args:
force (bool): If True, all relays are reset to the default state. Bypasses the check for locked relays.
- errors() str
Retrieve and clear all previous errors
- Returns:
str: Comma separated list of errors or ‘0, “No error”’
- error() str
Retrieve next error
- Returns:
str: The next error or ‘0, “No error”’
- state_force_update() None
- save_state(name: str, unique=False, overwrite=False) None
Save the current state of the relays
- Args:
name (str): Name of the saved state unique (bool): If True, save the state in a file with the serial number of the qswitch as an identifier
- load_state(name: str, unique=False) None
Load a saved state of the relays
- Args:
name (str): Name of the saved state unique (bool): If True, load the state from a file with the serial number of the qswitch as an identifier
- saved_states(unique=False) Dict[str, str]
Get a dictionary of saved states
- Args:
unique (bool): If True, load the state from a file with the serial number of the qswitch as an identifier
- Returns:
Dict[str, str]: Dictionary of saved states
- close_relays(relays: State) None
Close multiple relays at once.
- Args:
- relays: A list of tuples (line, tap) specifying the each relay to close.
e.g. [(1, 0), (2, 1)]
- close_relay(line: int, tap: int) None
Close a relay at the specified line and tap.
- Args:
line: The line number (1 to N*24) tap: The tap number (0 for ground, 1-8 for breakouts, 9 for connect)
- open_relays(relays: State) None
Open multiple relays at once.
- Args:
- relays: A list of tuples (line, tap) specifying the relays to open.
e.g. [(1, 0), (2, 1)]
- open_relay(line: int, tap: int) None
Open a relay at the specified line and tap.
- Args:
line: The line number (1 to N*24) tap: The tap number (0 for ground, 1-8 for breakouts, 9 for connect)
- ground(lines: OneOrMore) None
Connect one or more lines to ground (tap 0).
- Args:
lines: A line name, number, or list of names/numbers.
- connect(lines: OneOrMore) None
Connect the specified lines directly through to the output (i.e. connect tap 9)
- Args:
- lines: The line(s) to connect to the output. Specify a single line through its integer value
or its name, or multiple lines through a list of integers or names.
- connect_all() None
Connect all lines on all QSwitches through to their outputs, i.e. close tap 9 for all lines.
- breakout(line: str | int, tap: str | int) None
Connect the specified line to the specified tap and disconnect ground.
- Args:
line: The line to connect to the breakout. Specify either its integer value or its name. tap: The tap to connect the line to. Specify either its integer value or its name
- line_float(lines: OneOrMore) None
Open all relays on one or more lines such that the line is floating.
- Args:
- lines: The line(s) to float. Specify a single line through its integer value
or its name, or multiple lines through a list of integers or names.
- arrange(breakouts: Dict[str, int] | None = None, lines: Dict[str, int] | None = None) None
An arrangement of names for lines and breakouts
- Args:
breakouts (Dict[str, int]): Name/breakout pairs lines (Dict[str, int]): Name/line pairs
- start_recording_scpi() None
Record all SCPI commands sent to the instrument
Any previous recordings are removed. To inspect the SCPI commands sent to the instrument, call get_recorded_scpi_commands().
- get_recorded_scpi_commands() List[str]
- Returns:
Sequence[str]: SCPI commands sent to the instrument
- clear_read_queue() Sequence[str]
Flush the VISA message queue of the instrument
Takes at least _message_flush_timeout_ms to carry out.
- Returns:
Sequence[str]: Messages lingering in queue
- write(cmd: str) None
Send SCPI command to instrument
- Args:
cmd (str): SCPI command
- ask(cmd: str) str
Send SCPI query to instrument
- Args:
cmd (str): SCPI query
- Returns:
str: SCPI answer
- class qcodespp.instrument_drivers.QDevil.QSwitch.QSwitches(qsws, linked_BNCs=None, name='qsws', **kwargs)
Bases:
qcodes.instrument.visa.InstrumentTreat multiple QSwitches as a single instrument.
Lines are numbered 1 to N*24 where N is the number of QSwitches BNC taps are numbered 1-8, 11-18, 21-28, etc. Special taps ‘ground’ and ‘connect’ remain marked as 0 and 9.
linked_BNCs supports the case of externally linking the front BNCs such that e.g. a single instrument input/output can be connected to any of the N*24 lines. The user can then use the lowest value defined by the link. e.g. if linked_BNCs=[[1,11],[2,12]] then qsws.close_relay(28,1) is equivalent to qsws.close_relay(28,11), and so on. It is assumed maximum one link per QSwitch, since otherwise links can be made internally.
- Args:
- qsws (sequence[QSwitches]): list of already initialized/connected qswitches OR
list of addresses (str) of qswitches to be initialized/connected.
linked_BNCs (list[list]): list of linked BNCs, e.g. [[1,11],[2,12],[4,31]]. name (str): QCodes name. Default = ‘qsws’
- Usage:
qsw1 = QSwitch(…) qsw2 = QSwitch(…) qsws = QSwitches([qsw1, qsw2])
- qsws = []
- linked_BNCs = None
- state
- closed_relays
- overview
- auto_save
- locked_relays = []
- get_idn()
Parse a standard VISA
*IDN?response into an ID dict.Even though this is the VISA standard, it applies to various other types as well, such as IPInstruments, so it is included here in the Instrument base class.
Override this if your instrument does not support
*IDN?or returns a nonstandard IDN string. This string is supposed to be a comma-separated list of vendor, model, serial, and firmware, but semicolon and colon are also common separators so we accept them here as well.- Returns:
A dict containing vendor, model, serial, and firmware.
- reset()
Reset all QSwitches to their default state, i.e. connected to ground through 1MOhm.
- soft_reset(force=False) None
Soft reset all QSwitches, i.e. connect all lines through 1MOhm to ground unless locked via self.locked_relays.
- errors() str
- error() str
- state_force_update() None
- abort() None
- save_state(name: str, overwrite=False) None
- load_state(name: str) None
- saved_states() Dict[str, str]
- open_relay(line: int, tap: int) None
Open a relay at the specified line and tap.
- Args:
line: The line number (1 to N*24) tap: The tap number (0 for ground, 1-8 for breakouts, 9 for connect)
- close_relay(line: int, tap: int) None
Close a relay at the specified line and tap.
- Args:
line: The line number (1 to N*24) tap: The tap number (0 for ground, 1-8 for breakouts, 9 for connect)
- close_relays(relays: State) None
Close multiple relays at once.
- Args:
- relays: A list of tuples specifying the (line, tap) of each relay to close.
e.g. [(1, 0), (2, 1)]
- open_relays(relays: State) None
Open multiple relays at once.
- Args:
- relays: A list of tuples specifying the (line, tap) of each relay to open.
e.g. [(1, 0), (2, 1)]
- ground(lines: OneOrMore) None
Connect the specified lines to ground through 1MOhm resistors.
- Args:
- lines: The line(s) to connect to ground. Specify a single line through its integer value
or its name, or multiple lines through a list of integers or names.
- connect(lines: OneOrMore) None
Connect the specified lines directly through to the output (i.e. connect tap 9)
- Args:
- lines: The line(s) to connect to the output. Specify a single line through its integer value
or its name, or multiple lines through a list of integers or names.
- connect_all() None
Connect all lines on all QSwitches through to their outputs, i.e. close tap 9 for all lines.
- breakout(line: str | int, tap: str | int) None
Connect the specified line to the specified tap AND disconnect ground.
- Args:
line: The line to connect to the breakout. Specify either its integer value or its name. tap: The tap to connect the line to. Specify either its integer value or its name
- line_float(lines: OneOrMore) None
Open _all_ relays on one or more lines such that the line is floating.
- Args:
- lines: The line(s) to float. Specify a single line through its integer value
or its name, or multiple lines through a list of integers or names.
- arrange(breakouts: Dict[str, int] | None = None, lines: Dict[str, int] | None = None) None
An arrangement of names for lines and breakouts
- Args:
breakouts (Dict[str, int]): Name/breakout pairs lines (Dict[str, int]): Name/line pairs