qcodespp.instrument_drivers.oxford.serial

Classes

Module Contents

class qcodespp.instrument_drivers.oxford.serial.SerialInstrument(name, address=None, baudrate=9600, timeout=5, stopbits=1, terminator='', **kwargs)

Bases: qcodes.Instrument

Base 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

name is used.

classmethod default_server_name(**kwargs)
set_address(address)

Change the address for this instrument.

Args:
address: The visa resource name to use to connect.

Optionally includes ‘@<backend>’ at the end. For example, ‘ASRL2’ will open COM2 with the default NI backend, but ‘ASRL2@py’ will open COM2 using pyvisa-py. Note that qcodes does not install (or even require) ANY backends, it is up to the user to do that. see eg: http://pyvisa.readthedocs.org/en/stable/names.html

set_timeout(timeout=None)

Change the read timeout for the socket.

Args:

timeout (number): Seconds to allow for responses.

set_terminator(terminator)

Change the read terminator to use.

Args:
terminator (str): Character(s) to look for at the end of a read.

eg. ‘

‘.

close()

Disconnect and irreversibly tear down the instrument.

write(cmd)

Write a command string with NO response to the hardware.

Subclasses that transform cmd should override this method, and in it call super().write(new_cmd). Subclasses that define a new hardware communication should instead override write_raw.

Args:

cmd (str): the string to send to the instrument

Raises:
Exception: wraps any underlying exception with extra context,

including the command and the instrument.

write_raw(cmd)

Low-level interface to serial_handle.write.

Args:

cmd (str): The command to send to the instrument.

read_raw(size=200)
read()
read_until()
ask(cmd)

Write a command string to the hardware and return a response.

Subclasses that transform cmd should override this method, and in it call super().ask(new_cmd). Subclasses that define a new hardware communication should instead override ask_raw.

Args:

cmd: The string to send to the instrument.

Returns:

response

Raises:
Exception: Wraps any underlying exception with extra context,

including the command and the instrument.

ask_raw(cmd)

Low-level interface to serial_handle.ask.

Args:

cmd (str): The command to send to the instrument.

Returns:

str: The instrument’s response.

snapshot_base(update=False)

State of the instrument as a JSON-compatible dict.

Args:
update (bool): If True, update the state by querying the

instrument. If False, just use the latest values in memory.

Returns:

dict: base snapshot