I'm working on some code to create a "live update" plots of traces acquired by my STEMlab125-14. The code I'm using is here:
Code: Select all
def get_IV_t(timebase=-3):
tn = [time.time()]
# Configure timebase and input range settings
rp.tx_txt("ACQ:DEC %d" % dec[timebase])
#print("setting dec to %d " % dec[timebase])
#print("t_total is %f" % t_total[timebase])
rp.tx_txt('ACQ:SOUR1:GAIN HV')
rp.tx_txt('ACQ:SOUR2:GAIN HV')
# Start the acquisition
rp.tx_txt('ACQ:START')
time.sleep(t_total[timebase]+0.1) # to avoid getting old data in the buffer
rp.tx_txt('ACQ:TRIG NOW')
tn.append(time.time())
# Wait until it's done
while 1:
rp.tx_txt('ACQ:TRIG:STAT?')
if rp.rx_txt() == 'TD':
break
tn.append(time.time())
# Download the traces
rp.tx_txt('ACQ:SOUR1:DATA?')
buff_string = rp.rx_txt()
buff_string = buff_string.strip('{}\n\r').replace(" ", "").split(',')
I = np.array(list(map(float, buff_string))) / 1e4
tn.append(time.time())
rp.tx_txt('ACQ:SOUR2:DATA?')
buff_string = rp.rx_txt()
buff_string = buff_string.strip('{}\n\r').replace(" ", "").split(',')
V = np.array(list(map(float, buff_string))) / 1e4
tn.append(time.time())
# Create the appropriate time array
t = np.linspace(0,t_total[timebase],len(I))
if True:
print("Total time: %f" % (tn[-1]-tn[0]))
print("Splits:")
for i in range(len(tn)-1):
print("%f" % (tn[i+1]-tn[i]))
# Return the traces
return I,V,t
github / gsteele13 / gary-misc-notebooks / Prototype SQUID practicum software.ipynb
What I notice is that getting the traces off the board is very slow: for a 134 microsecond acquision, the code above takes nearly 1.8 seconds to get the data off!
Code: Select all
Total time: 1.767000
Splits:
0.236000
0.396000
0.585000
0.550000
Any suggestions (or working code even) highly welcome.
Thanks,
Gary