Skip to content

Add generic annotations to Keysight drivers - #8695

Draft
Jens Hedegaard Nielsen (jenshnielsen) wants to merge 7 commits into
microsoft:mainfrom
jenshnielsen:keysight_annotations
Draft

Jens Hedegaard Nielsen (jenshnielsen) wants to merge 7 commits into
microsoft:mainfrom
jenshnielsen:keysight_annotations

Conversation

@jenshnielsen

Copy link
Copy Markdown
Collaborator

No description provided.

The staircase sweep setup methods now convert their enum or int
arguments before setting the parameters, and the B1517A one takes the
WM post sweep condition rather than the B1520A WMDCV one.
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.31373% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.08%. Comparing base (a34b964) to head (8df123b).
⚠️ Report is 26 commits behind head on main.

Files with missing lines Patch % Lines
...t_drivers/Keysight/keysightb1500/KeysightB1517A.py 60.00% 4 Missing ⚠️
...t_drivers/Keysight/keysightb1500/KeysightB1520A.py 60.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8695      +/-   ##
==========================================
+ Coverage   75.02%   75.08%   +0.06%     
==========================================
  Files         307      307              
  Lines       32511    32545      +34     
==========================================
+ Hits        24392    24438      +46     
+ Misses       8119     8107      -12     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

open and short were command-only parameters, so calling them without
an argument, as the example does, returned the cached value and did
not execute the correction.
Since NumericScpiMnemonic became a PEP 695 type alias, get_args returns
an empty tuple for it, so "MIN", "MAX" and "DEF" were formatted as
numbers and raised a ValueError.
Getting these parameters returns a number, but they can also be set to
keywords such as MIN or MAX, which stay in the cache until the next
get, so they are annotated as float | str and their docstrings say so.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new correction commands are defined as properties without required defaults, causing pyvisa-sim to fail loading and blocking all E4980A driver tests.

1 open issue
What changed in this PR

This PR improves parameter typing across QCoDeS Keysight drivers and makes E4980A correction calls execute instrument commands.

Changes:

  • Add generic parameter annotations and explicit enum conversions to B1500 and B220x drivers.
  • Replace E4980A OPEN and SHORT correction parameters with methods, with simulator support and regression tests.
  • Document typing improvements and the correction API breaking change.
File Description
tests/​drivers/​test_keysight_e4980a.py Test correction command dispatch and subsequent queries.
tests/​drivers/​keysight_b1500/​b1500_driver_tests/​test_b1517a_smu.py Align enum usage and annotate intentional integer input.
src/​qcodes/​instrument/​sims/​Keysight_E4980A.yaml Add simulated correction commands.
src/​qcodes/​instrument_drivers/​Keysight/​keysightb1500/​KeysightB1520A.py Type enum parameters and convert setup arguments.
src/​qcodes/​instrument_drivers/​Keysight/​keysightb1500/​KeysightB1517A.py Type parameters and correct the post-sweep enum.
src/​qcodes/​instrument_drivers/​Keysight/​keysight_e4980a.py Replace correction parameters with command methods.
src/​qcodes/​instrument_drivers/​Keysight/​keysight_b220x.py Type integer and list parameters.
docs/​changes/​newsfragments/​8695.improved_driver Describe driver typing improvements.
docs/​changes/​newsfragments/​8695.breaking Explain correction API migration.

Review effort: Balanced

Comment on lines +53 to +55
correction_open:
setter:
q: ":CORRection:OPEN"

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants