This page was generated from docs/examples/driver_examples/Qcodes example with Keysight N9030B.ipynb. Interactive online version: Binder badge.

Qcodes example with Keysight N9030B

This notebook shows how to use Keysight N9030B instrument driver in Spectrum Analyzer and Phase Noise Modes for Swept SA and Log Plot measurements respectively.

Let’s begin!

[1]:
import numpy as np
import os
from qcodes.dataset import initialise_or_create_database_at, load_or_create_experiment, Measurement
from qcodes.dataset.plotting import plot_dataset, plot_by_id

from qcodes.instrument_drivers.Keysight.N9030B import N9030B
[2]:
driver = N9030B("n9030b","driver_address")
Connected to: Keysight Technologies N9030B (serial:MY56320646, firmware:A.24.57) in 0.35s
[3]:
driver.IDN()
[3]:
{'vendor': 'Keysight Technologies',
 'model': 'N9030B',
 'serial': 'MY56320646',
 'firmware': 'A.24.57'}

Spectrum Analyzer mode with Swept SA measurement

[4]:
sa = driver.sa
[5]:
sa.setup_swept_sa_sweep(start=200, stop= 10e3, npts=20001)

With QCoDeS Measurement

Initialize database and begin experiment…

[6]:
tutorial_db_path = os.path.join(os.getcwd(), 'tutorial.db')
initialise_or_create_database_at(tutorial_db_path)
load_or_create_experiment(experiment_name='tutorial_exp', sample_name="no sample")
Upgrading database; v0 -> v1: : 0it [00:00, ?it/s]
Upgrading database; v1 -> v2: 100%|█████████████████████████████████████████████████████| 1/1 [00:00<00:00, 334.71it/s]
Upgrading database; v2 -> v3: : 0it [00:00, ?it/s]
Upgrading database; v3 -> v4: : 0it [00:00, ?it/s]
Upgrading database; v4 -> v5: 100%|█████████████████████████████████████████████████████| 1/1 [00:00<00:00, 167.42it/s]
Upgrading database; v5 -> v6: : 0it [00:00, ?it/s]
Upgrading database; v6 -> v7: 100%|██████████████████████████████████████████████████████| 1/1 [00:00<00:00, 91.64it/s]
Upgrading database; v7 -> v8: 100%|█████████████████████████████████████████████████████| 1/1 [00:00<00:00, 202.59it/s]
Upgrading database; v8 -> v9: 100%|█████████████████████████████████████████████████████| 1/1 [00:00<00:00, 202.59it/s]
[6]:
tutorial_exp#no sample#1@C:\Users\asic\Documents\tutorial.db
------------------------------------------------------------
[7]:
meas1 = Measurement()
meas1.register_parameter(sa.trace)
[7]:
<qcodes.dataset.measurements.Measurement at 0x25fc9145e48>
[8]:
with meas1.run() as datasaver:
    datasaver.add_result((sa.trace, sa.trace.get()))

dataset = datasaver.dataset
Starting experimental run with id: 1.

Plot data

[9]:
_ = plot_dataset(dataset)
../../_images/examples_driver_examples_Qcodes_example_with_Keysight_N9030B_14_0.png

Phase Noise mode with Log Plot measurement

[10]:
pn = driver.pn
[11]:
pn.setup_log_plot_sweep(start_offset=10, stop_offset=200, npts=1001)

With QCoDeS Measurement

[12]:
meas2 = Measurement()
meas2.register_parameter(pn.trace)
[12]:
<qcodes.dataset.measurements.Measurement at 0x25fca246c08>
[13]:
with meas2.run() as datasaver:
    datasaver.add_result((pn.trace, pn.trace.get()))

run_id = datasaver.run_id
Starting experimental run with id: 2.
[n9030b_pn(PhaseNoiseMode)] Carrier(s) Incorrect or Missing!

Plot data

[14]:
_ = plot_by_id(run_id)
../../_images/examples_driver_examples_Qcodes_example_with_Keysight_N9030B_22_0.png
[ ]: