I'm trying to control two instruments (laser and power meter) using NI GPIB. My code consists of a loop that sweeps the wavelength in both instruments and reads the power from the power meter.
The problem is that I need a time sleep step of at least 2.3 seconds inside the loop as shown below. If the sleep time is smaller, gpib reads wrong values from the power meter.
Without the time sleep step, I get the following error: VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.
Any recommendations? Not sure if it's an instrument or communication limit
CODE
for wavelength in range(wavelen_1, wavelen_2):
lsr.write('sour2:wav %s' %str(wavelength*1e-9))
pwm.write("W"+str(wavelength))
time.sleep(0.4) #at least 2.3
power = pwm.query('D?', delay=0.09)