Posted Wed, 01 Nov 2023 18:29:22 GMT by Khanal, Om
I have a code for recording single waveform from two channels within 50 ns coincidence window in python. When I run the code, I can print instrument ID which tells my connection via USB interface is working but I am not able to record. I have an error related to timeout. Please see attached code and error below. The only thing I changed in the attached code is my instrument ID. I replaced exact address by XXXX. The error is as follows-

Instrument ID: TEKTRONIX,MSO64B,B028935,CF:91.1CT FV:2.0.3.950

Traceback (most recent call last):
  File "C:/Users/khanalob/Desktop/Python/oneacquisition.py", line 49, in <module>
    waveform1 = scope.query("WAVEFORM:DATA? CH1")
  File "C:\Users\khanalob\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyvisa\resources\messagebased.py", line 648, in query
    return self.read()
  File "C:\Users\khanalob\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyvisa\resources\messagebased.py", line 486, in read
    message = self._read_raw().decode(enco)
  File "C:\Users\khanalob\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyvisa\resources\messagebased.py", line 442, in _read_raw
    chunk, status = self.visalib.read(self.session, size)
  File "C:\Users\khanalob\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyvisa\ctwrapper\functions.py", line 2337, in read
    ret = library.viRead(session, buffer, count, byref(return_count))
  File "C:\Users\khanalob\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyvisa\ctwrapper\highlevel.py", line 226, in _return_handler
    return self.handle_return_value(session, ret_value)  # type: ignore
  File "C:\Users\khanalob\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyvisa\highlevel.py", line 251, in handle_return_value
    raise errors.VisaIOError(rv)
pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.

  Please explain me the error and way to fix it. For more understanding, I have attached the snapshot of waveform saved by using another code. Why the waveform recording has error while saving image code is working well to save image? My ultimate goal is to record 100 acquisitions data within the coincidence window. But I am not able to record single acquisition.

Thank You
Om
Posted Wed, 08 Nov 2023 00:56:28 GMT by Teles, Afonso
Hi Om,

waveform:data? is not the correct command, instead you should use the curve? command.

Also, ASCII format is really inefficient, I suggest you instead use a binary format and then use query_binary_values() to read and decode it.

You must be signed in to post in this forum.