diff --git a/docs/changes/newsfragments/improved_driver.5547 b/docs/changes/newsfragments/improved_driver.5547 new file mode 100644 index 00000000000..ac1b17c4e12 --- /dev/null +++ b/docs/changes/newsfragments/improved_driver.5547 @@ -0,0 +1,2 @@ +Keithley 2450s by default don't block when setting their output level, differing in behavior from the keithley 2400. +I added a manual boolian parameter 'block_during_ramp' which forces a check that the ramp command has been completed when True. diff --git a/src/qcodes/instrument_drivers/Keithley/Keithley_2450.py b/src/qcodes/instrument_drivers/Keithley/Keithley_2450.py index 6b041762209..1c360c3889a 100644 --- a/src/qcodes/instrument_drivers/Keithley/Keithley_2450.py +++ b/src/qcodes/instrument_drivers/Keithley/Keithley_2450.py @@ -10,7 +10,7 @@ create_on_off_val_mapping, invert_val_mapping, ) -from qcodes.validators import Arrays, Enum, Ints, Lists, Numbers +from qcodes.validators import Arrays, Bool, Enum, Ints, Lists, Numbers class _SweepDict(TypedDict): @@ -424,7 +424,7 @@ def __init__(self, parent: "Keithley2450", name: str, proper_function: str) -> N self.add_parameter( self._proper_function, - set_cmd=f"SOUR:{self._proper_function} {{}}", + set_cmd=self._set_proper_function, get_cmd=f"SOUR:{self._proper_function}?", get_parser=float, unit=unit, @@ -472,6 +472,22 @@ def __init__(self, parent: "Keithley2450", name: str, proper_function: str) -> N "when making a measurement.", ) + self.add_parameter( + "block_during_ramp", + initial_value=False, + get_cmd=None, + set_cmd=None, + vals=Bool(), + docstring="Setting the source output level alone cannot block the " + "execution of subsequent code. This parameter allows _proper_function" + "to either block or not.", + ) + + def _set_proper_function(self, value: float) -> None: + self.write(f"SOUR:{self._proper_function} {value}") + if self.block_during_ramp(): + self.ask("*OPC?") + def get_sweep_axis(self) -> np.ndarray: if self._sweep_arguments is None: raise ValueError(