From a837e39b12c55efcffe042f976d36295ccdaa1ab Mon Sep 17 00:00:00 2001 From: "Jens H. Nielsen" Date: Mon, 24 Aug 2026 20:56:42 +0200 Subject: [PATCH 1/7] Stop using deprecated qcodes short hands in the notebooks The top level aliases such as qcodes.Station and qcodes.Measurement are deprecated and emit a warning at runtime. They are also hidden from type checkers on purpose, so every use was reported as an unresolved attribute. Import the names from their submodules, which is what the deprecation warning asks for, and drop the qcodes alias where nothing else used it. --- docs/changes/newsfragments/8372.improved | 4 ++++ docs/examples/DataSet/Cache/write_for_caching.ipynb | 6 +++--- .../Exporting-data-to-other-file-formats.ipynb | 5 +++-- docs/examples/DataSet/InMemoryDataSet.ipynb | 6 +++--- ...rements-using-qcodes-parameters-and-dataset.ipynb | 4 ++-- .../Example Measurements with Real Instruments.ipynb | 10 +++++----- .../DataSet/Working-With-Pandas-and-XArray.ipynb | 6 +++--- .../basic_examples/15_minutes_to_QCoDeS.ipynb | 5 +++-- .../QCoDeS example with Aim TTi PL601-P.ipynb | 6 +++--- .../QCoDeS example with CopperMountain_M5065.ipynb | 4 ++-- .../QCoDeS example with DelegateInstrument.ipynb | 10 +++++----- ...CoDeS example with Galil DMC4133 Controller.ipynb | 6 +++--- ...S example with Keithley 3706A System Switch.ipynb | 6 +++--- .../Qcodes example with Keithley 2600.ipynb | 9 +++++---- ...ht B2200 Series Femto Leakage Switch Matrix.ipynb | 6 +++--- ...xample with Keysight Infiniium Oscilloscope.ipynb | 5 ++--- .../Qcodes example with Rohde Schwarz ZNB.ipynb | 12 ++++++------ ...to-use-Plottr-with-QCoDeS-for-live-plotting.ipynb | 3 ++- 18 files changed, 60 insertions(+), 53 deletions(-) create mode 100644 docs/changes/newsfragments/8372.improved diff --git a/docs/changes/newsfragments/8372.improved b/docs/changes/newsfragments/8372.improved new file mode 100644 index 000000000000..443af6fe81fd --- /dev/null +++ b/docs/changes/newsfragments/8372.improved @@ -0,0 +1,4 @@ +The example notebooks no longer use the deprecated short hand aliases in the top +level ``qcodes`` namespace, such as ``qcodes.Station`` and ``qcodes.Measurement``. +They import the names from their respective submodules instead, which is what +the deprecation warning asks users to do and what keeps type information. diff --git a/docs/examples/DataSet/Cache/write_for_caching.ipynb b/docs/examples/DataSet/Cache/write_for_caching.ipynb index 480a46c7f05c..ce60b5ca2b8b 100644 --- a/docs/examples/DataSet/Cache/write_for_caching.ipynb +++ b/docs/examples/DataSet/Cache/write_for_caching.ipynb @@ -43,12 +43,12 @@ "\n", "import numpy as np\n", "\n", - "import qcodes as qc\n", "from qcodes.dataset import Measurement, initialise_database, load_or_create_experiment\n", "from qcodes.instrument_drivers.mock_instruments import (\n", " DummyInstrument,\n", " DummyInstrumentWithMeasurement,\n", - ")" + ")\n", + "from qcodes.station import Station" ] }, { @@ -62,7 +62,7 @@ "dac = DummyInstrument(\"dac\", gates=[\"ch1\", \"ch2\"])\n", "dmm = DummyInstrumentWithMeasurement(\"dmm\", setter_instr=dac)\n", "\n", - "station = qc.Station(dmm, dac)" + "station = Station(dmm, dac)" ] }, { diff --git a/docs/examples/DataSet/Exporting-data-to-other-file-formats.ipynb b/docs/examples/DataSet/Exporting-data-to-other-file-formats.ipynb index f9175d0da1dc..8ea718a348e0 100644 --- a/docs/examples/DataSet/Exporting-data-to-other-file-formats.ipynb +++ b/docs/examples/DataSet/Exporting-data-to-other-file-formats.ipynb @@ -52,7 +52,8 @@ "from qcodes.instrument_drivers.mock_instruments import (\n", " DummyInstrument,\n", " DummyInstrumentWithMeasurement,\n", - ")" + ")\n", + "from qcodes.station import Station" ] }, { @@ -64,7 +65,7 @@ "# preparatory mocking of physical setup\n", "dac = DummyInstrument(\"dac\", gates=[\"ch1\", \"ch2\"])\n", "dmm = DummyInstrumentWithMeasurement(\"dmm\", setter_instr=dac)\n", - "station = qc.Station(dmm, dac)" + "station = Station(dmm, dac)" ] }, { diff --git a/docs/examples/DataSet/InMemoryDataSet.ipynb b/docs/examples/DataSet/InMemoryDataSet.ipynb index cfd0b6741b59..b8d17cab9963 100644 --- a/docs/examples/DataSet/InMemoryDataSet.ipynb +++ b/docs/examples/DataSet/InMemoryDataSet.ipynb @@ -25,7 +25,6 @@ "\n", "import numpy as np\n", "\n", - "import qcodes as qc\n", "from qcodes.dataset import (\n", " DataSetType,\n", " Measurement,\n", @@ -37,7 +36,8 @@ "from qcodes.instrument_drivers.mock_instruments import (\n", " DummyInstrument,\n", " DummyInstrumentWithMeasurement,\n", - ")" + ")\n", + "from qcodes.station import Station" ] }, { @@ -58,7 +58,7 @@ "dac = DummyInstrument(\"dac\", gates=[\"ch1\", \"ch2\"])\n", "dmm = DummyInstrumentWithMeasurement(name=\"dmm\", setter_instr=dac)\n", "\n", - "station = qc.Station(dmm, dac)" + "station = Station(dmm, dac)" ] }, { diff --git a/docs/examples/DataSet/Performing-measurements-using-qcodes-parameters-and-dataset.ipynb b/docs/examples/DataSet/Performing-measurements-using-qcodes-parameters-and-dataset.ipynb index 5a045f551d0b..39f2f381f891 100644 --- a/docs/examples/DataSet/Performing-measurements-using-qcodes-parameters-and-dataset.ipynb +++ b/docs/examples/DataSet/Performing-measurements-using-qcodes-parameters-and-dataset.ipynb @@ -65,7 +65,6 @@ "\n", "import numpy as np\n", "\n", - "import qcodes as qc\n", "from qcodes.dataset import (\n", " Measurement,\n", " initialise_or_create_database_at,\n", @@ -80,6 +79,7 @@ " DummyInstrumentWithMeasurement,\n", ")\n", "from qcodes.logger import start_all_logging\n", + "from qcodes.station import Station\n", "\n", "start_all_logging()" ] @@ -104,7 +104,7 @@ "dac = DummyInstrument(\"dac\", gates=[\"ch1\", \"ch2\"])\n", "dmm = DummyInstrumentWithMeasurement(name=\"dmm\", setter_instr=dac)\n", "\n", - "station = qc.Station(dmm, dac)" + "station = Station(dmm, dac)" ] }, { diff --git a/docs/examples/DataSet/Real_instruments/Example Measurements with Real Instruments.ipynb b/docs/examples/DataSet/Real_instruments/Example Measurements with Real Instruments.ipynb index a8dc31367f14..5c185a5bf8ad 100644 --- a/docs/examples/DataSet/Real_instruments/Example Measurements with Real Instruments.ipynb +++ b/docs/examples/DataSet/Real_instruments/Example Measurements with Real Instruments.ipynb @@ -24,15 +24,15 @@ "\n", "import numpy as np\n", "\n", - "import qcodes as qc\n", - "from qcodes.dataset import Measurement, plot_by_id\n", + "from qcodes.dataset import Measurement, new_experiment, plot_by_id\n", "from qcodes.instrument_drivers.Keysight.Infiniium import Infiniium\n", "\n", "# Drivers\n", "from qcodes.instrument_drivers.Keysight.KeysightAgilent_33XXX import (\n", " WaveformGenerator_33XXX,\n", ")\n", - "from qcodes.instrument_drivers.stanford_research.SR830 import SR830" + "from qcodes.instrument_drivers.stanford_research.SR830 import SR830\n", + "from qcodes.station import Station" ] }, { @@ -76,9 +76,9 @@ "key = WaveformGenerator_33XXX(\"Keysight\", \"TCPIP0::K-33522B-00256::inst0::INSTR\")\n", "mso = Infiniium(\"MSO\", \"TCPIP0::AGILENT-32C1770::inst0::INSTR\")\n", "\n", - "station = qc.Station(key, mso, sr830)\n", + "station = Station(key, mso, sr830)\n", "\n", - "qc.new_experiment(name=\"EMwRI\", sample_name=\"no_sample\")" + "new_experiment(name=\"EMwRI\", sample_name=\"no_sample\")" ] }, { diff --git a/docs/examples/DataSet/Working-With-Pandas-and-XArray.ipynb b/docs/examples/DataSet/Working-With-Pandas-and-XArray.ipynb index f64ef909bdfa..f47e7f99af16 100644 --- a/docs/examples/DataSet/Working-With-Pandas-and-XArray.ipynb +++ b/docs/examples/DataSet/Working-With-Pandas-and-XArray.ipynb @@ -57,7 +57,6 @@ "import numpy as np\n", "import pandas as pd\n", "\n", - "import qcodes as qc\n", "from qcodes.dataset import (\n", " Measurement,\n", " initialise_or_create_database_at,\n", @@ -66,7 +65,8 @@ "from qcodes.instrument_drivers.mock_instruments import (\n", " DummyInstrument,\n", " DummyInstrumentWithMeasurement,\n", - ")" + ")\n", + "from qcodes.station import Station" ] }, { @@ -78,7 +78,7 @@ "# preparatory mocking of physical setup\n", "dac = DummyInstrument(\"dac\", gates=[\"ch1\", \"ch2\"])\n", "dmm = DummyInstrumentWithMeasurement(\"dmm\", setter_instr=dac)\n", - "station = qc.Station(dmm, dac)" + "station = Station(dmm, dac)" ] }, { diff --git a/docs/examples/basic_examples/15_minutes_to_QCoDeS.ipynb b/docs/examples/basic_examples/15_minutes_to_QCoDeS.ipynb index f5928c74a89f..eb93ab14d378 100644 --- a/docs/examples/basic_examples/15_minutes_to_QCoDeS.ipynb +++ b/docs/examples/basic_examples/15_minutes_to_QCoDeS.ipynb @@ -75,7 +75,8 @@ ")\n", "\n", "## Using interactive widget\n", - "from qcodes.interactive_widget import experiments_widget" + "from qcodes.interactive_widget import experiments_widget\n", + "from qcodes.station import Station" ] }, { @@ -236,7 +237,7 @@ "metadata": {}, "outputs": [], "source": [ - "station = qc.Station()" + "station = Station()" ] }, { diff --git a/docs/examples/driver_examples/QCoDeS example with Aim TTi PL601-P.ipynb b/docs/examples/driver_examples/QCoDeS example with Aim TTi PL601-P.ipynb index b47d78e5a944..f70685607f7f 100644 --- a/docs/examples/driver_examples/QCoDeS example with Aim TTi PL601-P.ipynb +++ b/docs/examples/driver_examples/QCoDeS example with Aim TTi PL601-P.ipynb @@ -29,8 +29,8 @@ "metadata": {}, "outputs": [], "source": [ - "import qcodes as qc\n", - "from qcodes.instrument_drivers.AimTTi import AimTTiPL601" + "from qcodes.instrument_drivers.AimTTi import AimTTiPL601\n", + "from qcodes.station import Station" ] }, { @@ -46,7 +46,7 @@ "metadata": {}, "outputs": [], "source": [ - "station = qc.Station()" + "station = Station()" ] }, { diff --git a/docs/examples/driver_examples/QCoDeS example with CopperMountain_M5065.ipynb b/docs/examples/driver_examples/QCoDeS example with CopperMountain_M5065.ipynb index d17339df81f3..c410d18ecae6 100644 --- a/docs/examples/driver_examples/QCoDeS example with CopperMountain_M5065.ipynb +++ b/docs/examples/driver_examples/QCoDeS example with CopperMountain_M5065.ipynb @@ -16,9 +16,9 @@ "metadata": {}, "outputs": [], "source": [ - "import qcodes as qc\n", "from qcodes.dataset import (\n", " Measurement,\n", + " initialise_or_create_database_at,\n", " load_or_create_experiment,\n", " plot_by_id,\n", ")\n", @@ -135,7 +135,7 @@ "outputs": [], "source": [ "# create an empty database based on the config file\n", - "qc.initialise_or_create_database_at(\"./test_copper_mountain.db\")" + "initialise_or_create_database_at(\"./test_copper_mountain.db\")" ] }, { diff --git a/docs/examples/driver_examples/QCoDeS example with DelegateInstrument.ipynb b/docs/examples/driver_examples/QCoDeS example with DelegateInstrument.ipynb index a205eb86b813..b1154a35a685 100644 --- a/docs/examples/driver_examples/QCoDeS example with DelegateInstrument.ipynb +++ b/docs/examples/driver_examples/QCoDeS example with DelegateInstrument.ipynb @@ -70,12 +70,12 @@ "source": [ "from pathlib import Path\n", "\n", - "import qcodes as qc\n", "from qcodes.dataset import (\n", " Measurement,\n", " initialise_or_create_database_at,\n", " load_or_create_experiment,\n", - ")" + ")\n", + "from qcodes.station import Station" ] }, { @@ -85,7 +85,7 @@ "metadata": {}, "outputs": [], "source": [ - "station = qc.Station(config_file=\"delegate_instrument_example.yaml\")" + "station = Station(config_file=\"delegate_instrument_example.yaml\")" ] }, { @@ -552,7 +552,7 @@ "metadata": {}, "outputs": [], "source": [ - "station = qc.Station(config_file=\"delegate_instrument_example.yaml\")" + "station = Station(config_file=\"delegate_instrument_example.yaml\")" ] }, { @@ -682,7 +682,7 @@ "metadata": {}, "outputs": [], "source": [ - "station = qc.Station(config_file=\"delegate_instrument_example.yaml\")\n", + "station = Station(config_file=\"delegate_instrument_example.yaml\")\n", "lockin = station.load_lockin()\n", "dac = station.load_dac()" ] diff --git a/docs/examples/driver_examples/QCoDeS example with Galil DMC4133 Controller.ipynb b/docs/examples/driver_examples/QCoDeS example with Galil DMC4133 Controller.ipynb index 43662aa1bb99..48c6973d0a71 100644 --- a/docs/examples/driver_examples/QCoDeS example with Galil DMC4133 Controller.ipynb +++ b/docs/examples/driver_examples/QCoDeS example with Galil DMC4133 Controller.ipynb @@ -43,7 +43,8 @@ "source": [ "import numpy as np\n", "\n", - "from qcodes.instrument_drivers.Galil import GalilDMC4133Arm, GalilDMC4133Controller" + "from qcodes.instrument_drivers.Galil import GalilDMC4133Arm, GalilDMC4133Controller\n", + "from qcodes.station import Station" ] }, { @@ -1091,7 +1092,6 @@ }, "outputs": [], "source": [ - "import qcodes as qc\n", "from qcodes.dataset import (\n", " Measurement,\n", " initialise_or_create_database_at,\n", @@ -1115,7 +1115,7 @@ }, "outputs": [], "source": [ - "station = qc.Station()" + "station = Station()" ] }, { diff --git a/docs/examples/driver_examples/QCoDeS example with Keithley 3706A System Switch.ipynb b/docs/examples/driver_examples/QCoDeS example with Keithley 3706A System Switch.ipynb index 96d0f65eb52b..e8d995f27ba1 100644 --- a/docs/examples/driver_examples/QCoDeS example with Keithley 3706A System Switch.ipynb +++ b/docs/examples/driver_examples/QCoDeS example with Keithley 3706A System Switch.ipynb @@ -34,8 +34,8 @@ "metadata": {}, "outputs": [], "source": [ - "import qcodes as qc\n", - "from qcodes.instrument_drivers.Keithley import Keithley3706A" + "from qcodes.instrument_drivers.Keithley import Keithley3706A\n", + "from qcodes.station import Station" ] }, { @@ -51,7 +51,7 @@ "metadata": {}, "outputs": [], "source": [ - "station = qc.Station()" + "station = Station()" ] }, { diff --git a/docs/examples/driver_examples/Qcodes example with Keithley 2600.ipynb b/docs/examples/driver_examples/Qcodes example with Keithley 2600.ipynb index c80e1b0796d4..e09fb008b27a 100644 --- a/docs/examples/driver_examples/Qcodes example with Keithley 2600.ipynb +++ b/docs/examples/driver_examples/Qcodes example with Keithley 2600.ipynb @@ -14,16 +14,17 @@ "metadata": {}, "outputs": [], "source": [ - "import qcodes as qc\n", "from qcodes.dataset import (\n", " LinSweep,\n", + " Measurement,\n", " do0d,\n", " do1d,\n", " initialise_database,\n", " new_experiment,\n", " plot_dataset,\n", ")\n", - "from qcodes.instrument_drivers.Keithley import Keithley2614B" + "from qcodes.instrument_drivers.Keithley import Keithley2614B\n", + "from qcodes.station import Station" ] }, { @@ -52,7 +53,7 @@ "source": [ "# Create a station to hold all the instruments\n", "\n", - "station = qc.Station()\n", + "station = Station()\n", "\n", "# instantiate the Keithley and add it to the station\n", "\n", @@ -351,7 +352,7 @@ } ], "source": [ - "timemeas = qc.Measurement()\n", + "timemeas = Measurement()\n", "timemeas.register_parameter(keith.smua.timetrace)" ] }, diff --git a/docs/examples/driver_examples/Qcodes example with Keysight B2200 Series Femto Leakage Switch Matrix.ipynb b/docs/examples/driver_examples/Qcodes example with Keysight B2200 Series Femto Leakage Switch Matrix.ipynb index eae7ce31a16d..a15fdac21e34 100644 --- a/docs/examples/driver_examples/Qcodes example with Keysight B2200 Series Femto Leakage Switch Matrix.ipynb +++ b/docs/examples/driver_examples/Qcodes example with Keysight B2200 Series Femto Leakage Switch Matrix.ipynb @@ -34,8 +34,8 @@ "from IPython.display import Markdown, display\n", "from pyvisa.errors import VisaIOError\n", "\n", - "import qcodes as qc\n", - "from qcodes.instrument_drivers.Keysight import KeysightB2201" + "from qcodes.instrument_drivers.Keysight import KeysightB2201\n", + "from qcodes.station import Station" ] }, { @@ -99,7 +99,7 @@ "source": [ "# Create a station to hold all the instruments\n", "\n", - "station = qc.Station()\n", + "station = Station()\n", "\n", "# instantiate the Switch Matrix and add it to the station\n", "try:\n", diff --git a/docs/examples/driver_examples/Qcodes example with Keysight Infiniium Oscilloscope.ipynb b/docs/examples/driver_examples/Qcodes example with Keysight Infiniium Oscilloscope.ipynb index 436b8e70e538..54cb98893322 100644 --- a/docs/examples/driver_examples/Qcodes example with Keysight Infiniium Oscilloscope.ipynb +++ b/docs/examples/driver_examples/Qcodes example with Keysight Infiniium Oscilloscope.ipynb @@ -33,11 +33,10 @@ "outputs": [], "source": [ "# qcodes imports\n", - "import qcodes as qc\n", - "from qcodes.dataset import do0d\n", + "from qcodes.dataset import do0d, load_or_create_experiment\n", "from qcodes.instrument_drivers.Keysight import KeysightInfiniium\n", "\n", - "exp = qc.load_or_create_experiment(\"MSO_Documentation\", \"no_sample\")" + "exp = load_or_create_experiment(\"MSO_Documentation\", \"no_sample\")" ] }, { diff --git a/docs/examples/driver_examples/Qcodes example with Rohde Schwarz ZNB.ipynb b/docs/examples/driver_examples/Qcodes example with Rohde Schwarz ZNB.ipynb index 0d22e8eb049c..f39f86ecc42c 100644 --- a/docs/examples/driver_examples/Qcodes example with Rohde Schwarz ZNB.ipynb +++ b/docs/examples/driver_examples/Qcodes example with Rohde Schwarz ZNB.ipynb @@ -13,9 +13,9 @@ "metadata": {}, "outputs": [], "source": [ - "%matplotlib nbagg\n", + "from qcodes.station import Station\n", "\n", - "import qcodes as qc" + "%matplotlib nbagg" ] }, { @@ -95,7 +95,7 @@ ], "source": [ "vna = RohdeSchwarzZNB8(\"VNA\", \"TCPIP0::192.168.15.104::inst0::INSTR\")\n", - "station = qc.Station(vna)" + "station = Station(vna)" ] }, { @@ -1273,7 +1273,7 @@ "vna = RohdeSchwarzZNB8(\n", " \"VNA\", \"TCPIP0::192.168.15.104::inst0::INSTR\", init_s_params=False\n", ")\n", - "station = qc.Station(vna)" + "station = Station(vna)" ] }, { @@ -1368,7 +1368,7 @@ " init_s_params=False,\n", " reset_channels=False,\n", ")\n", - "station = qc.Station(vna)" + "station = Station(vna)" ] }, { @@ -1590,7 +1590,7 @@ " \"VNA\", \"TCPIP0::192.168.15.104::inst0::INSTR\", init_s_params=True\n", ")\n", "vna.rf_on()\n", - "station = qc.Station(vna)" + "station = Station(vna)" ] }, { diff --git a/docs/examples/plotting/How-to-use-Plottr-with-QCoDeS-for-live-plotting.ipynb b/docs/examples/plotting/How-to-use-Plottr-with-QCoDeS-for-live-plotting.ipynb index 472dd4ed8520..671479e5954a 100644 --- a/docs/examples/plotting/How-to-use-Plottr-with-QCoDeS-for-live-plotting.ipynb +++ b/docs/examples/plotting/How-to-use-Plottr-with-QCoDeS-for-live-plotting.ipynb @@ -39,6 +39,7 @@ " DummyInstrument,\n", " DummyInstrumentWithMeasurement,\n", ")\n", + "from qcodes.station import Station\n", "\n", "qc.logger.start_all_logging()" ] @@ -66,7 +67,7 @@ "dac = DummyInstrument(\"dac\", gates=[\"ch1\", \"ch2\"])\n", "dmm = DummyInstrumentWithMeasurement(name=\"dmm\", setter_instr=dac)\n", "\n", - "station = qc.Station(dmm, dac)" + "station = Station(dmm, dac)" ] }, { From 36247f0894518e8ec9f56d55ffffaeb6044426c3 Mon Sep 17 00:00:00 2001 From: "Jens H. Nielsen" Date: Tue, 25 Aug 2026 07:04:37 +0200 Subject: [PATCH 2/7] Fix renamed driver classes in two notebooks Infiniium was renamed to KeysightInfiniium and WaveformGenerator_33XXX to Keysight33xxx, and the deprecated aliases have since been removed, so Example Measurements with Real Instruments failed at its import cell. Use KeysightInfiniium and the model specific Keysight33522B, which is the instrument the example actually connects to and which the base classes tell you to use in preference to themselves. The DPO 72004C notebook imported TekronixDPOWaveform, missing a t. Note that the same misspelling appears in a docstring in DPO7200xx.py. Correcting the DPO import uncovered that the notebook attaches a waveform source straight to the instrument, while the driver declares the parent as a channel. The surrounding text already presents this as future work, so record that on the line rather than widening the driver's annotation. --- docs/changes/newsfragments/8378.improved | 8 ++++++++ .../Example Measurements with Real Instruments.ipynb | 10 +++++----- .../QCodes example with Tektronix DPO 72004C.ipynb | 7 +++++-- 3 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 docs/changes/newsfragments/8378.improved diff --git a/docs/changes/newsfragments/8378.improved b/docs/changes/newsfragments/8378.improved new file mode 100644 index 000000000000..83300b91650e --- /dev/null +++ b/docs/changes/newsfragments/8378.improved @@ -0,0 +1,8 @@ +Two example notebooks referred to driver classes under names that no longer +exist. ``Example Measurements with Real Instruments`` used ``Infiniium`` and +``WaveformGenerator_33XXX``, which were renamed to ``KeysightInfiniium`` and +``Keysight33xxx``; it now uses ``KeysightInfiniium`` and the model specific +``Keysight33522B``, matching the instrument the example connects to. The +``Tektronix DPO 72004C`` notebook imported ``TekronixDPOWaveform``, which is a +misspelling of ``TektronixDPOWaveform``. Both notebooks failed at their import +cell before this. diff --git a/docs/examples/DataSet/Real_instruments/Example Measurements with Real Instruments.ipynb b/docs/examples/DataSet/Real_instruments/Example Measurements with Real Instruments.ipynb index 5c185a5bf8ad..50550a37658f 100644 --- a/docs/examples/DataSet/Real_instruments/Example Measurements with Real Instruments.ipynb +++ b/docs/examples/DataSet/Real_instruments/Example Measurements with Real Instruments.ipynb @@ -25,11 +25,11 @@ "import numpy as np\n", "\n", "from qcodes.dataset import Measurement, new_experiment, plot_by_id\n", - "from qcodes.instrument_drivers.Keysight.Infiniium import Infiniium\n", "\n", "# Drivers\n", - "from qcodes.instrument_drivers.Keysight.KeysightAgilent_33XXX import (\n", - " WaveformGenerator_33XXX,\n", + "from qcodes.instrument_drivers.Keysight import (\n", + " Keysight33522B,\n", + " KeysightInfiniium,\n", ")\n", "from qcodes.instrument_drivers.stanford_research.SR830 import SR830\n", "from qcodes.station import Station" @@ -73,8 +73,8 @@ "# initialisation\n", "\n", "sr830 = SR830(\"SR830\", \"GPIB0::8::INSTR\")\n", - "key = WaveformGenerator_33XXX(\"Keysight\", \"TCPIP0::K-33522B-00256::inst0::INSTR\")\n", - "mso = Infiniium(\"MSO\", \"TCPIP0::AGILENT-32C1770::inst0::INSTR\")\n", + "key = Keysight33522B(\"Keysight\", \"TCPIP0::K-33522B-00256::inst0::INSTR\")\n", + "mso = KeysightInfiniium(\"MSO\", \"TCPIP0::AGILENT-32C1770::inst0::INSTR\")\n", "\n", "station = Station(key, mso, sr830)\n", "\n", diff --git a/docs/examples/driver_examples/QCodes example with Tektronix DPO 72004C.ipynb b/docs/examples/driver_examples/QCodes example with Tektronix DPO 72004C.ipynb index f5ff916711b1..48e14b652f8f 100644 --- a/docs/examples/driver_examples/QCodes example with Tektronix DPO 72004C.ipynb +++ b/docs/examples/driver_examples/QCodes example with Tektronix DPO 72004C.ipynb @@ -681,7 +681,7 @@ "metadata": {}, "outputs": [], "source": [ - "from qcodes.instrument_drivers.tektronix.DPO7200xx import TekronixDPOWaveform" + "from qcodes.instrument_drivers.tektronix.DPO7200xx import TektronixDPOWaveform" ] }, { @@ -690,7 +690,10 @@ "metadata": {}, "outputs": [], "source": [ - "math_channel = TekronixDPOWaveform(tek, \"math\", \"MATH1\")" + "# As noted above, math operations are not fully supported yet: the waveform\n", + "# source is declared as belonging to a channel, and here it is attached\n", + "# straight to the instrument instead.\n", + "math_channel = TektronixDPOWaveform(tek, \"math\", \"MATH1\") # ty: ignore[invalid-argument-type]" ] }, { From 3e3857c4304eb0cad6c6258f111332010aaaba5f Mon Sep 17 00:00:00 2001 From: "Jens H. Nielsen" Date: Tue, 25 Aug 2026 07:07:43 +0200 Subject: [PATCH 3/7] Import drivers from the documented package level in the notebooks The drivers_api docs present qcodes.instrument_drivers. as the public module, and the vendor packages re-export their drivers, so the examples should not reach into the module that happens to define a class. Most notebooks already did this. Only SR830, TektronixDPOWaveform and a commented Weinschel8320 line still reached deeper, and all three names are re-exported. Verified by importing each name from the package before rewriting. --- docs/changes/newsfragments/8379.improved | 4 ++++ .../Example Measurements with Real Instruments.ipynb | 2 +- .../QCodes example with Tektronix DPO 72004C.ipynb | 2 +- .../writing_drivers/Creating-Instrument-Drivers.ipynb | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 docs/changes/newsfragments/8379.improved diff --git a/docs/changes/newsfragments/8379.improved b/docs/changes/newsfragments/8379.improved new file mode 100644 index 000000000000..7af6022fd431 --- /dev/null +++ b/docs/changes/newsfragments/8379.improved @@ -0,0 +1,4 @@ +The example notebooks now import driver classes from the documented package +level, for example ``from qcodes.instrument_drivers.stanford_research import +SR830`` rather than reaching into the module that happens to define the class. +Most notebooks already did this. diff --git a/docs/examples/DataSet/Real_instruments/Example Measurements with Real Instruments.ipynb b/docs/examples/DataSet/Real_instruments/Example Measurements with Real Instruments.ipynb index 50550a37658f..c32efd8864f3 100644 --- a/docs/examples/DataSet/Real_instruments/Example Measurements with Real Instruments.ipynb +++ b/docs/examples/DataSet/Real_instruments/Example Measurements with Real Instruments.ipynb @@ -31,7 +31,7 @@ " Keysight33522B,\n", " KeysightInfiniium,\n", ")\n", - "from qcodes.instrument_drivers.stanford_research.SR830 import SR830\n", + "from qcodes.instrument_drivers.stanford_research import SR830\n", "from qcodes.station import Station" ] }, diff --git a/docs/examples/driver_examples/QCodes example with Tektronix DPO 72004C.ipynb b/docs/examples/driver_examples/QCodes example with Tektronix DPO 72004C.ipynb index 48e14b652f8f..7ccb9c7291ae 100644 --- a/docs/examples/driver_examples/QCodes example with Tektronix DPO 72004C.ipynb +++ b/docs/examples/driver_examples/QCodes example with Tektronix DPO 72004C.ipynb @@ -681,7 +681,7 @@ "metadata": {}, "outputs": [], "source": [ - "from qcodes.instrument_drivers.tektronix.DPO7200xx import TektronixDPOWaveform" + "from qcodes.instrument_drivers.tektronix import TektronixDPOWaveform" ] }, { diff --git a/docs/examples/writing_drivers/Creating-Instrument-Drivers.ipynb b/docs/examples/writing_drivers/Creating-Instrument-Drivers.ipynb index 62d7174e64c8..a4c6f48fc57a 100644 --- a/docs/examples/writing_drivers/Creating-Instrument-Drivers.ipynb +++ b/docs/examples/writing_drivers/Creating-Instrument-Drivers.ipynb @@ -255,7 +255,7 @@ "\n", "# instantiating and using this instrument (commented out because I can't actually do it!)\n", "#\n", - "# from qcodes.instrument_drivers.weinschel.Weinschel_8320 import Weinschel8320\n", + "# from qcodes.instrument_drivers.weinschel import Weinschel8320\n", "# weinschel = Weinschel8320('w8320_1', 'TCPIP0::172.20.2.212::inst0::INSTR')\n", "# weinschel.attenuation(40)" ] From 996a55bbf2d15bdfe0aca4b37939761895b80a84 Mon Sep 17 00:00:00 2001 From: "Jens H. Nielsen" Date: Tue, 25 Aug 2026 07:10:33 +0200 Subject: [PATCH 4/7] Fix a leftover Tekronix typo in a docstring The classes were renamed from Tekronix to Tektronix in 0.45.0, but this cross reference in the TektronixDPOWaveformFormat docstring was missed and now points at a class that does not exist. The remaining occurrences are in the 0.45.0 changelog, which documents that rename and so refers to the old names on purpose. --- src/qcodes/instrument_drivers/tektronix/DPO7200xx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qcodes/instrument_drivers/tektronix/DPO7200xx.py b/src/qcodes/instrument_drivers/tektronix/DPO7200xx.py index f4a3b0b0a266..b8d1591c67f1 100644 --- a/src/qcodes/instrument_drivers/tektronix/DPO7200xx.py +++ b/src/qcodes/instrument_drivers/tektronix/DPO7200xx.py @@ -411,7 +411,7 @@ class TektronixDPOWaveformFormat(InstrumentChannel): formatting data. Please note that parameters defined in this submodule effects all waveform sources, whereas parameters defined in the - submodule 'TekronixDPOWaveform' apply to + submodule 'TektronixDPOWaveform' apply to specific waveform sources (e.g. channel1 or math2) """ From cccddc406a5d9ea492255be1de1582403acff4d3 Mon Sep 17 00:00:00 2001 From: "Jens H. Nielsen" Date: Tue, 25 Aug 2026 07:18:02 +0200 Subject: [PATCH 5/7] Import the legacy loop API from qcodes_loop in two notebooks qcodes.measure and qcodes.plots were split out into the qcodes_loop package in 0.38.0, and the deprecated aliases have since been removed, so both notebooks raised ModuleNotFoundError on their import cell. Import from qcodes_loop and say in the notebook that this needs the loop extra, which the docs extra already pulls in. --- docs/changes/newsfragments/8380.improved | 5 +++++ ...with Rohde Schwarz RTO 1000 series Oscilloscope.ipynb | 9 ++++++--- .../Qcodes example with Tektronix TPS2012.ipynb | 7 +++++-- 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 docs/changes/newsfragments/8380.improved diff --git a/docs/changes/newsfragments/8380.improved b/docs/changes/newsfragments/8380.improved new file mode 100644 index 000000000000..b502176472ed --- /dev/null +++ b/docs/changes/newsfragments/8380.improved @@ -0,0 +1,5 @@ +Two example notebooks imported ``Measure`` from ``qcodes.measure`` and +``MatPlot`` from ``qcodes.plots.qcmatplotlib``. Those modules moved to the +``qcodes_loop`` package and the deprecated aliases in QCoDeS have since been +removed, so the notebooks failed at their import cell. They now import from +``qcodes_loop``, which is installed by the ``loop`` extra. diff --git a/docs/examples/driver_examples/Qcodes example with Rohde Schwarz RTO 1000 series Oscilloscope.ipynb b/docs/examples/driver_examples/Qcodes example with Rohde Schwarz RTO 1000 series Oscilloscope.ipynb index 80be469bc66f..74354374262a 100644 --- a/docs/examples/driver_examples/Qcodes example with Rohde Schwarz RTO 1000 series Oscilloscope.ipynb +++ b/docs/examples/driver_examples/Qcodes example with Rohde Schwarz RTO 1000 series Oscilloscope.ipynb @@ -20,9 +20,12 @@ "source": [ "%matplotlib notebook\n", "\n", - "from qcodes.instrument_drivers.rohde_schwarz import RohdeSchwarzRTO1000\n", - "from qcodes.measure import Measure\n", - "from qcodes.plots.qcmatplotlib import MatPlot" + "# Measure and MatPlot are part of the legacy loop API, which lives in the\n", + "# separate qcodes_loop package. Install it with the qcodes loop extra.\n", + "from qcodes_loop.measure import Measure\n", + "from qcodes_loop.plots.qcmatplotlib import MatPlot\n", + "\n", + "from qcodes.instrument_drivers.rohde_schwarz import RohdeSchwarzRTO1000" ] }, { diff --git a/docs/examples/driver_examples/Qcodes example with Tektronix TPS2012.ipynb b/docs/examples/driver_examples/Qcodes example with Tektronix TPS2012.ipynb index 0fb46f70036f..b9c11d5ff63c 100644 --- a/docs/examples/driver_examples/Qcodes example with Tektronix TPS2012.ipynb +++ b/docs/examples/driver_examples/Qcodes example with Tektronix TPS2012.ipynb @@ -33,9 +33,12 @@ "import logging\n", "from time import sleep\n", "\n", + "# Measure and MatPlot are part of the legacy loop API, which lives in the\n", + "# separate qcodes_loop package. Install it with the qcodes loop extra.\n", + "from qcodes_loop.measure import Measure\n", + "from qcodes_loop.plots.qcmatplotlib import MatPlot\n", + "\n", "from qcodes.instrument_drivers.tektronix import TektronixTPS2012\n", - "from qcodes.measure import Measure\n", - "from qcodes.plots.qcmatplotlib import MatPlot\n", "\n", "logger = logging.getLogger()\n", "logger.setLevel(logging.DEBUG)" From a3234a7ccfe54dacb025cbad7208227e6312438a Mon Sep 17 00:00:00 2001 From: "Jens H. Nielsen" Date: Tue, 25 Aug 2026 07:29:52 +0200 Subject: [PATCH 6/7] Update the AWG5208 broadbean example to current APIs Sequence.plotSequence no longer exists in broadbean, the helper is now broadbean.plotting.plotter. makeSEQXFileFromForgedSequence was renamed to make_SEQX_from_forged_sequence when the driver moved from camelCase to snake case; the signature is otherwise unchanged. Both calls raised AttributeError. Correcting the second name uncovered that the channel mapping does not match the parameter type. The driver takes a Mapping[str | int, int] and the key type of a Mapping is invariant, so a dict[str, int] is not one. Annotate the notebook variable and say why. --- docs/changes/newsfragments/8383.improved | 5 +++++ ...des+broadbean example with Tektronix AWG5208.ipynb | 11 +++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 docs/changes/newsfragments/8383.improved diff --git a/docs/changes/newsfragments/8383.improved b/docs/changes/newsfragments/8383.improved new file mode 100644 index 000000000000..68b5b78d7438 --- /dev/null +++ b/docs/changes/newsfragments/8383.improved @@ -0,0 +1,5 @@ +The Tektronix AWG5208 broadbean example notebook has been brought up to date. +``Sequence.plotSequence`` no longer exists in broadbean, so it now uses +``broadbean.plotting.plotter``, and ``makeSEQXFileFromForgedSequence`` was +renamed to ``make_SEQX_from_forged_sequence`` when the driver moved to snake +case. Both cells raised ``AttributeError`` before this. diff --git a/docs/examples/driver_examples/Qcodes+broadbean example with Tektronix AWG5208.ipynb b/docs/examples/driver_examples/Qcodes+broadbean example with Tektronix AWG5208.ipynb index 4d3649b3bae4..2b8105da7d4d 100644 --- a/docs/examples/driver_examples/Qcodes+broadbean example with Tektronix AWG5208.ipynb +++ b/docs/examples/driver_examples/Qcodes+broadbean example with Tektronix AWG5208.ipynb @@ -15,6 +15,7 @@ "source": [ "%matplotlib notebook\n", "import broadbean as bb\n", + "from broadbean.plotting import plotter\n", "\n", "from qcodes.instrument_drivers.tektronix import TektronixAWG5208\n", "\n", @@ -100,7 +101,7 @@ "measureseq.addElement(2, reset_elem)\n", "measureseq.setSequencingNumberOfRepetitions(1, N)\n", "\n", - "measureseq.plotSequence()" + "plotter(measureseq)" ] }, { @@ -142,7 +143,7 @@ " subseq.element(1).changeArg(\"signal_channel\", \"sine\", \"freq\", freq)\n", " mainseq.addSubSequence(pos + 1, subseq)\n", "\n", - "mainseq.plotSequence()\n", + "plotter(mainseq)\n", "\n", "# The visualisation is not terribly helpful in this case, but\n", "# we see that three subsequences are present" @@ -186,8 +187,10 @@ "# send it to the instrument\n", "seqname = \"mytestseq\"\n", "amplitudes = [ch.awg_amplitude() for ch in awg.channels][:2]\n", - "channel_mapping = {\"trigger_channel\": 2, \"signal_channel\": 1}\n", - "seqx_file = TektronixAWG5208.makeSEQXFileFromForgedSequence(\n", + "# annotated because the driver takes a Mapping[str | int, int] and the key\n", + "# type of a Mapping is invariant, so a plain dict[str, int] is not one\n", + "channel_mapping: dict[str | int, int] = {\"trigger_channel\": 2, \"signal_channel\": 1}\n", + "seqx_file = TektronixAWG5208.make_SEQX_from_forged_sequence(\n", " fs, amplitudes=amplitudes, seqname=seqname, channel_mapping=channel_mapping\n", ")\n", "\n", From d84c94e5f8ac4dea298c5dddd520dd55913f79bb Mon Sep 17 00:00:00 2001 From: "Jens H. Nielsen" Date: Tue, 25 Aug 2026 09:50:40 +0200 Subject: [PATCH 7/7] Merge example notebook newsfragments into 8442 Combine the five newsfragments added on this branch into a single docs/changes/newsfragments/8442.improved with the correct PR number. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 04157c21-3895-4632-adaa-3cd95c9aaed0 --- docs/changes/newsfragments/8372.improved | 4 ---- docs/changes/newsfragments/8378.improved | 8 ------- docs/changes/newsfragments/8379.improved | 4 ---- docs/changes/newsfragments/8380.improved | 5 ---- docs/changes/newsfragments/8383.improved | 5 ---- docs/changes/newsfragments/8442.improved | 29 ++++++++++++++++++++++++ 6 files changed, 29 insertions(+), 26 deletions(-) delete mode 100644 docs/changes/newsfragments/8372.improved delete mode 100644 docs/changes/newsfragments/8378.improved delete mode 100644 docs/changes/newsfragments/8379.improved delete mode 100644 docs/changes/newsfragments/8380.improved delete mode 100644 docs/changes/newsfragments/8383.improved create mode 100644 docs/changes/newsfragments/8442.improved diff --git a/docs/changes/newsfragments/8372.improved b/docs/changes/newsfragments/8372.improved deleted file mode 100644 index 443af6fe81fd..000000000000 --- a/docs/changes/newsfragments/8372.improved +++ /dev/null @@ -1,4 +0,0 @@ -The example notebooks no longer use the deprecated short hand aliases in the top -level ``qcodes`` namespace, such as ``qcodes.Station`` and ``qcodes.Measurement``. -They import the names from their respective submodules instead, which is what -the deprecation warning asks users to do and what keeps type information. diff --git a/docs/changes/newsfragments/8378.improved b/docs/changes/newsfragments/8378.improved deleted file mode 100644 index 83300b91650e..000000000000 --- a/docs/changes/newsfragments/8378.improved +++ /dev/null @@ -1,8 +0,0 @@ -Two example notebooks referred to driver classes under names that no longer -exist. ``Example Measurements with Real Instruments`` used ``Infiniium`` and -``WaveformGenerator_33XXX``, which were renamed to ``KeysightInfiniium`` and -``Keysight33xxx``; it now uses ``KeysightInfiniium`` and the model specific -``Keysight33522B``, matching the instrument the example connects to. The -``Tektronix DPO 72004C`` notebook imported ``TekronixDPOWaveform``, which is a -misspelling of ``TektronixDPOWaveform``. Both notebooks failed at their import -cell before this. diff --git a/docs/changes/newsfragments/8379.improved b/docs/changes/newsfragments/8379.improved deleted file mode 100644 index 7af6022fd431..000000000000 --- a/docs/changes/newsfragments/8379.improved +++ /dev/null @@ -1,4 +0,0 @@ -The example notebooks now import driver classes from the documented package -level, for example ``from qcodes.instrument_drivers.stanford_research import -SR830`` rather than reaching into the module that happens to define the class. -Most notebooks already did this. diff --git a/docs/changes/newsfragments/8380.improved b/docs/changes/newsfragments/8380.improved deleted file mode 100644 index b502176472ed..000000000000 --- a/docs/changes/newsfragments/8380.improved +++ /dev/null @@ -1,5 +0,0 @@ -Two example notebooks imported ``Measure`` from ``qcodes.measure`` and -``MatPlot`` from ``qcodes.plots.qcmatplotlib``. Those modules moved to the -``qcodes_loop`` package and the deprecated aliases in QCoDeS have since been -removed, so the notebooks failed at their import cell. They now import from -``qcodes_loop``, which is installed by the ``loop`` extra. diff --git a/docs/changes/newsfragments/8383.improved b/docs/changes/newsfragments/8383.improved deleted file mode 100644 index 68b5b78d7438..000000000000 --- a/docs/changes/newsfragments/8383.improved +++ /dev/null @@ -1,5 +0,0 @@ -The Tektronix AWG5208 broadbean example notebook has been brought up to date. -``Sequence.plotSequence`` no longer exists in broadbean, so it now uses -``broadbean.plotting.plotter``, and ``makeSEQXFileFromForgedSequence`` was -renamed to ``make_SEQX_from_forged_sequence`` when the driver moved to snake -case. Both cells raised ``AttributeError`` before this. diff --git a/docs/changes/newsfragments/8442.improved b/docs/changes/newsfragments/8442.improved new file mode 100644 index 000000000000..d284a96099da --- /dev/null +++ b/docs/changes/newsfragments/8442.improved @@ -0,0 +1,29 @@ +The example notebooks have been brought up to date so that they import names +that actually exist and follow the documented import style. + +The notebooks no longer use the deprecated short hand aliases in the top level +``qcodes`` namespace, such as ``qcodes.Station`` and ``qcodes.Measurement``. +They import the names from their respective submodules instead, which is what +the deprecation warning asks users to do and what keeps type information. Driver +classes are now imported from the documented package level, for example ``from +qcodes.instrument_drivers.stanford_research import SR830`` rather than reaching +into the module that happens to define the class. Most notebooks already did +this. + +Several notebooks previously failed at their import cell. ``Example +Measurements with Real Instruments`` used ``Infiniium`` and +``WaveformGenerator_33XXX``, which were renamed to ``KeysightInfiniium`` and +``Keysight33xxx``; it now uses ``KeysightInfiniium`` and the model specific +``Keysight33522B``, matching the instrument the example connects to. The +``Tektronix DPO 72004C`` notebook imported ``TekronixDPOWaveform``, which is a +misspelling of ``TektronixDPOWaveform``. Two notebooks imported ``Measure`` from +``qcodes.measure`` and ``MatPlot`` from ``qcodes.plots.qcmatplotlib``; those +modules moved to the ``qcodes_loop`` package and the deprecated aliases in +QCoDeS have since been removed, so they now import from ``qcodes_loop``, which +is installed by the ``loop`` extra. + +The Tektronix AWG5208 broadbean example notebook has also been updated. +``Sequence.plotSequence`` no longer exists in broadbean, so it now uses +``broadbean.plotting.plotter``, and ``makeSEQXFileFromForgedSequence`` was +renamed to ``make_SEQX_from_forged_sequence`` when the driver moved to snake +case. Both cells raised ``AttributeError`` before this.