-
Notifications
You must be signed in to change notification settings - Fork 343
Make use of generic parameters in some instruments #7822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Make use of generic parameters in some instruments #7822
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7822 +/- ##
==========================================
- Coverage 59.88% 59.88% -0.01%
==========================================
Files 352 352
Lines 31843 31865 +22
==========================================
+ Hits 19070 19082 +12
- Misses 12773 12783 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
e113273 to
98f53fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR follows up on #7730 by applying generic type parameters to various instrument drivers in QCoDeS, enabling better type introspection for instruments and their parameters.
Changes:
- Added generic type parameters to Parameter, MultiParameter, ArrayParameter, and ParameterWithSetpoints classes across multiple instrument drivers
- Removed unnecessary
cast()andassert isinstance()calls where type information is now available through generics - Improved type annotations throughout instrument driver files
- Updated test files to include type assertions for better test clarity
- Replaced if-else statements with match statements in some locations
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/drivers/keysight_b1500/b1500_driver_tests/test_b1520a_cmu.py | Added isinstance assertions for type checking in tests |
| tests/drivers/keysight_b1500/b1500_driver_tests/test_b1517a_smu.py | Added isinstance assertions for type checking in tests |
| src/qcodes/instrument_drivers/yokogawa/Yokogawa_GS200.py | Added generic parameter types and replaced if-else with match statements |
| src/qcodes/instrument_drivers/tektronix/DPO7200xx.py | Made measurement parameter generic, removed cast |
| src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py | Added generic types to MultiParameter and ArrayParameter classes, removed unused imports |
| src/qcodes/instrument_drivers/QuantumDesign/DynaCoolPPMS/DynaCool.py | Improved type annotation for _pick_one method, removed cast |
| src/qcodes/instrument_drivers/Keysight/private/Keysight_344xxA_submodules.py | Added generic types to InstrumentChannel and ParameterWithSetpoints |
| src/qcodes/instrument_drivers/Keysight/keysightb1500/message_builder.py | Improved type annotations using ParamSpec and TypeVar |
| src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1520A.py | Added generic types and root_instrument property with cast |
| src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1517A.py | Added generic types to parameter classes, removed cast calls |
| src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_sampling_measurement.py | Added generic type and root_instrument property |
| src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_module.py | Added generic type to InstrumentChannel base class |
| src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_base.py | Added generic types and root_instrument property with assert isinstance |
| src/qcodes/instrument_drivers/Keysight/KtM960x.py | Added generic type to Measure parameter |
| src/qcodes/instrument_drivers/Keysight/Keysight_N9030B.py | Added comprehensive generic types throughout, replaced assert with proper error handling |
| src/qcodes/instrument_drivers/AlazarTech/utils.py | Added generic type to TraceParameter, removed cast |
tests/drivers/keysight_b1500/b1500_driver_tests/test_b1520a_cmu.py
Outdated
Show resolved
Hide resolved
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_base.py
Show resolved
Hide resolved
d76f9bb to
c12206c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_base.py
Outdated
Show resolved
Hide resolved
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_base.py
Outdated
Show resolved
Hide resolved
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_base.py
Show resolved
Hide resolved
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_base.py
Outdated
Show resolved
Hide resolved
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_base.py
Outdated
Show resolved
Hide resolved
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_base.py
Outdated
Show resolved
Hide resolved
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_base.py
Show resolved
Hide resolved
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_base.py
Show resolved
Hide resolved
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_base.py
Outdated
Show resolved
Hide resolved
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_module.py
Outdated
Show resolved
Hide resolved
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_sampling_measurement.py
Outdated
Show resolved
Hide resolved
1e06d54 to
e6a098d
Compare
Use self when possible Co-authored-by: Mikhail Astafev <astafan8@gmail.com>
7f0bcfd to
a985ec0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Make use of new generic features in parameters. The focus is to eliminate the use of assert and cast in drivers when possible