Closedown

This commit is contained in:
gac-x03da
2018-02-02 17:09:22 +01:00
parent 224714aa15
commit e88ea7118b

View File

@@ -90,6 +90,61 @@ def trig_scienta():
Scienta.waitReady(-1)
Scienta.waitNewImage(3000, image_id)
KEI_SAMPLE = "X03DA-KEITHLEY-1:"
KEI_REF = "X03DA-KEITHLEY-2:"
def init_keithley(dwell):
"""
prepare keithleys for gpib polling:
passive, bus triggered, dwell time
dwell = dwell time in seconds (0.1 - 20.0)
"""
caput(KEI_SAMPLE + "READSCAN.SCAN", 0)
caput(KEI_SAMPLE + "TTYPE", 2)
caput(KEI_REF + "READSCAN.SCAN", 0)
caput(KEI_REF + "TTYPE", 2)
nplc = 5.
navg = dwell / 0.1
if navg > 100:
nplc *= 2
navg /= 2
navg = min(navg, 100)
nplc = min(nplc, 10.)
caput(KEI_SAMPLE + "NPLC", nplc)
caput(KEI_REF + "NPLC", nplc)
caput(KEI_SAMPLE + "NAVG", navg)
caput(KEI_REF + "NAVG", navg)
def read_keithley():
"""
trigger keithleys, wait until done, and read the result into EPICS.
the value can then be read by pshell from the channel.
"""
dwell1 = caget(KEI_SAMPLE + "TOTTIME") / 1000.
dwell2 = caget(KEI_REF + "TOTTIME") / 1000.
dwell = max(dwell1, dwell2)
caput(KEI_SAMPLE + "DOINIT", 1)
caput(KEI_REF + "DOINIT", 1)
caput(KEI_SAMPLE + "DOTRIGGER", 1)
caput(KEI_REF + "DOTRIGGER", 1)
time.sleep(dwell)
caput(KEI_SAMPLE + "DOFETCH", 1)
caput(KEI_REF + "DOFETCH", 1)
def free_keithley():
"""
switch keithleys to free run.
0.1 s polling and dwell time
"""
caput(KEI_SAMPLE + "NPLC", 5.)
caput(KEI_REF + "NPLC", 5.)
caput(KEI_SAMPLE + "NAVG", 1)
caput(KEI_REF + "NAVG", 1)
caput(KEI_SAMPLE + "READSCAN.SCAN", 9)
caput(KEI_REF + "READSCAN.SCAN", 9)
caput(KEI_SAMPLE + "TTYPE", 0)
caput(KEI_REF + "TTYPE", 0)
diag_channels = []
diag_channels.append(Scienta.channelBegin) #diag_channels.append(ChannelDouble("ChannelBegin", "X03DA-SCIENTA:cam1:CHANNEL_BEGIN_RBV"))