qcodes_contrib_drivers.drivers.TinySA package¶
Submodules¶
qcodes_contrib_drivers.drivers.TinySA.basic module¶
Interface for the tinySA Basic spectrum analyser.
Provides a Python driver for the tinySA Basic spectrum analyser.
Documentation:
tinySA: https://www.tinysa.org/wiki/
Unofficial Python API: https://github.com/LC-Linkous/tinySA_python
See docs/examples/ for example notebooks.
Written by Edward Laird (http://wp.lancs.ac.uk/laird-group/).
- class qcodes_contrib_drivers.drivers.TinySA.basic.ListPortsModule(*args, **kwargs)[source]¶
Bases:
ProtocolProtocol for the list_ports module used for USB autodetection.
- class qcodes_contrib_drivers.drivers.TinySA.basic.SerialHandle(*args, **kwargs)[source]¶
Bases:
ProtocolProtocol for the subset of pyserial’s Serial API used by this driver.
- class qcodes_contrib_drivers.drivers.TinySA.basic.TinySABasic(*args: Any, **kwargs: Any)[source]¶
Bases:
InstrumentQCoDeS driver for the tinySA Basic spectrum analyser.
This driver communicates with the instrument over its serial command interface via pyserial. It provides QCoDeS parameters for sweep configuration, output configuration, and trace acquisition.
Reading measurement_trace triggers a fresh sweep and returns the trace data with frequency as the corresponding setpoints.
- ask_raw(command: str) str[source]¶
Low level method to write to the hardware and return a response.
Subclasses that define a new hardware communication should override this method. Subclasses that transform
cmdshould instead overrideask.- Parameters:
cmd – The string to send to the instrument.
- close() None[source]¶
Irreversibly stop this instrument and free its resources.
Subclasses should override this if they have other specific resources to close.
- get_idn() dict[str, str | None][source]¶
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.
- refresh_sweep() ndarray[source]¶
Acquire a fresh trace and update the parameter caches.
The caches are kept only so QCoDeS can snapshot the trace and matching frequency setpoints consistently after the acquisition.
- write_raw(command: str) None[source]¶
Low level method to write a command string to the hardware.
Subclasses that define a new hardware communication should override this method. Subclasses that transform
cmdshould instead overridewrite.- Parameters:
cmd – The string to send to the instrument.
- ALLOWED_RBW_HZ = ('auto', 3000, 10000, 30000, 100000, 300000, 600000)¶
- ALLOWED_SWEEP_NPTS = (51, 101, 145, 290)¶
- MODE_VALUES = {'high_input': ('high', 'input'), 'high_output': ('high', 'output'), 'low_input': ('low', 'input'), 'low_output': ('low', 'output')}¶
- frequency: Parameter = self.add_parameter( "frequency", label="Frequency", unit="Hz", get_cmd=self._get_frequency_axis, set_cmd=False, vals=Arrays(shape=(self._point_count,)), )¶
Parameter frequency, which serves as the setpoints for measurement_trace.
- level: Parameter = self.add_parameter( "level", label="Output Level", unit="dBm", get_cmd=self._get_level, set_cmd=self._set_level, vals=Numbers(), )¶
RF output level.
- measurement_trace: ParameterWithSetpoints = self.add_parameter( "measurement_trace", label="Measurement Trace", unit="dBm", get_cmd=self._get_measurement_trace, set_cmd=False, parameter_class=ParameterWithSetpoints, setpoints=(self.frequency,), vals=Arrays(shape=(self._point_count,)), )¶
The measurement trace acquired from the instrument. Reading this parameter triggers a new sweep, and the frequency parameter is updated as the corresponding setpoints.
- mode: Parameter = self.add_parameter( "mode", label="tinySA Mode", get_cmd=self._get_mode, set_cmd=self._set_mode, vals=Enum(*self.MODE_VALUES), )¶
Which port to use and whether it’s an input or output mode.
- npts: Parameter = self.add_parameter( "npts", label="Sweep Points", get_cmd=self._get_npts, set_cmd=self._set_npts, vals=Enum(*self.ALLOWED_SWEEP_NPTS), )¶
Number of points for the sweep.
- output_frequency: Parameter = self.add_parameter( "output_frequency", label="Output Frequency", unit="Hz", get_cmd=self._get_output_frequency, set_cmd=self._set_output_frequency, vals=Numbers(min_value=0), )¶
RF output frequency.
- rbw: Parameter = self.add_parameter( "rbw", label="Resolution Bandwidth", unit="Hz", get_cmd=self._get_rbw, set_cmd=self._set_rbw, vals=Enum(*self.ALLOWED_RBW_HZ), )¶
Resolution Bandwidth.
- rf_output: Parameter = self.add_parameter( "rf_output", label="RF Output", get_cmd=self._get_rf_output, set_cmd=self._set_rf_output, vals=Enum("on", "off", "unknown"), )¶
Whether the RF output is enabled. Only meaningful in output modes, but can be read in any mode.
- start: Parameter = self.add_parameter( "start", label="Start Frequency", unit="Hz", get_cmd=self._get_start, set_cmd=self._set_start, vals=Numbers(min_value=0), )¶
Start frequency for the sweep.
- stop: Parameter = self.add_parameter( "stop", label="Stop Frequency", unit="Hz", get_cmd=self._get_stop, set_cmd=self._set_stop, vals=Numbers(min_value=0), )¶
Stop frequency for the sweep.
- class qcodes_contrib_drivers.drivers.TinySA.basic.TinySASerialBackend(port: str | None = None, *, timeout: float = 5.0, vid: int = 1155, pid: int = 22336)[source]¶
Bases:
objectMinimal serial backend for tinySA.
The command semantics follow the documented tinySA_python API: - mode {low|high} {input|output} - scan {start} {stop} [npts] [outmask] - output on|off
- get_rbw() str | int[source]¶
Read RBW from the instrument and return it in Hz.
The tinySA reports numeric RBW values in kHz. This method normalises the response to the driver-facing Hz convention.
- scan(start: float, stop: float, npts: int, *, outmask: int = 2) ndarray[source]¶
Run a sweep and return the first numeric column of the response.
- set_rbw(value: str | int) None[source]¶
Set RBW using the driver-facing unit convention.
The QCoDeS layer uses Hz, but the tinySA command expects kHz, so numeric values are converted here before being sent to the instrument.
- PROMPT = b'ch>'¶