Skip to content

Commit 2268980

Browse files
author
Hsuan-Tung Peng
committed
Fix negative current bug
1 parent de3bd73 commit 2268980

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lightlab/equipment/lab_instruments/Keithley_2400_SM.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ def setCurrentMode(self, protectionVoltage=1):
7474

7575
def _configCurrent(self, currAmps):
7676
currAmps = float(currAmps)
77-
currAmps = np.clip(currAmps, a_min=1e-6, a_max=1.)
77+
if currAmps >= 0:
78+
currAmps = np.clip(currAmps, a_min=1e-6, a_max=1.)
79+
else:
80+
currAmps = np.clip(currAmps, a_min=-1, a_max=-1e-6)
7881
if currAmps != 0:
7982
needRange = 10 ** np.ceil(np.log10(abs(currAmps)))
8083
self.setConfigParam('SOURCE:CURR:RANGE', needRange)

0 commit comments

Comments
 (0)