Speeding up trace transfer?

Applications, development tools, FPGA, C, WEB
Post Reply
gsteele13
Posts: 3
Joined: Thu Mar 12, 2020 3:11 pm

Speeding up trace transfer?

Post by gsteele13 » Thu Mar 12, 2020 3:36 pm

Hi all,

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
The full notebook can be found on github:

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
Is there a way to speed this up somehow? An transfer overhead of nearly 1000% is not so handy...

Any suggestions (or working code even) highly welcome.

Thanks,
Gary

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 9 guests