Faster query time in pyvisa?

590 Views Asked by At

Is there any way to reduce the time it takes for pyvisa to query a value in an instrument and transfer said value to the program?

In my situation I'm working with three oscilloscopes at the same time. They are constantly measuring data and my python program is writing the values to a textfile. After an hour I get a total of 9000 measurements int total (which is just 0,83 measurements/second/oscilloscope).

I've searched in the documentation and I have found that the query function has an argument of time, but the argument is just to increase the time of delay.

Anything I might be missing?

The relevant code is as follows:

t_start = time.time()
while ((time.time()-time_run)<=3600.0):#measures for an hour
    meas_x_1 = float(oscilloscope_1.query('meas:vav? chan1'))
    meas_y_1 = float(oscilloscope_1.query('meas:vav? chan2'))
    meas_z_1 = float(oscilloscope_2.query('meas:vav? chan1'))
    
    meas_x_2 = float(oscilloscope_2.query('meas:vav? chan2'))
    meas_y_2 = float(oscilloscope_3.query('meas:vav? chan1'))
    meas_z_2 = float(oscilloscope_3.query('meas:vav? chan2'))
    
    total_meas += 1;
    #print(total_meas)
    file1.write(str(total_meas) + '\t' +str(meas_x_1) + '\t' + str(meas_y_1) + '\t' + str(meas_z_1) + '\t' + str(meas_x_2) + '\t'+ str(meas_y_2) + '\t' + str(meas_z_2) + '\n')
    if(total_meas %  100 == 0):
        print(int(time.time()-time_run)/60)
    #print(total_meas)
            

Some other information about the setup:

  • The oscilloscopes are from the: 2000-X series of Keysight InfiniiVision, specifically the DSO-X 2002A

  • The identification of the instruments are throught NI MAX (NI Measurement & Automation Explorer)

  • The oscilloscopes are connected to the oscilloscope through a USB cables

0

There are 0 best solutions below