<jupyter_start><jupyter_text>QCoDeS Example with Keysight Infiniium OscilloscopesThis notebook is indendet to give an overview over the functions implemented in the QCoDeS driver for the Keysight Infinium Oscilloscopes. The driver has been tested with the MSOS104A and MSOS254A.Please note that the oscilloscopes have plenty of more functions, that have not yet been implemented. Feel free to contribute, request features or report bugs.<jupyter_code>%matplotlib inline<jupyter_output><empty_output><jupyter_text>Importing Dependencies<jupyter_code># qcodes imports
import qcodes as qc
import qcodes.instrument_drivers.Keysight.Infiniium as MSO
from qcodes.utils.dataset.doNd import do0d

exp = qc.load_or_create_experiment("MSO_Documentation", "no_sample")<jupyter_output>Logging hadn't been started.
Activating auto-logging. Current session state plus future input saved.
Filename       : C:\Users\spauka\.qcodes\logs\command_history.log
Mode           : append
Output logging : True
Raw input log  : False
Timestamping   : True
State          : active
Qcodes Logfile : C:\Users\spauka\.qcodes\logs\220214-8232-qcodes.log<jupyter_text>Create the Instrumentplease insert the right address of your local scope (TCPIP...) you can find the address with the NI-MAX app or within the network settings of the scope.<jupyter_code>mso = MSO.Infiniium('MSO', 'TCPIP0::10.1.1.136::inst0::INSTR')<jupyter_output>Connected to: KEYSIGHT TECHNOLOGIES MSOS254A (serial:MY57220130, firmware:06.71.00202) in 0.05s<jupyter_text>Prepare TraceIn this example we are going to acquire a 10MHz sine wave at ~8.5dBm from a waveform generator at connected to channel 4 of the scope. Therefore: - all the other channels are hidden - the time scale is adjusted to measure a few periods of the waveform - the time scale is adjusted to have times starting from zero - the range of channel four is set to 2.5V.<jupyter_code>for i in range(4):
    mso.channels[i].display(False)
mso.ch4.display(True)
mso.timebase_range(0.5e-6)
mso.timebase_position(mso.timebase_range()/2)
mso.ch4.range(2.5)<jupyter_output><empty_output><jupyter_text>Trigger Setupwe want to use the input signal itself as the trigger. Therefor the trigger is first enabled, the trigger source is set.<jupyter_code>mso.trigger_edge_source('CHAN4')
mso.trigger_edge_slope('NEG')
mso.ch4.trigger_level(0)<jupyter_output><empty_output><jupyter_text>Data AcquisitionWe are going to acquire 5k datapoints and set the sample rate such that the entire waveform is shown on screen. This requires a sample rate of 10Gsps. In addition, we disable interpolation so that the scope only returns 5000 points, rather than interpolating between sampled points.We also run the trace to verify that it looks correct on the scope.<jupyter_code>nPoints = 5000
mso.acquire_points(nPoints)
mso.sample_rate(nPoints/mso.timebase_range())
mso.acquire_interpolate(0)

mso.run()<jupyter_output><empty_output><jupyter_text>Then the parameter can be acquired with a qcodes measurement.<jupyter_code>do0d(mso.ch4.trace, do_plot=True)<jupyter_output>Starting experimental run with id: 82. Using 'qcodes.utils.dataset.doNd.do0d'<jupyter_text>We can also acquire measurements from the waveform such as the amplitude and the frequency.<jupyter_code>ds, _, _ = do0d(mso.ch4.measure.amplitude, mso.ch4.measure.frequency)
df = ds.to_pandas_dataframe()
df<jupyter_output>Starting experimental run with id: 83. Using 'qcodes.utils.dataset.doNd.do0d'<jupyter_text>Acquiring Multiple ChannelsIf we want to acquire multiple channels, we can disable automatic digitization and manually digitize once for each acquisition. To do this, we use the `mso.digitize` function.In this example, we connect a 1Vpp square wave at 1MHz to ch1, a 1.2Vpp sine wave at 1MHz to ch2 and a 0.5V ramp and 1MHz to ch3.<jupyter_code># Disable automatic digitization
mso.auto_digitize(False)

# Set up inputs
for ch in mso.channels[:3]:
    ch.display('on')
    ch.range(2.0)
mso.ch4.display('off')

# Set up timebase
mso.timebase_range(5e-6)
mso.timebase_position(0)
mso.sample_rate(10e9)
mso.acquire_points(50_000)

# Set up trigger
mso.trigger_edge_source('CHAN1')
mso.ch1.trigger_level(0)

# Take the measurement
mso.digitize()
do0d(mso.ch1.trace, mso.ch2.trace, mso.ch3.trace, do_plot=True)

# Set the scope back to free-running mode
mso.run()<jupyter_output>Starting experimental run with id: 84. Using 'qcodes.utils.dataset.doNd.do0d'
{'fraction_non_alphanumeric': 0.08178522881739918, 'fraction_numerical': 0.02877208880833711, 'mean_word_length': 5.649096385542169, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '127503', 'license': 'MIT', 'n_tokens_mistral': 1547, 'n_tokens_neox': 1448, 'n_words': 458, 'path': 'docs/examples/driver_examples/Qcodes example with Keysight Infiniium Oscilloscope.ipynb', 'repo_name': 'edumur/Qcodes', 'size': '4414'}