Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
fa01e24
Fix isinstance validator logic order
jenshnielsen Aug 19, 2026
423870b
Add ty type checker configuration
jenshnielsen Aug 19, 2026
8b9173e
Dispatch Parameter.get_raw/set_raw instead of overwriting them
jenshnielsen Aug 19, 2026
53fbc6f
Default TParameter to Parameter[Any, Any]
jenshnielsen Aug 19, 2026
2459a45
Reject legacy setpoint arrays without an array_id
jenshnielsen Aug 19, 2026
11fabb8
Replace the CombinedParameter lambda hack with a dataclass
jenshnielsen Aug 20, 2026
85daf4b
Suppress ty false positive on forwarded parameter kwargs
jenshnielsen Aug 20, 2026
fa5875a
Correct the description of the ty kwargs false positive
jenshnielsen Aug 20, 2026
87a28e4
Use cast for the narrowing in the Infiniium driver
jenshnielsen Aug 21, 2026
9fe4894
Fix element typing of standalone result dicts
jenshnielsen Aug 21, 2026
bae915b
Do not assume a ctypes errcheck callable has a __name__
jenshnielsen Aug 21, 2026
fff77b1
Suppress ty on the colorbar _inside workaround
jenshnielsen Aug 21, 2026
26f1338
Suppress ty on the qcodes_abstractmethod marker
jenshnielsen Aug 21, 2026
335ed2b
Annotate the DynaCool server socket dictionary
jenshnielsen Aug 21, 2026
93a382b
Annotate the Keithley 7510 buffer data dictionary
jenshnielsen Aug 21, 2026
56614f9
Narrow the numpy int and float type tuples
jenshnielsen Aug 21, 2026
379d40f
Suppress ty on the ParamSpec._from_dict override
jenshnielsen Aug 21, 2026
fb2ee40
Suppress ty on the IPToVisa base class conflict
jenshnielsen Aug 21, 2026
676466f
Suppress ty on the Alazar get_idn override
jenshnielsen Aug 21, 2026
d304597
Match the parameter name of the AWG5014 __getattr__
jenshnielsen Aug 21, 2026
c8b2d46
Suppress ty on Parameter.increment
jenshnielsen Aug 21, 2026
60cee39
Suppress ty on the Lakeshore CHANNEL_CLASS default
jenshnielsen Aug 21, 2026
eec10b0
Suppress ty on the cache update monkeypatch
jenshnielsen Aug 21, 2026
343e649
Suppress a ty narrowing imprecision in get_chain_links_of_type
jenshnielsen Aug 21, 2026
caebd3b
Suppress ty on the run overview extra columns
jenshnielsen Aug 21, 2026
75b0dab
Type the AutoLoadableChannelList multichan_paramclass
jenshnielsen Aug 21, 2026
c5c7214
Suppress ty on the ChannelList setitem narrowing
jenshnielsen Aug 21, 2026
fa1633f
Annotate the second Command exec mapping
jenshnielsen Aug 21, 2026
6b4ddbf
Register the float sqlite adapter separately from numpy floats
jenshnielsen Aug 21, 2026
c813cae
Suppress the get_ramp_values mismatch newly reported by ty 0.0.74
jenshnielsen Aug 24, 2026
d353b7b
Add drafts for the two remaining ty issues
jenshnielsen Aug 24, 2026
75d4898
Document how mypy and ty suppression codes interact
jenshnielsen Aug 24, 2026
09a60d8
Document how pyright reads suppression comments
jenshnielsen Aug 24, 2026
fafefb3
Annotate the json exporter templates
jenshnielsen Aug 24, 2026
a1f5adb
Allow subscribe callbacks to take callback_kwargs
jenshnielsen Aug 24, 2026
73b2520
Type the 34980A module dict as its submodules
jenshnielsen Aug 24, 2026
445f50d
Correct the return type of parse_awg_file
jenshnielsen Aug 24, 2026
cf28089
Do not assume every parameter has a label in the AWG5014C notebook
jenshnielsen Aug 24, 2026
392589d
Check the example notebooks with ty
jenshnielsen Aug 25, 2026
07de95c
Use the enum keys for the B1500 module dicts
jenshnielsen Aug 25, 2026
dd68f4d
Enable the channels before B1500 phase compensation
jenshnielsen Aug 25, 2026
5331519
Declare the dynamic attributes of the E4980A measurement pair
jenshnielsen Aug 25, 2026
d5fd9f0
Pack the SR86x example waveforms in lists
jenshnielsen Aug 25, 2026
1e873b4
Accept any iterable of paths in the B220X switch matrix
jenshnielsen Aug 25, 2026
32d355b
Accept any collection of paths in the 34980A switch matrix
jenshnielsen Aug 25, 2026
47bbe2f
Do not take the length of Line2D.get_ydata in the Lakeshore examples
jenshnielsen Aug 25, 2026
68895f9
Handle the optional values in the offline plotting tutorial
jenshnielsen Aug 25, 2026
76ad021
Put snapshot_raw on the dataset protocol
jenshnielsen Aug 25, 2026
989a50e
Check the optional snapshots in the snapshots notebook
jenshnielsen Aug 25, 2026
4ecac3d
Use type safe dataset unpacking
jenshnielsen Aug 27, 2026
4141113
Fix type checking in notebook
jenshnielsen Aug 27, 2026
d1405c3
Allow ParamSpecBase in get_parameter_data
jenshnielsen Aug 27, 2026
93a6d34
Fix type checking in config notebook
jenshnielsen Aug 27, 2026
0184955
Fix another notebook
jenshnielsen Aug 27, 2026
e872aab
Fix type checking in parameter notebook
jenshnielsen Aug 27, 2026
70d72c7
Fix type checking in parameter notebook
jenshnielsen Aug 27, 2026
44923ec
Fix ty typechecking of docs hack
jenshnielsen Aug 28, 2026
a0ee6dd
Fix remaining ty issues
jenshnielsen Aug 28, 2026
39a1a01
Allow a sequence of arrays as a measurement result
jenshnielsen Aug 28, 2026
0368976
Reformat file
jenshnielsen Aug 28, 2026
c816bed
Run ty on src and docs in CI
jenshnielsen Aug 28, 2026
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
4 changes: 4 additions & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ jobs:
run: mypy -p qcodes
if: ${{ !matrix.min-version && always() }}
id: mypy
- name: Run ty
run: ty check --output-format github src docs
if: ${{ !matrix.min-version && always() }}
id: ty
- name: Set pytest basetemp
if: ${{ runner.os == 'Windows' }}
run: echo "PYTEST_BASETEMP=--basetemp=D:\\tmp" >> $GITHUB_ENV
Expand Down
9 changes: 9 additions & 0 deletions docs/changes/newsfragments/8360.underthehood
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
:class:`.Parameter` no longer replaces its own ``get_raw``/``set_raw`` methods
with the implementation generated from ``get_cmd``/``set_cmd``. The generated
implementation is stored on the parameter instead, and ``get_raw``/``set_raw``
are now regular methods that dispatch to it. Assigning over the methods made
static type checkers infer ``get_raw``/``set_raw`` to be instance attributes of
:class:`.Parameter`, which in turn made every subclass implementing them as
regular methods an invalid override. There is no change in behaviour; note only
that ``parameter.get_raw`` is now always a bound method rather than, depending
on the arguments, a ``Command`` instance.
9 changes: 9 additions & 0 deletions docs/changes/newsfragments/8361.underthehood
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The ``TParameter`` type variable used by :meth:`.InstrumentBase.add_parameter`
now defaults to ``Parameter[Any, Any]`` rather than to a bare ``Parameter``.
When ``add_parameter`` is called without an explicit ``parameter_class`` the
returned parameter is bound to the instrument it is added to, so the previous
default (which expands to ``Parameter[Any, InstrumentBase | None]``) wrongly
claimed that the instrument was ``InstrumentBase | None``. This made the result
unassignable to the ``Parameter[SomeType, Self]`` annotations that drivers use.
Code that relies on the inferred type of an unannotated
``instrument.add_parameter("name")`` will now see ``Parameter[Any, Any]``.
5 changes: 5 additions & 0 deletions docs/changes/newsfragments/8362.underthehood
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The legacy dataset importer now raises a clear :class:`ValueError` when a
setpoint array has no ``array_id``, instead of passing ``None`` on to
``add_result`` where a parameter name is expected. This was found by annotating
``DataArray`` in ``qcodes_loop``, which also removes the need for a ``pyright``
suppression on the array shape.
4 changes: 4 additions & 0 deletions docs/changes/newsfragments/8364.underthehood
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
``CombinedParameter.parameter`` is now a small dataclass holding the ``name``,
``full_name``, ``label`` and ``unit`` of the combined parameter, replacing a
lambda that had those attributes attached to it. It remains callable, and
calling it returns ``None`` as before.
6 changes: 6 additions & 0 deletions docs/changes/newsfragments/8365.underthehood
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Subclasses of ``ParameterBase`` that forward ``**kwargs`` on to their super
class now carry a ``ty: ignore[invalid-argument-type]``. When a generic TypedDict
declares a PEP 696 default for a type parameter, ty computes the upper bound of
the synthesized ``Self`` as the default specialization, so every other
specialization is rejected by the members that bind ``Self``, including expanding
with ``**``. The reason is documented on ``ParameterBaseKWArgs``.
5 changes: 5 additions & 0 deletions docs/changes/newsfragments/8366.underthehood
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The Infiniium driver now uses ``cast`` where it narrows ``root_instrument`` and
``instrument`` to the concrete driver classes, and where ``pyvisa`` types the
return of ``read_binary_values``/``query_binary_values`` as a ``Sequence[float]``
regardless of the requested ``container``. This replaces five type checker
suppressions and has no effect at runtime.
5 changes: 5 additions & 0 deletions docs/changes/newsfragments/8367.underthehood
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
``DataSet._finalize_res_dict_standalones`` now appends to its result list
directly instead of building intermediate lists. The intermediate lists took
their element type from the branch that built them rather than from the
declaration, and ``dict`` is invariant in its value type, so the result was not
assignable back. There is no change in behaviour.
4 changes: 4 additions & 0 deletions docs/changes/newsfragments/8368.underthehood
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The Alazar DLL wrapper no longer assumes that the callable handed to a ctypes
``errcheck`` has a ``__name__``, which a plain ``Callable`` does not guarantee.
The error message falls back to the repr of the callable instead. This only
affects the text of an error that should not occur in practice.
5 changes: 5 additions & 0 deletions docs/changes/newsfragments/8370.underthehood
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
``numpy_ints`` and ``numpy_floats`` in ``qcodes.utils.types`` are now annotated
as tuples of ``type[np.integer]`` and ``type[np.floating]`` rather than of bare
``type``. As a consequence ``_adapt_float``, which is registered as a sqlite
adapter for the numpy float types as well as for ``float``, now declares that it
accepts ``np.floating`` too. Its behaviour is unchanged.
5 changes: 5 additions & 0 deletions docs/changes/newsfragments/8371.underthehood
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The ``__getattr__`` that provides backwards-compatible access to the old flat
parameter names on the Tektronix AWG5014 now names its parameter ``key``,
matching ``DelegateAttributes.__getattr__`` which it overrides and delegates to.
Python only ever calls ``__getattr__`` positionally, so this has no effect at
runtime.
5 changes: 5 additions & 0 deletions docs/changes/newsfragments/8373.underthehood
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
``json_template_linear`` and ``json_template_heatmap`` in
``qcodes.dataset.json_exporter`` are now annotated as ``dict[str, Any]``. They
are templates for a JSON document, so their values are deliberately
heterogeneous, and without the annotation the inferred value type made indexing
into them an error for callers filling the template in.
6 changes: 6 additions & 0 deletions docs/changes/newsfragments/8374.improved
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The ``callback`` argument of :meth:`.DataSet.subscribe` is now typed as
``Callable[..., None]``. The previous annotation described a callback taking
exactly three arguments, which contradicted ``callback_kwargs``: those are bound
onto the callback with ``functools.partial``, so a callback using them takes
further arguments. ``_Subscriber``, which ``subscribe`` forwards to, already
typed it this way.
7 changes: 7 additions & 0 deletions docs/changes/newsfragments/8375.improved
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
``Keysight34980A.module`` is now a ``dict`` of
``Keysight34980ASwitchMatrixSubModule`` rather than one built with
``dict.fromkeys``, whose values were typed as possibly ``None``. ``scan_slots``
puts an entry in for every slot, either the driver for the installed module or a
generic submodule, so the values were never ``None`` once the instrument was
constructed. Code using ``instrument.module[slot]`` no longer has to account for
a ``None`` that cannot occur.
6 changes: 6 additions & 0 deletions docs/changes/newsfragments/8376.improved
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The return type of :func:`.parse_awg_file` has been corrected. The waveform and
marker entries were declared as lists of dicts, but the parser returns the arrays
from inside those dicts, and the loop counts and sequencing values were declared
as possibly ``str`` when they are always ``int``. The type now matches the call
signature of :meth:`.TektronixAWG5014.make_send_and_load_awg_file`, which the
docstring already promised and which is how the function is meant to be used.
3 changes: 3 additions & 0 deletions docs/changes/newsfragments/8377.underthehood
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
``ty`` now also type checks the example notebooks in ``docs``. Unlike mypy and
pyright it understands Jupyter notebooks, so this is coverage that the other two
checkers do not provide.
6 changes: 6 additions & 0 deletions docs/changes/newsfragments/8381.improved
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The Keysight B1500 example notebook called
``b1500.run_iv_staircase_sweep.measurement_status()`` in the phase compensation
section. ``IVSweepMeasurement`` has no such method, so the cell raised
``AttributeError``. The surrounding text asks for all channel outputs to be
enabled before performing phase compensation, so the cell now calls
``b1500.enable_channels()``.
7 changes: 7 additions & 0 deletions docs/changes/newsfragments/8382.improved
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
``KeysightE4980AMeasurementPair`` now declares a ``__getattr__`` for type
checkers. The two measured values are exposed as attributes named after the
``names`` of the measurement function, for example ``capacitance`` for ``CPD``
and ``inductance`` for ``LPD``, so which attributes exist is only known at
runtime. The declaration lets this documented usage be written in typed code. It
is not defined at runtime, so accessing an attribute that the current
measurement function does not provide still raises the usual ``AttributeError``.
4 changes: 4 additions & 0 deletions docs/changes/newsfragments/8384.improved
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The Stanford SR86x buffered readout example notebook now packs the waveforms for
:meth:`.TektronixAWG70000Base.makeSEQXFile` in lists rather than wrapping them in
further numpy arrays, which is the shape the method documents. The two forms
behave the same at runtime.
6 changes: 6 additions & 0 deletions docs/changes/newsfragments/8385.improved
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
``connect_paths``, ``disconnect_paths`` and ``to_channel_list`` on the Keysight
B220X switch matrix drivers now accept any iterable of paths rather than only a
``Sequence``. They iterate the paths once and do not index them, so passing a
set, as the example notebook does, is fine. Note that the order in which the
paths appear in the channel list then follows the iteration order of the
argument.
6 changes: 6 additions & 0 deletions docs/changes/newsfragments/8386.improved
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The path arguments of ``connect_paths``, ``disconnect_paths``, ``are_closed``,
``are_open`` and ``to_channel_list`` on the Keysight 34980A switch matrix
submodules are now typed as a ``Collection`` rather than a ``list``, so a set or
a tuple of paths is accepted as well. A ``Collection`` rather than an
``Iterable`` because these methods walk the paths twice, once to validate them
and once to build the channel list, which a one shot iterator would not survive.
5 changes: 5 additions & 0 deletions docs/changes/newsfragments/8387.improved
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The live temperature plot helper in the two Lakeshore example notebooks keeps
the appended y data in a local variable instead of reading it back with
``Line2D.get_ydata``. The return of ``get_ydata`` is typed as ``ArrayLike``,
which is not necessarily sized, so taking its length was a type error. This also
avoids reading the data back from the line on every iteration.
3 changes: 3 additions & 0 deletions docs/changes/newsfragments/8389.improved
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The offline plotting tutorial now checks the optional values it gets back from
:func:`.plot_dataset` before using them, and asks for the root figure when
saving. ``Axes.figure`` may be a ``SubFigure``, which has no ``savefig``.
5 changes: 5 additions & 0 deletions docs/changes/newsfragments/8390.improved
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
``snapshot_raw`` is now part of :class:`.DataSetProtocol` and is available on
:class:`.DataSetInMem` as well as on :class:`.DataSet`. It is documented as the
way to get the snapshot of a run as a JSON string, and is used as such in the
example notebooks, but it was only declared on one of the two dataset classes,
so reading it from a dataset returned by a measurement did not type check.
3 changes: 3 additions & 0 deletions docs/changes/newsfragments/8391.improved
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The snapshot example notebook now checks that the snapshots it reads back from
the datasets are present before using them. A run only has a snapshot if one was
recorded, so both ``snapshot`` and ``snapshot_raw`` are optional.
5 changes: 5 additions & 0 deletions docs/changes/newsfragments/8392.improved
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The type alias ``ValuesType``, used by ``DataSaver.add_result`` and related
methods, now also accepts a sequence of numpy arrays. This is what a
``MultiParameter`` measuring more than one array returns, so passing such a
result to ``DataSaver.add_result`` no longer produces a type checking error.
The behavior at runtime is unchanged since this was already supported.
4 changes: 4 additions & 0 deletions docs/changes/newsfragments/8393.underthehood
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The type checker ``ty`` is now a test dependency and is run as part of the
CI job that also runs ``mypy`` and ``pyright``. Unlike the other type
checkers ``ty`` understands Jupyter notebooks, so this type checks the
example notebooks in ``docs`` in addition to the source code in ``src``.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# before qcodes imports pyplot and automatically
# sets the backend
import matplotlib
from intersphinx_registry import get_intersphinx_mapping

