SHFQA Sweeper#

Requirements:

  • LabOne >= 22.02

  • Instruments: 1 x SHFQA

Create a toolkit session to the data server and connect the device:

[1]:
from zhinst.toolkit import Session

session = Session("localhost")
device = session.connect_device("DEVXXXX")
sweeper = session.modules.shfqa_sweeper
CHANNEL = 0

For now the general sweeper module does not support the SHFQA. However a python based implementation called SHFSweeper does already provide this functionality. The SHFSweeper is part of the zhinst module and can be found in the utils.

Toolkit wraps around the SHFSweeper and exposes a interface that is similar to the LabOne modules, meaning the parameters are exposed in a node tree like structure.

All parameters can be accessed through their corresponding node:

  • device: Device to run the sweeper with

  • sweep: Frequency range settings for a sweep

  • rf: RF in- and output settings for a sweep

  • average: Averaging settings for a sweep

  • trigger: Settings for the trigger

  • envelope: Settings for defining a complex envelope for pulsed spectroscopy

The underlying module is updated with the parameter changes automatically. Every functions from the underlying SHFSweeper module is exposed and can be used in the same way.

Run a frequency sweep#

Configure the sweeper#

(Besides the measurement specific parameters the device that the sweeper will use must be specified as well.)

[2]:
sweeper.device(device)

sweeper.sweep.start_freq(200e6)
sweeper.sweep.stop_freq(300e6)
sweeper.sweep.num_points(501)
sweeper.sweep.oscillator_gain(0.8)
# The sequencer is used by default but can be disabled manually
# sweeper.sweep.mode("host-driven")
sweeper.sweep.mode("sequencer-based")

sweeper.average.integration_time(100e-6)
sweeper.average.num_averages(200)
sweeper.average.mode("sequential")


sweeper.rf.channel(CHANNEL)
sweeper.rf.input_range(0)
sweeper.rf.output_range(0)
sweeper.rf.center_freq(4e9)

Turn on the input / output channel#

[3]:
with device.set_transaction():
    device.qachannels[CHANNEL].input.on(1)
    device.qachannels[CHANNEL].output.on(1)

Execute the sweeper#

[4]:
result = sweeper.run()
num_points_result = len(result["vector"])
print(f"Measured at {num_points_result} frequency points.")
Run a sweep with 501 frequency points in the range of [200.0, 300.0] MHz + 4.0 GHz.
Mapping is linear.
Integration time = 0.0001 sec.
Measures 200 times per frequency point.
Averaging mode is sequential.
Trigger source is set to None, which means the sequencer defines the repetition rate.
Measurement (100200/100200) at 300.000MHz.
Measured at 501 frequency points.
[5]:
sweeper.plot()
../_images/examples_shfqa_sweeper_9_0.png

Pulsed resonator with complex envelope#

Create the envelope#

[6]:
from scipy.signal import gaussian
import numpy as np

SHFQA_SAMPLING_FREQUENCY = 2e9
envelope_duration = 1.0e-6
envelope_rise_fall_time = 0.05e-6

rise_fall_len = int(envelope_rise_fall_time * SHFQA_SAMPLING_FREQUENCY)
std_dev = rise_fall_len // 10
gauss = gaussian(2 * rise_fall_len, std_dev)
flat_top_gaussian = np.ones(int(envelope_duration * SHFQA_SAMPLING_FREQUENCY))
flat_top_gaussian[0:rise_fall_len] = gauss[0:rise_fall_len]
flat_top_gaussian[-rise_fall_len:] = gauss[-rise_fall_len:]

Plot Envelope

[7]:
import matplotlib.pyplot as plt
plt.plot(flat_top_gaussian)
plt.show()
../_images/examples_shfqa_sweeper_13_0.png

Configure the sweeper#

[8]:
sweeper.device(device)

sweeper.sweep.start_freq(-200e6)
sweeper.sweep.stop_freq(300e6)
sweeper.sweep.num_points(51)
sweeper.sweep.oscillator_gain(0.8)
sweeper.sweep.use_sequencer=False

sweeper.average.integration_time(envelope_duration)
sweeper.average.num_averages(2)
sweeper.average.mode("sequential")
sweeper.average.integration_delay(0.0)

sweeper.rf.channel(CHANNEL)
sweeper.rf.input_range(0)
sweeper.rf.output_range(0)
sweeper.rf.center_freq(4e9)

sweeper.envelope.enable(True)
sweeper.envelope.waveform(flat_top_gaussian)
sweeper.envelope.delay(0.0)

Turn on the input / output channel#

[9]:
with device.set_transaction():
    device.qachannels[CHANNEL].input.on(1)
    device.qachannels[CHANNEL].output.on(1)

Execute the sweeper#

[10]:
result = sweeper.run()
num_points_result = len(result["vector"])
print(f"Measured at {num_points_result} frequency points.")
Run a sweep with 51 frequency points in the range of [-200.0, 300.0] MHz + 4.0 GHz.
Mapping is linear.
Integration time = 1e-06 sec.
Measures 2 times per frequency point.
Averaging mode is sequential.
Trigger source is set to None, which means the sequencer defines the repetition rate.
Measurement (102/102) at 300.000MHz.
Measurement (102/102) at 300.000MHz.
Measured at 51 frequency points.
[11]:
sweeper.plot()
../_images/examples_shfqa_sweeper_20_0.png
[ ]: