<jupyter_start><jupyter_text>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!<jupyter_code>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
driver = N9030B("n9030b","driver_address")
driver.IDN()<jupyter_output><empty_output><jupyter_text>Spectrum Analyzer mode with Swept SA measurement<jupyter_code>sa = driver.sa
sa.setup_swept_sa_sweep(start=200, stop= 10e3, npts=20001)<jupyter_output><empty_output><jupyter_text>With QCoDeS Measurement Initialize database and begin experiment...<jupyter_code>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")
meas1 = Measurement()
meas1.register_parameter(sa.trace)
with meas1.run() as datasaver:
    datasaver.add_result((sa.trace, sa.trace.get()))

dataset = datasaver.dataset<jupyter_output>Starting experimental run with id: 1.<jupyter_text>Plot data<jupyter_code>_ = plot_dataset(dataset)<jupyter_output><empty_output><jupyter_text>Phase Noise mode with Log Plot measurement<jupyter_code>pn = driver.pn
pn.setup_log_plot_sweep(start_offset=10, stop_offset=200, npts=1001)<jupyter_output><empty_output><jupyter_text>With QCoDeS Measurement<jupyter_code>meas2 = Measurement()
meas2.register_parameter(pn.trace)
with meas2.run() as datasaver:
    datasaver.add_result((pn.trace, pn.trace.get()))

run_id = datasaver.run_id<jupyter_output>Starting experimental run with id: 2.<jupyter_text>Plot data<jupyter_code>_ = plot_by_id(run_id)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09461578672242552, 'fraction_numerical': 0.027182435964453737, 'mean_word_length': 9.459016393442623, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '352727', 'license': 'MIT', 'n_tokens_mistral': 738, 'n_tokens_neox': 665, 'n_words': 125, 'path': 'docs/examples/driver_examples/Qcodes example with Keysight N9030B.ipynb', 'repo_name': 'jakeogh/Qcodes', 'size': '1913'}