Check failure on line 25 in docs/conf.py

View workflow job for this annotation

GitHub Actions / pytestmypy (ubuntu-latest, 3.14, false)

ty (unresolved-import)

docs/conf.py:25:6: unresolved-import: Cannot resolve imported module `intersphinx_registry` info: Searched in the following paths during module resolution: info: 1. /home/runner/work/Qcodes/Qcodes/src (first-party code) info: 2. /home/runner/work/Qcodes/Qcodes (first-party code) info: 3. vendored://stdlib (stdlib typeshed stubs vendored by ty) info: 4. /opt/hostedtoolcache/Python/3.14.7/x64/lib/python3.14/site-packages (site-packages) info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment

Check failure on line 25 in docs/conf.py

View workflow job for this annotation

GitHub Actions / pytestmypy (ubuntu-latest, 3.13, false)

ty (unresolved-import)

docs/conf.py:25:6: unresolved-import: Cannot resolve imported module `intersphinx_registry` info: Searched in the following paths during module resolution: info: 1. /home/runner/work/Qcodes/Qcodes/src (first-party code) info: 2. /home/runner/work/Qcodes/Qcodes (first-party code) info: 3. vendored://stdlib (stdlib typeshed stubs vendored by ty) info: 4. /opt/hostedtoolcache/Python/3.13.15/x64/lib/python3.13/site-packages (site-packages) info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment

