Add early validation for setpoint parameters in follow_param()#38
Closed
Add early validation for setpoint parameters in follow_param()#38
Conversation
- Add check in BaseSweep.follow_param() to raise clear error when users try to follow setpoint parameters - Override follow_param() in Sweep2D to check both inner and outer setpoint parameters - Add _internal flag to allow Sweep2D to internally follow outer parameter without triggering validation - Add comprehensive tests in test_sweep_validation.py - Error messages now clearly explain that setpoint parameters are automatically recorded Co-authored-by: caidish <[email protected]>
- Delegate Sweep2D.follow_param to inner sweep to ensure numeric validation - Add test assertion to verify params not added when error occurs - Add test to verify Sweep2D properly rejects non-numeric parameters Co-authored-by: caidish <[email protected]>
Copilot
AI
changed the title
[WIP] Improve error message for setpoint parameters in follow_param
Add early validation for setpoint parameters in follow_param()
Jan 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Users attempting to follow setpoint parameters (the swept parameter itself) received cryptic
ValueError: Invalid dependenciesfrom QCoDeS at measurement start. This occurred when users mistakenly calledsweep.follow_param(voltage)wherevoltagewas the setpoint being swept, creating a circular dependency that QCoDeS detected but reported unclearly.Changes
BaseSweep.follow_param()
self.set_parambefore adding to_paramsValueErrorexplaining setpoints are auto-recorded as independent variables_internalflag to bypass validation for internal use (Sweep2D outer parameter tracking)Sweep2D.follow_param()
self.in_param(inner) andself.set_param(outer) setpointsin_sweep.follow_param(..., _internal=True)for numeric parameter validationTests
Example
Before:
After:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.