Please also note the extensions to this driver in Qcodes example with Signal Hound USB-SA124B ParameterWithSetpoints
%matplotlib notebook
from qcodes.dataset import Measurement, plot_by_id
from qcodes.instrument_drivers.signal_hound import SignalHoundUSBSA124B
sh = SignalHoundUSBSA124B("mysignalhound")
Connected to: Signal Hound sa124B (serial:17172185, firmware:Version 3.13) in 6.21s
The primary functionality of the Signal Hound driver is to capture a frequency trace. The frequency trace is defined by the center frequency and span. After changing any parameter on the Signal Hound is is important to sync the parameters to the device or you will get a runtime error.
sh.frequency(1e9)
sh.span(10e6)
sh.configure()
We can now capture a trace.
meas = Measurement()
meas.register_parameter(sh.trace)
with meas.run() as datasaver:
datasaver.add_result(
(
sh.trace,
sh.trace(),
)
)
runid = datasaver.run_id
Starting experimental run with id: 357
plot_by_id(runid)
([<matplotlib.axes._subplots.AxesSubplot at 0x158d5573d68>], [None])
In this case we are not measuring any signal so as expected we see noise
The driver supports averaging over multiple traces simply by setting the number of averages
sh.avg(10)
meas = Measurement()
meas.register_parameter(sh.trace)
with meas.run() as datasaver:
datasaver.add_result(
(
sh.trace,
sh.trace(),
)
)
runid = datasaver.run_id
Starting experimental run with id: 358
plot_by_id(runid)
([<matplotlib.axes._subplots.AxesSubplot at 0x158d68410b8>], [None])
We note that the spread of the noise level has gone down compared to a single measurement
The Spectrum Analyzer also supports measuring the power at a specific frequency. This works by capturing a trace with a span of 250 KHz (The minimum supported)around the center frequency and returning the maximum value in that range.
sh.power()
-98.23629913330078
sh.close()