Check failure on line 25 in docs/conf.py

View workflow job for this annotation

GitHub Actions / pytestmypy (ubuntu-latest, 3.12, false)

ty (unresolved-import)

docs/conf.py:25:6: unresolved-import: Cannot resolve imported module `intersphinx_registry` info: Searched in the following paths during module resolution: info: 1. /home/runner/work/Qcodes/Qcodes/src (first-party code) info: 2. /home/runner/work/Qcodes/Qcodes (first-party code) info: 3. vendored://stdlib (stdlib typeshed stubs vendored by ty) info: 4. /opt/hostedtoolcache/Python/3.12.14/x64/lib/python3.12/site-packages (site-packages) info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment

Check failure on line 25 in docs/conf.py

View workflow job for this annotation

GitHub Actions / pytestmypy (windows-latest, 3.12, false)

ty (unresolved-import)

docs\conf.py:25:6: unresolved-import: Cannot resolve imported module `intersphinx_registry` info: Searched in the following paths during module resolution: info: 1. D:\a\Qcodes\Qcodes\src (first-party code) info: 2. D:\a\Qcodes\Qcodes (first-party code) info: 3. vendored://stdlib (stdlib typeshed stubs vendored by ty) info: 4. C:\hostedtoolcache\windows\Python\3.12.10\x64\Lib\site-packages (site-packages) info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
from packaging.version import parse

