QCoDeS [UNRELEASED DRAFT] (2026-11-21)¶
Breaking Changes:¶
The
cutoff_lo(high-pass) andcutoff_hi(low-pass) parameters of the virtualSR560driver now only accept the filter cutoffs that the instrument has:cutoff_loaccepts"DC"and 0.03 Hz to 10 kHz, andcutoff_hi0.03 Hz to 1 MHz. Previouslycutoff_loalso accepted 30 kHz to 1 MHz, andcutoff_hiaccepted"DC".SR86x.external_reference_trigger_input_resistancenow returns"50OHMS"or"1MEG"instead of0or1. Setting it to0or1still works at runtime, but type checkers now reject it since the parameter is annotated asParameter[str, Self]; set it to"50"/"50OHMS"or"1M"/"1MEG"instead. (#8696)The
current,current_rangeandcurrent_limitparameters of theYokogawaGS200, and itsmeasureparameter in voltage source mode, now use the unitAinstead ofI. Theramp_rateandramp_stepparameters now start with the unitsA/sandAinstead ofV/sandVif the instrument is in current source mode when connecting, as they already did after changing the source mode.YokogawaGS200Monitor.delay(measure.delay) is now in seconds, the unit the instrument uses, instead of ms. The value was already sent to the instrument unconverted, sodelay(500)set a delay of 500 s despite themsunit. The parameter now accepts values from 0 to 999.999 s in steps of 1 ms, e.g.delay(0.5)for 500 ms, and returns the delay as afloatin seconds instead of anintrounded to whole seconds. (#8697)The
InterDependencies_of aDataSetorDataSetInMemare now frozen once the dataset has been started, also after the measurement has completed and when loading a started dataset, since the parameters of a dataset can not change at that point.dataset.description.interdepsis therefore aFrozenInterDependencies_for such datasets and modifying it in place raises aTypeError. Methods that return a new object such asextendandremovecontinue to work, andFrozenInterDependencies_now compares equal to anInterDependencies_with the same parameters. As a consequence, running aMeasurementwithout any registered parameters raisesRuntimeError("No parameters supplied")again. Since QCoDeS 0.55.0 this check had silently stopped working and such a measurement would start a dataset without parameters. Theoverrideargument ofDataSet.set_interdependenciesis deprecated, since the interdependencies of a started dataset are fixed andoverridenever updated the run description stored in the database. (#8726)
Improved:¶
The
full_nameof an instrument, instrument module,ChannelTupleor parameter, and thereby thenameof an instrument, is now cached on first access. Resolving these names walked up the chain of parent instruments on every access, which was a significant part of the time spent taking a snapshot of a station, e.g. at the start of every measurement. Taking a snapshot of a station with a few thousand parameters on nested instrument modules is now around 25% faster. The name is only cached if it is built by the default implementations ofname_partsandshort_nameof the component and all its parents, since these only depend on attributes set when the component is created. Components where any of these are overridden, and therefore may change name after creation, still computefull_nameon every access. (#7706)Repeated calls to
get_parameter_dataon a startedDataSet, and to methods built on it such asto_pandas_dataframeandto_xarray_dataset, are now faster as the run description held by the dataset is used rather than reading and parsing it from the database on every call. Callingget_parameter_dataon aDataSetthat has not been started now returns empty arrays for its parameters rather than raising aKeyError. ARunDescribernow holds a copy of the shapes it is created with, so changing the shapes mapping passed toMeasurement.set_shapes, e.g. to reuse it for another measurement, no longer changes thedescription.shapesof datasets that have already been recorded. (#8726)Fixed two race conditions in
DataSetsubscribers. A result inserted while a subscriber’s callback was running could be held back until the next insert, and when a dataset was completed, its final callback could run concurrently with one already in progress on the subscriber thread, delivering results out of order. Subscriber callbacks now never overlap and always receive results in the order they were inserted. The length passed to a subscriber callback is now always the number of results in the dataset up to and including the ones passed along with it. Previously it could be off when results were inserted while the callback was being called. (#8758)Subscribing to a
DataSetthat is written in the background (write_in_background=True) now raises aNotImplementedError. This combination never worked: the background writer failed to insert the first results and the measurement then hung.Measurement.runraises the error before the run is created if subscribers are set up viaMeasurement.add_subscriber, thesubscription.default_subscribersconfig option orDataSaver.default_callback. (#8758)The instrument loggers (
self.logandself.visa_logof instruments, channels and other instrument modules) no longer log while the garbage collector closes an instrument that was not closed, since the garbage collector runs at an arbitrary point in time and on any thread, possibly in the middle of other logging, where logging is not safe with all log handlers.IPInstrumentnow logs through its instrument logger, so that this also applies to it. Its log records are therefore emitted by theqcodes.instrument.instrument_baselogger with the name of the instrument, rather than by theqcodes.instrument.iplogger. (#8769)Instruments whose initialization fails are now closed right away, so that the resources they acquired before the failure, such as an open VISA connection, are freed immediately rather than when the instrument is garbage collected. Previously, retrying to create an instrument for a resource that can only be opened once could fail until the garbage collector had run. This also applies to instruments that cannot be registered, e.g. because their name is already in use, or that have abstract parameters, and to instruments whose
__init__returns a value (which raises aTypeError). If closing the instrument fails too, this is added as a note to the error of the initialization. Instruments that fail beforeInstrument.__init__has completed, e.g. because a driver validates its arguments first, are not closed, since close methods rely on the name, parameters and logger that it sets up. (#8769)Instruments that have been closed are no longer closed a second time when they are garbage collected. Previously, the
closemethod of a driver could run again at an arbitrary later point in time, possibly after the name or the resources of the instrument had been reused by a new instrument. Instruments that are garbage collected without having been closed are still closed, but instruments should always be closed explicitly, e.g. withcloseorInstrument.close_all. (#8769)Instrument.closenow does nothing if the instrument has already been closed; close methods of subclasses still run before they call it. Closing anIPInstrumenta second time no longer raises anAttributeError, and closing it now also closes its socket if the socket cannot be shut down, e.g. because it is not connected. (#8769)
Improved Drivers:¶
The remaining parameters of the Stanford Research
SR560,SR830andSR86xdrivers are now annotated with the type of their value, e.g.SR830.buffer_SRisParameter[float | Literal["Trigger"], Self]. Fixed the following SR830 driver bugs found along the way:The time setpoints of the data buffer (
ch1_databuffer,ch2_databufferandsweep_setpoints) are now spaced by the sample period,1 / buffer_SR. Previously N points spannedN / buffer_SR, so the spacing was too large by a factorN / (N - 1).sweep_setpointsnow keeps the unit and label of the sweep when the sample rate is switched back to"Trigger", and showss/Timewhile a constant sample rate is used. Set the unit and label of the sweep withset_sweep_parametersor, together with a customsweep_array, with the newsweep_setpoints.set_sweep_unit_and_label.Creating an
SR830no longer emits aQCoDeSDeprecationWarningaboutChannelBuffernot forwarding its keyword arguments. (#8696)
The remaining parameters of the
YokogawaGS200driver are now annotated with the type of their value, e.g.Parameter[float, Self].YokogawaGS200Program.countis annotated asint | Literal["MIN", "MAX"]: it can be set to"MIN"or"MAX", and getting it always returns an integer, but until it is read again the cached value is the keyword that was set. The status register parameters return theStatusByte,StandardEventRegister,ExtendedEventRegisterandConditionRegisterflags as before, and are now annotated as such.Fixed the following driver bugs found along the way:
YokogawaGS200.ramp_voltageandramp_currentraised aTypeErrorwhen called withramp_mode="SOFTWARE". They now perform the software ramp, and raise aValueErroriframp_stepis 0, which would otherwise jump directly to the target.A software ramp of the
YokogawaGS200to a target outside the output range of the present source range now raises before changing the output. Previously it stepped up to the limit of the range before raising. (#8697)
The Keithley_2600.yaml pyvisa-sim file now also defines the resources GPIB::3::INSTR and GPIB::4::INSTR, so that up to four simulated Keithley 2600 instruments with independent state can be used at the same time. (#8756)
The
SignalHoundUSBSA124Bdriver now logs through its instrument logger, so that it does not log while the garbage collector closes it. Its log records are therefore emitted by theqcodes.instrument.instrument_baselogger with the name of the instrument, rather than by the logger of the driver module.SignalHoundUSBSA124B.check_for_erroris therefore no longer a static method, so it can no longer be called on the class without an instance. (#8769)Closing a
DynaCool,GalilMotionController,KeysightM960x,KeysightM9336A,SignalHoundUSBSA124Bor MiniCircuits USB HID instrument that has already been closed no longer raises anAttributeError. Closing them after their initialization failed before connecting no longer fails either.KeysightM960x,KeysightM9336AandSignalHoundUSBSA124Bno longer try to close a session or device that failed to open, andDynaCoolnow closes its VISA connection also if telling the server that it closes the connection fails, e.g. because the VISA session has already been closed. (#8769)GalilMotionControllerand the MiniCircuits USB HID drivers (MiniCircuitsHIDMixinsubclasses) now fully close the instrument inclose. Previously, they only closed the connection, so the instrument stayed registered and its name could not be reused until it was garbage collected. (#8769)
Under the hood:¶
Tests are now distributed between pytest-xdist workers using
workstealrather thanloadfile, so that a single slow test file no longer determines the duration of the test run. (#xxxx)The test suite runs faster, especially on Windows: test databases are now opened with SQLite’s
PRAGMA synchronous=OFFso that commits are not flushed to disk. (#8748)All temporary files created by the test suite are now placed under pytest’s temporary directory root, so setting
PYTEST_DEBUG_TEMPROOT(or--basetemp) relocates all of them. (#8749)VisaInstrumentno longer logs when the VISA handle of an instrument that was not closed is closed as the instrument is garbage collected, since logging from within the garbage collector or during interpreter shutdown is not safe with all log handlers. (#8769)