Refactor Keithley 2600 driver to use ParameterWithSetpoints for fast sweep#7851
Refactor Keithley 2600 driver to use ParameterWithSetpoints for fast sweep#7851trlemon wants to merge 46 commits intomicrosoft:mainfrom
ParameterWithSetpoints for fast sweep#7851Conversation
…s://github.com/trlemon/Qcodes into trlemon/refactor-keithley2600-driver-fastsweep
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7851 +/- ##
==========================================
+ Coverage 60.56% 70.30% +9.73%
==========================================
Files 333 333
Lines 32245 32401 +156
==========================================
+ Hits 19529 22778 +3249
+ Misses 12716 9623 -3093 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…s://github.com/trlemon/Qcodes into trlemon/refactor-keithley2600-driver-fastsweep
…s://github.com/trlemon/Qcodes into trlemon/refactor-keithley2600-driver-fastsweep
astafan8
left a comment
There was a problem hiding this comment.
is it ready for the final review, can it exit the draft mode? :)
|
@trlemon This needs a rebase / merge probably because of the 4 wire pr that was merged |
There was a problem hiding this comment.
Pull request overview
Refactors the Keithley 2600 fast sweep implementation away from qcodes_loop by introducing a ParameterWithSetpoints-based API (setup_fastsweep + fastsweep) that returns NumPy arrays and supports both 1D and 2D buffered sweeps.
Changes:
- Added
setup_fastsweepconfiguration method and rewrote fast sweep execution to use on-instrument Lua scripts viaParameterWithSetpoints. - Added 1D/2D fast sweep configuration + execution tests (including channel detection and reconfiguration regression coverage).
- Added a changelog newsfragment describing the driver change (and marking it as breaking).
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/drivers/test_keithley_26xx.py | Adds tests for 1D/2D fast sweep configuration, execution shaping, channel inference, and reconfiguration regression. |
| src/qcodes/instrument_drivers/Keithley/_Keithley_2600.py | Introduces _FastSweepConfig, setup_fastsweep, and rewrites fastsweep as a ParameterWithSetpoints using Lua scripts. |
| docs/changes/newsfragments/7851.improved_driver | Documents the breaking fast sweep API change in the changelog. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| @property | ||
| def param(self) -> ParameterBase: ... | ||
|
|
||
| def prepareSweep(self, start: float, stop: float, steps: int, mode: str) -> None: | ||
| """ | ||
| Builds setpoints and labels | ||
| @property | ||
| def delay(self) -> float: ... | ||
|
|
||
| Args: | ||
| start: Starting point of the sweep | ||
| stop: Endpoint of the sweep | ||
| steps: No. of sweep steps | ||
| mode: Type of sweep, either 'IV' (voltage sweep), | ||
| 'VI' (current sweep two probe setup) or | ||
| 'VIfourprobe' (current sweep four probe setup) | ||
| @property | ||
| def num_points(self) -> int: ... | ||
|
|
||
| def get_setpoints(self) -> npt.NDArray: ... |
There was a problem hiding this comment.
_LinSweepLike.param is typed as ParameterBase, but setup_fastsweep immediately casts it to Parameter and passes it to infer_channel, whose signature requires a Parameter (see qcodes/extensions/infer.py). This mismatch means the protocol currently claims to accept sweep objects whose param is not a Parameter, but the implementation will fail at runtime / type-check time. Please align the protocol with actual requirements (e.g., require param: Parameter) and remove the unsafe cast, or adjust the channel inference to support ParameterBase inputs.
|
@trlemon Could you have a look at the last copilot review comments. Other than that this should be good to merge |
Background
The
doFastSweepmethod relies on "old" technology fromqcodes_loop, and it also returns a Qcodes dataset which may not be desirable for all applications. Instead, it would be better to useParameterWithSetpointsand return a numpy array.Summary of Changes
qcodes_loop