Repository navigation
Add types to generic instrument parameteres - #8658
Jens Hedegaard Nielsen (jenshnielsen) wants to merge 33 commits into
Conversation
get_parser=bool turned the "0" response into True, and setting it sent True/False rather than 1/0. Also forward kwargs in ScopeArray so the driver can be instantiated without a deprecation warning.
Also fix the simulated trigger source setter, which had a stray '?'.
vals was silently overridden by val_mapping, so loop 2 accepted the 25 W range that only loop 1 supports.
The pulse width was returned as a string and labelled in ns, while the instrument and the validator use seconds.
The DG1000Z programming guide documents all of these replies in scientific notation. Also give the waveform parameter its own str getter instead of reusing the numeric waveform parameter helper.
The channel state, direct output and DC output are now booleans that accept True/False, 1/0 and "on"/"off". Also parse the sequence position as int.
Also annotate the range, voltage level and current level setters as taking floats rather than strings.
Only occupied slots get a module, so values are never None. Empty slots report model "0" for SYST:CTYP? and were already skipped.
The IF bandwidth is set in 1-1.5-2-3-5-7 steps, so e.g. 1.5 Hz is valid but could not be parsed as int. Add a minimal ZNB20 simulator to test it.
Passing the default parameter_class=Parameter explicitly prevented the value type from being inferred, so annotate the affected parameters with their value types.
Icomp and Pcomp are optional in the WV command, so allow None for the B1517A sweep compliances. Use an on/off value mapping for the B1520A LMN data monitor so it reads back as bool.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8658 +/- ##
==========================================
+ Coverage 72.59% 74.50% +1.91%
==========================================
Files 307 307
Lines 32431 32430 -1
==========================================
+ Hits 23543 24162 +619
+ Misses 8888 8268 -620 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
The compliance-clearing failure must be fixed before approval; the API-change newsfragment is also missing.
2 open issues
What changed in this PR
Adds explicit value and instrument-owner types to QCoDeS driver parameters, with runtime corrections and regression coverage to align parameter behavior with those types.
Changes:
- Adds generic parameter annotations across instrument drivers.
- Corrects numeric parsing, boolean mappings, selected SCPI commands, units, and validation.
- Expands simulator definitions and driver regression tests.
Review findings:
- Moderate —
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1517A.py:458: Clearing power compliance still raisesValueErrorwhen current compliance is unset, leaving the previous power limit stored. Apply the prerequisite check only for non-Nonepower limits, and test clearing current compliance before power compliance, plus clearing power compliance on a fresh sweeper. - Nit —
src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py:60: Add a reStructuredText newsfragment underdocs/changes/newsfragments/documenting the observable getter, unit, and validation changes, including the publicpulse_widthreturn-type and unit changes.
Validation included source inspection and an isolated check confirming the compliance-clearing failure. Project tests and type checking were not run.
| File | Description |
|---|---|
tests/drivers/test_tektronix_tps2012.py |
Tests numeric trigger-level reads and writes. |
tests/drivers/test_tektronix_dpo7200xx.py |
Tests boolean measurement state and legacy inputs. |
tests/drivers/test_tektronix_awg5014c.py |
Tests sequence positions and boolean outputs. |
tests/drivers/test_stanford_research_sr86x.py |
Tests integer capture progress. |
tests/drivers/test_rto_1000.py |
Tests trigger configuration and numeric impedance. |
tests/drivers/test_rs_sgs100a.py |
Tests output helpers and legacy status inputs. |
tests/drivers/test_rohde_schwarz_znb.py |
Tests fractional bandwidth and derived setpoints. |
tests/drivers/test_rigol_ds4000.py |
Tests boolean autoscale behavior. |
tests/drivers/test_rigol_ds1074z.py |
Tests numeric trigger levels. |
tests/drivers/test_rigol_dg1062.py |
Tests waveform and burst parameter types. |
tests/drivers/test_lakeshore_325.py |
Tests loop-specific heater output ranges. |
tests/drivers/test_keysight_e4980a.py |
Tests numeric impedance ranges. |
tests/drivers/test_keysight_34980a.py |
Tests occupied slots and generic module fallback. |
tests/drivers/test_keithley_7510.py |
Tests delay, averaging, and digitization parameters. |
tests/drivers/test_keithley_6500.py |
Tests display-digit configuration. |
tests/drivers/test_keithley_2450.py |
Tests numeric sensing and source parameters. |
tests/drivers/test_coppermountain_m5065.py |
Tests averaging triggers and legacy inputs. |
tests/drivers/test_agilent_e8267c.py |
Tests numeric pulse widths in seconds. |
tests/drivers/keysight_b1500/test_messagebuilder.py |
Tests PCH commands and queries. |
tests/drivers/keysight_b1500/b1500_driver_tests/test_b1520a_cmu.py |
Tests monitor state and legacy inputs. |
tests/drivers/keysight_b1500/b1500_driver_tests/test_b1517a_smu.py |
Tests clearing sweep compliance limits. |
src/qcodes/instrument/sims/Tektronix_TPS2012.yaml |
Adds TPS2012 simulation support. |
src/qcodes/instrument/sims/SR860.yaml |
Adds capture-progress simulation. |
src/qcodes/instrument/sims/RTO_1000.yaml |
Models trigger mode and impedance; fixes source writes. |
src/qcodes/instrument/sims/Rohde_Schwarz_ZNB20.yaml |
Adds single-channel bandwidth simulation. |
src/qcodes/instrument/sims/Rigol_DS4000.yaml |
Models boolean autoscale state. |
src/qcodes/instrument/sims/Rigol_DS1074Z.yaml |
Models scientific-notation trigger levels. |
src/qcodes/instrument/sims/Rigol_DG1062.yaml |
Models waveform, burst, and duty-cycle responses. |
src/qcodes/instrument/sims/lakeshore_model325.yaml |
Models loop-specific output ranges. |
src/qcodes/instrument/sims/Keysight_E4980A.yaml |
Models impedance range and autorange. |
src/qcodes/instrument/sims/keithley_7510.yaml |
Models averaging, delay, and digitization settings. |
src/qcodes/instrument/sims/Keithley_6500.yaml |
Adds display-digit simulation. |
src/qcodes/instrument/sims/Keithley_2450.yaml |
Models numeric sensing and source settings. |
src/qcodes/instrument/sims/Agilent_E8267C.yaml |
Adds pulse-width simulation. |
src/qcodes/instrument_drivers/yokogawa/Yokogawa_GS200.py |
Types monitoring, program, and source parameters. |
src/qcodes/instrument_drivers/tektronix/TPS2012.py |
Types parameters and parses trigger levels numerically. |
src/qcodes/instrument_drivers/tektronix/AWG70000A.py |
Types waveform, clock, and output parameters. |
src/qcodes/instrument_drivers/stanford_research/SR560.py |
Types the inversion parameter. |
src/qcodes/instrument_drivers/stanford_research/SG384.py |
Types synthesis and modulation parameters. |
src/qcodes/instrument_drivers/stahl/stahl.py |
Types electrical, lock, and temperature readings. |
src/qcodes/instrument_drivers/signal_hound/SignalHound_USB_SA124B.py |
Types acquisition settings and readings. |
src/qcodes/instrument_drivers/rigol/Rigol_DS4000.py |
Types parameters and fixes autoscale mapping and keyword forwarding. |
src/qcodes/instrument_drivers/rigol/Rigol_DS1074Z.py |
Types parameters and converts trigger levels to floats. |
src/qcodes/instrument_drivers/rigol/Rigol_DG4000.py |
Types counter and system parameters. |
src/qcodes/instrument_drivers/rigol/Rigol_DG1062.py |
Types parameters and fixes numeric parsing and polarity validation. |
src/qcodes/instrument_drivers/rigol/private/DP8xx.py |
Types supply-channel parameters. |
src/qcodes/instrument_drivers/QuantumDesign/DynaCoolPPMS/DynaCool.py |
Types temperature, field, and chamber parameters. |
src/qcodes/instrument_drivers/QDev/QDac_channels.py |
Types current, calibration, and verbosity parameters. |
src/qcodes/instrument_drivers/oxford/triton.py |
Types system status and PID-control parameters. |
src/qcodes/instrument_drivers/oxford/MercuryiPS_VISA.py |
Types magnet-channel and temperature parameters. |
src/qcodes/instrument_drivers/Minicircuits/Base_SPDT.py |
Types the base switch parameter. |
src/qcodes/instrument_drivers/Minicircuits/_minicircuits_rudat_13g_90.py |
Types identification and attenuation parameters. |
src/qcodes/instrument_drivers/Minicircuits/_minicircuits_rc_spdt.py |
Types SPDT switch selection. |
src/qcodes/instrument_drivers/Minicircuits/_minicircuits_rc_sp4t.py |
Types SP4T switch selection. |
src/qcodes/instrument_drivers/Lakeshore/Lakeshore_model_336.py |
Types calibration-curve selection. |
src/qcodes/instrument_drivers/Lakeshore/Lakeshore_model_325.py |
Types parameters and fixes loop-specific range validation. |
src/qcodes/instrument_drivers/Lakeshore/lakeshore_base.py |
Types shared heater and sensor parameters. |
src/qcodes/instrument_drivers/Keysight/private/Keysight_344xxA_submodules.py |
Types trigger, display, and measurement parameters. |
src/qcodes/instrument_drivers/Keysight/N52xx.py |
Types network-analyzer parameters. |
src/qcodes/instrument_drivers/Keysight/N51x1.py |
Types signal-generation and output parameters. |
src/qcodes/instrument_drivers/Keysight/KtMAwg.py |
Types channel configuration and gain parameters. |
src/qcodes/instrument_drivers/Keysight/KtM960x.py |
Types output and measurement configuration. |
src/qcodes/instrument_drivers/Keysight/keysightb1500/message_builder.py |
Corrects the PCH query command. |
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1520A.py |
Types CMU parameters and normalizes monitor state. |
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1517A.py |
Types sweep parameters and permits unset compliance values. |
src/qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1500_base.py |
Types autozero state. |
src/qcodes/instrument_drivers/Keysight/Keysight_N9030B.py |
Types analyzer settings and operating modes. |
src/qcodes/instrument_drivers/Keysight/Keysight_N6705B.py |
Types power-supply channel parameters. |
src/qcodes/instrument_drivers/Keysight/keysight_e4980a.py |
Types parameters and parses impedance ranges numerically. |
src/qcodes/instrument_drivers/Keysight/keysight_b220x.py |
Types routing, status, and connection parameters. |
src/qcodes/instrument_drivers/Keysight/keysight_34980a.py |
Types module storage and consolidates module registration. |
src/qcodes/instrument_drivers/Keysight/keysight_34934a.py |
Types relay-protection mode. |
src/qcodes/instrument_drivers/Keithley/Keithley_6500.py |
Types parameters and fixes the display-digit setter. |
src/qcodes/instrument_drivers/Keithley/Keithley_3706A.py |
Types connection and communication parameters. |
src/qcodes/instrument_drivers/Keithley/Keithley_2400.py |
Types source, sensing, and output parameters. |
src/qcodes/instrument_drivers/Keithley/Keithley_2000.py |
Types parameters and makes response parsing generic. |
src/qcodes/instrument_drivers/Keithley/_Keithley_2600.py |
Types channel and display parameters. |
src/qcodes/instrument_drivers/ithaco/Ithaco_1211.py |
Types the inversion parameter. |
src/qcodes/instrument_drivers/HP/HP_8753D.py |
Types sweep and display parameters. |
src/qcodes/instrument_drivers/HP/HP_83650A.py |
Types frequency, power, and modulation parameters. |
src/qcodes/instrument_drivers/HP/HP_8133A.py |
Types pulse-generator parameters. |
src/qcodes/instrument_drivers/Galil/dmc_41x3.py |
Types motion and controller parameters. |
src/qcodes/instrument_drivers/cryomagnetics/_TM620.py |
Types temperature readings. |
src/qcodes/instrument_drivers/cryomagnetics/_cryomagnetics4g.py |
Types magnet settings and readings. |
src/qcodes/instrument_drivers/CopperMountain/_M5xxx.py |
Types VNA parameters and uses boolean trigger control. |
src/qcodes/instrument_drivers/basel/BaselSP983a.py |
Types overload status. |
src/qcodes/instrument_drivers/american_magnetics/AMI430_visa.py |
Types heater, magnet, and ramp-control parameters. |
src/qcodes/instrument_drivers/AlazarTech/ATS9870.py |
Types acquisition settings. |
src/qcodes/instrument_drivers/AlazarTech/ATS9440.py |
Types acquisition settings. |
src/qcodes/instrument_drivers/AlazarTech/ATS9373.py |
Types acquisition settings and trigger holdoff. |
src/qcodes/instrument_drivers/AlazarTech/ATS9360.py |
Types acquisition settings and trigger holdoff. |
src/qcodes/instrument_drivers/AlazarTech/ATS_acquisition_controllers.py |
Types the acquisition result parameter. |
src/qcodes/instrument_drivers/AimTTi/_AimTTi_PL_P.py |
Types supply-channel parameters. |
src/qcodes/instrument_drivers/agilent/Agilent_E8267C.py |
Types parameters and corrects pulse-width parsing and units. |
src/qcodes/instrument_drivers/agilent/Agilent_E8257D.py |
Types parameters and uses boolean output helpers. |
src/qcodes/instrument_drivers/agilent/Agilent_34411A.py |
Types display-text parameters. |
src/qcodes/instrument_drivers/agilent/Agilent_34410A.py |
Types display-text parameters. |
src/qcodes/instrument_drivers/agilent/Agilent_34401A.py |
Types display text. |
src/qcodes/instrument_drivers/agilent/_Agilent_344xxA.py |
Types shared multimeter parameters. |
Review effort: Balanced
| # None omits Pcomp from the WV command, i.e. no power compliance | ||
| vals=vals.MultiType(vals.Numbers(0.001, 80), vals.Enum(None)), |
| unit="s", | ||
| set_cmd="PULM:INT:PWID {}", | ||
| get_cmd="PULM:INT:PWID?", | ||
| get_parser=float, |
|
One or more custom setup steps configured for this repository failed during this Copilot code review run: Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review. Note You can configure setup steps for Copilot code review separately from Copilot cloud agent with a |
| for slot in self.system_slots_info: | ||
| model_string = self.system_slots_info[slot]["model"] |



No description provided.