Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions docs/changes/newsfragments/8442.improved
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 3 additions & 3 deletions docs/examples/DataSet/Cache/write_for_caching.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand All @@ -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)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"from qcodes.instrument_drivers.mock_instruments import (\n",
" DummyInstrument,\n",
" DummyInstrumentWithMeasurement,\n",
")"
")\n",
"from qcodes.station import Station"
]
},
{
Expand All @@ -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)"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/DataSet/InMemoryDataSet.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -37,7 +36,8 @@
"from qcodes.instrument_drivers.mock_instruments import (\n",
" DummyInstrument,\n",
" DummyInstrumentWithMeasurement,\n",
")"
")\n",
"from qcodes.station import Station"
]
},
{
Expand All @@ -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)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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()"
]
Expand All @@ -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)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.instrument_drivers.Keysight.Infiniium import Infiniium\n",
"from qcodes.dataset import Measurement, new_experiment, plot_by_id\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"
"from qcodes.instrument_drivers.stanford_research import SR830\n",
"from qcodes.station import Station"
]
},
{
Expand Down Expand Up @@ -73,12 +73,12 @@
"# 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 = 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\")"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/DataSet/Working-With-Pandas-and-XArray.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -66,7 +65,8 @@
"from qcodes.instrument_drivers.mock_instruments import (\n",
" DummyInstrument,\n",
" DummyInstrumentWithMeasurement,\n",
")"
")\n",
"from qcodes.station import Station"
]
},
{
Expand All @@ -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)"
]
},
{
Expand Down
5 changes: 3 additions & 2 deletions docs/examples/basic_examples/15_minutes_to_QCoDeS.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand Down Expand Up @@ -236,7 +237,7 @@
"metadata": {},
"outputs": [],
"source": [
"station = qc.Station()"
"station = Station()"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand All @@ -46,7 +46,7 @@
"metadata": {},
"outputs": [],
"source": [
"station = qc.Station()"
"station = Station()"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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\")"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand All @@ -85,7 +85,7 @@
"metadata": {},
"outputs": [],
"source": [
"station = qc.Station(config_file=\"delegate_instrument_example.yaml\")"
"station = Station(config_file=\"delegate_instrument_example.yaml\")"
]
},
{
Expand Down Expand Up @@ -552,7 +552,7 @@
"metadata": {},
"outputs": [],
"source": [
"station = qc.Station(config_file=\"delegate_instrument_example.yaml\")"
"station = Station(config_file=\"delegate_instrument_example.yaml\")"
]
},
{
Expand Down Expand Up @@ -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()"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand Down Expand Up @@ -1091,7 +1092,6 @@
},
"outputs": [],
"source": [
"import qcodes as qc\n",
"from qcodes.dataset import (\n",
" Measurement,\n",
" initialise_or_create_database_at,\n",
Expand All @@ -1115,7 +1115,7 @@
},
"outputs": [],
"source": [
"station = qc.Station()"
"station = Station()"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand All @@ -51,7 +51,7 @@
"metadata": {},
"outputs": [],
"source": [
"station = qc.Station()"
"station = Station()"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@
"metadata": {},
"outputs": [],
"source": [
"from qcodes.instrument_drivers.tektronix.DPO7200xx import TekronixDPOWaveform"
"from qcodes.instrument_drivers.tektronix import TektronixDPOWaveform"
]
},
{
Expand All @@ -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]"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -351,7 +352,7 @@
}
],
"source": [
"timemeas = qc.Measurement()\n",
"timemeas = Measurement()\n",
"timemeas.register_parameter(keith.smua.timetrace)"
]
},
Expand Down
Loading
Loading