Add more explicit channel attributes#7686
Conversation
|
@jenshnielsen I've opened a new pull request, #7687, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: jenshnielsen <548266+jenshnielsen@users.noreply.github.com>
Add tests for multi_parameter and multi_function methods
|
@copilot could you add a changelog fragment as described in the pull request template. Please add one for the changes to the channeltuple class and one for each of the two drivers that changed |
|
@jenshnielsen I've opened a new pull request, #7688, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: jenshnielsen <548266+jenshnielsen@users.noreply.github.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7686 +/- ##
==========================================
+ Coverage 59.78% 59.79% +0.01%
==========================================
Files 352 352
Lines 31659 31683 +24
==========================================
+ Hits 18927 18946 +19
- Misses 12732 12737 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add changelog fragments for ChannelTuple and driver improvements
There was a problem hiding this comment.
Pull request overview
This PR enhances type safety for channel-based instrument drivers by adding explicit type annotations to channel submodules and introducing new type-safe methods for accessing parameters and functions across multiple channels.
Key Changes:
- Added
multi_parameterandmulti_functionmethods toChannelTuplefor explicit, type-safe access to multi-channel operations - Updated
TektronixTPS2012,RohdeSchwarzZNBBase, andMiniCircuitsRCSPDTdrivers with explicit type annotations on theirchannelsattributes - Enhanced the
__getattr__method documentation to guide users toward the new type-safe methods
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/qcodes/instrument/channel.py |
Added multi_parameter and multi_function methods to ChannelTuple class, providing explicit type-safe alternatives to __getattr__ for accessing parameters and functions on all channels |
tests/test_channels.py |
Added comprehensive tests for the new multi_parameter and multi_function methods, including edge cases for invalid names and empty channel tuples |
src/qcodes/instrument_drivers/tektronix/TPS2012.py |
Added type annotation and docstring to channels attribute using ChannelTuple[TektronixTPS2012Channel] |
src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py |
Added type annotation and docstring to channels attribute using ChannelList[RohdeSchwarzZNBChannel], and updated autoscale call to use new multi_function method |
src/qcodes/instrument_drivers/Minicircuits/_minicircuits_rc_spdt.py |
Added type annotation and docstring to channels attribute using ChannelTuple[MiniCircuitsRCSPDTChannel] |
docs/changes/newsfragments/7686.improved |
Newsfragment documenting the addition of multi_parameter and multi_function methods |
docs/changes/newsfragments/7686.improved_driver |
Newsfragment documenting the driver type annotation improvements |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Add methods to ChannelTuple/List that ensures we always get a multi_parameter/callable and change the value returned by
__getattr__to None.Copy of #7641 to allow copilot to contribute