# setting the metaclass will cause sphinx
Expand All @@ -33,7 +33,7 @@
# this should happen as early as possible
import qcodes.instrument.instrument_meta

qcodes.instrument.instrument_meta.InstrumentMeta = ABCMeta
qcodes.instrument.instrument_meta.InstrumentMeta = ABCMeta # ty: ignore[invalid-assignment]
# we need to reload any module that has been imported and
# makes use of this metaclass. The modules below are all imported
# by importing qcodes.instrument so we need to reload them
Expand Down
24 changes: 2 additions & 22 deletions docs/examples/DataSet/Accessing-data-in-DataSet.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -710,26 +710,6 @@
"dataset.get_parameters()"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'x,t,y,y2,q'"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dataset.parameters"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -1047,7 +1027,7 @@
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"display_name": "qcodes",
"language": "python",
"name": "python3"
},
Expand All @@ -1061,7 +1041,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.12"
"version": "3.14.7"
},
"toc": {
"base_numbering": 1,
Expand Down
51 changes: 2 additions & 49 deletions docs/examples/DataSet/DataSet-class-walkthrough.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -1131,6 +1131,12 @@
}
],
"source": [
"from qcodes.dataset.data_set_in_memory import DataSetInMem\n",
"\n",
"# the set_netcdf_location only exists for DataSetInMem so we validate that we are indeed using that.\n",
"if not isinstance(reloaded_ds, DataSetInMem):\n",
" raise ValueError(\"reloaded_ds must be an instance of DataSetInMem\")\n",
"\n",
"reloaded_ds.set_netcdf_location(new_file_path)\n",
"reloaded_ds.export_info"
]
Expand Down
18 changes: 12 additions & 6 deletions docs/examples/DataSet/Offline Plotting Tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,8 @@
"outputs": [],
"source": [
"colorbar = colorbars[0]\n",
"# 2D plots have a colorbar, 1D plots do not, so the entries are optional\n",
"assert colorbar is not None\n",
"colorbar.set_label(\"Correct science label\")"
]
},
Expand Down Expand Up @@ -939,9 +941,11 @@
"source": [
"%%time\n",
"axeslist, _ = plot_dataset(dataset)\n",
"axeslist[0].figure.savefig(\n",
" Path.cwd().parent / \"example_output\" / f\"test_plot_dataset_{dataid}.pdf\"\n",
")"
"# Axes.figure may be a SubFigure, which cannot be saved, so ask for the\n",
"# root figure\n",
"figure = axeslist[0].get_figure(root=True)\n",
"assert figure is not None\n",
"figure.savefig(Path.cwd().parent / \"example_output\" / f\"test_plot_dataset_{dataid}.pdf\")"
]
},
{
Expand Down Expand Up @@ -971,9 +975,11 @@
"source": [
"%%time\n",
"axeslist, _ = plot_dataset(dataset, rasterized=False)\n",
"axeslist[0].figure.savefig(\n",
" Path.cwd().parent / \"example_output\" / f\"test_plot_dataset_{dataid}.pdf\"\n",
")"
"# Axes.figure may be a SubFigure, which cannot be saved, so ask for the\n",
"# root figure\n",
"figure = axeslist[0].get_figure(root=True)\n",
"assert figure is not None\n",
"figure.savefig(Path.cwd().parent / \"example_output\" / f\"test_plot_dataset_{dataid}.pdf\")"
]
}
],
Expand Down
13 changes: 12 additions & 1 deletion docs/examples/DataSet/Threaded data acquisition.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "2add302b",
"metadata": {
"ExecuteTime": {
Expand All @@ -115,6 +115,17 @@
" time.sleep(0.1)\n",
" return val\n",
"\n",
" @property\n",
" def root_instrument(self) -> \"DummyInstrumentWithMeasurement\":\n",
" if self.instrument is None or not isinstance(\n",
" self.instrument.root_instrument, DummyInstrumentWithMeasurement\n",
" ):\n",
" raise ValueError(\n",
" \"SleepyDmmExponentialParameter must be bound to a DummyInstrumentWithMeasurement\"\n",
" )\n",
" instr = self.instrument.root_instrument\n",
" return instr\n",
"\n",
" @staticmethod\n",
" def _exponential_decay(a: float, b: float):\n",
" x = 0\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1451,7 +1451,15 @@
}
],
"source": [
"result = dond(sweep_1, sweep_2, [dmm.v1], [dmm.v2], do_plot=True, show_progress=True)"
"result = dond(\n",
" sweep_1,\n",
" sweep_2,\n",
" [dmm.v1],\n",
" [dmm.v2],\n",
" do_plot=True,\n",
" show_progress=True,\n",
" squeeze=False,\n",
")"
]
},
{
Expand Down Expand Up @@ -1979,7 +1987,7 @@
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"display_name": "qcodes",
"language": "python",
"name": "python3"
},
Expand All @@ -1993,7 +2001,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
"version": "3.14.7"
},
"toc": {
"base_numbering": 1,
Expand Down
12 changes: 9 additions & 3 deletions docs/examples/DataSet/Working with snapshots.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,9 @@
"metadata": {},
"outputs": [],
"source": [
"snapshot_of_run = dataset.snapshot"
"snapshot_of_run = dataset.snapshot\n",
"# a run only has a snapshot if one was recorded, this one has\n",
"assert snapshot_of_run is not None"
]
},
{
Expand All @@ -602,7 +604,8 @@
"metadata": {},
"outputs": [],
"source": [
"snapshot_of_run_in_json_format = dataset.snapshot_raw"
"snapshot_of_run_in_json_format = dataset.snapshot_raw\n",
"assert snapshot_of_run_in_json_format is not None"
]
},
{
Expand Down Expand Up @@ -881,7 +884,10 @@
"metadata": {},
"outputs": [],
"source": [
"diff_param_values(dataset.snapshot, bad_dataset.snapshot).changed"
"snapshot_of_bad_run = bad_dataset.snapshot\n",
"assert snapshot_of_bad_run is not None\n",
"\n",
"diff_param_values(snapshot_of_run, snapshot_of_bad_run).changed"
]
},
{
Expand Down
Loading
Loading