From ee6687e892f67639e35147cd328410ba4d11b6fd Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Thu, 12 Oct 2017 13:41:33 +0200 Subject: [PATCH] Mercury when aborting a ramp switch the magnet to hold --- qcodes/instrument_drivers/oxford/mercuryiPS.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/qcodes/instrument_drivers/oxford/mercuryiPS.py b/qcodes/instrument_drivers/oxford/mercuryiPS.py index c86cc4b0951..c311bb7bef8 100644 --- a/qcodes/instrument_drivers/oxford/mercuryiPS.py +++ b/qcodes/instrument_drivers/oxford/mercuryiPS.py @@ -207,8 +207,12 @@ def _ramp_to_setpoint(self, ax, cmd, setpoint): self._set_fld(ax, cmd, setpoint) self.rtos() if self.hold_after_set(): - while not all(['HOLD' == getattr(self, a.lower() + '_ACTN')() for a in ax]): - time.sleep(0.1) + try: + while not all(['HOLD' == getattr(self, a.lower() + '_ACTN')() for a in ax]): + time.sleep(0.1) + except KeyboardInterrupt: + self.hold() + raise KeyboardInterrupt def _ramp_to_setpoint_and_wait(self, ax, cmd, setpoint): error = 0.2e-3