pyvisa / pyvisa-py

A pure python PyVISA backend
https://pyvisa-py.readthedocs.io
MIT License
285 stars 122 forks source link

Not getting complete data with read_raw() #263

Open torquil opened 5 years ago

torquil commented 5 years ago

Hi! I'm using the development version of pyvisa and pyvisa-py together with a Siglent SDS1104X-E oscilloscope via USB on Debian Linux Unstable. I'm trying to retrieve the channel 1 waveform from the scope. When I used lxi-tools via ethernet this worked fine, but it caused my scope to freeze up quite often.

The command to request the waveform is:

oscilloscope.write('C1:WF? ALL')

which uses the SCPI command that worked fine with lxi-tools.

However, when I subsequently invoke read_raw(), I'm not getting the complete data. I only get around 60-70 bytes. By running read_raw() many times, I seem to get a sensible amount of data corresponding to the number of displayed points, but I'm not sure if the data is completely correct, because I'm having some trouble extracting variable values from the second or later segments.

When running many times manually, I have to manuall test each returned segment for the correct termination characters for the Siglent, which is b'\n\n'

So my question is: why is read_raw() stopping early, and what can I do to make it receive all the data?

The scope firmware is 8.1.6.1.26.

Best regards, Torquil Sørensen

MatthieuDartiailh commented 5 years ago

I am assuming you are trying to retrieve data that are transferred in binary format. If that is indeed the case I would suggest you to have a look at https://pyvisa.readthedocs.io/en/latest/introduction/rvalues.html The basic issue is that read_raw will break on any termchar it encounters (not sure that visa may not break in that particular case even on single \n), which means you need to know how many bytes to expect to know for how long to read. read_binary_values takes care of that for you for the most common format and can be used for inspiration if you have something different (but if that is the case please file an issue to add that format to pyvisa).

torquil commented 5 years ago

I am still convinced that something is wrong when retrieving data from the scope, whenever more than just a few characters are involved in the response, e.g. query('*IDN?') works fine. But perhaps it is best to focus on a simpler example to show the problem than the waveform retrieval. One SCPI-command that the scope supports is "TEMPLATE?". It will return a long text describing the format of the response to the "C1:WF? ALL" command. Using lxi-tools over ethernet I have no problems receiving the file.

I'm running the following line of code to work with the problem:

resources = visa.ResourceManager('@py')
oscilloscope = resources.open_resource(identifier, write_termination='\n', read_termination = '\n', query_delay=1.0)

print('\nSCPI command: TEMPLATE?')
template = oscilloscope.query('TEMPLATE?')
print('\ntemplate:\n', repr(template))
print('\nlen(template):', len(template))
print('\ntype(template):', type(template))

more1 = oscilloscope.read()
print('\nmore1:\n', repr(more1))
print('\nlen(nmore1):', len(more1))
print('\ntype(nmore1):', type(more1))

more2 = oscilloscope.read()
print('\nmore2:\n', repr(more2))
print('\nlen(nmore2):', len(more2))
print('\ntype(nmore2):', type(more2))

oscilloscope.close()
resources.close()

The "template" variable that is outputted is as follows:

'TMPL "\r\n/00\r\n\t000000 SDS1000X_E: TEMPL 8 66 111\r\n;\r\n; Explanation of the formats of waveforms and their descriptorsiglent Digital Oscilloscopes,\r\n; Software Release 5.1.3.8, 17/04/13.\r\n;\r\n; A descriptor and/or a waveform consists of one or sever'

This is truncated in the middle of a word when I compare with the correct output gotten from lxi-tools/ethernet. When I subsequently run read()-commands, I get more text, but unfortunately, some bytes are missing in between each segment, so I cannot even patch together all the data after multiple runs of read(). I have tried different read_termination values, but it doesn't make much of a difference.

The problem with running "TEMPLATE?" is similar to my problems when trying to get the waveform data through "C1: WF? ALL" as well as "C1: WF? DAT2" using binary methods. Also, the same problem occurs with the screendump function "SCDP".

An interesting thing is the warning from pyvisa that the read response does not end in the termination character. From the output from the program above:

/home/torquil/.local/lib/python3.7/site-packages/pyvisa/resources/messagebased.py:601: UserWarning: read string doesn't end with termination characters return self.read()

template: 'TMPL "\r\n/00\r\n\t000000 SDS1000X_E: TEMPL 8 66 111\r\n;\r\n; Explanation of the formats of waveforms and their descriptorsiglent Digital Oscilloscopes,\r\n; Software Release 5.1.3.8, 17/04/13.\r\n;\r\n; A descriptor and/or a waveform consists of one or sever'

The warning "read string doesn't end with termination characters" occurs after each of the invokations of read().

Anyway, I decidde to run with visa.log_to_screen(), and got a bunch of suspicious (to me at least!) messages containing: "UnknownAttribute: Unknown attribute 1073676344 (0x3fff0038 - VI_ATTR_TERMCHAR_EN)". Here is the debug log:

2019-08-20 20:25:55,043 - pyvisa - DEBUG - SerialSession was not imported No module named 'serial'.
2019-08-20 20:25:55,054 - pyvisa - DEBUG - USBSession and USBRawSession were correctly imported.
2019-08-20 20:25:55,056 - pyvisa - DEBUG - TCPIPSession was correctly imported.
2019-08-20 20:25:55,057 - pyvisa - DEBUG - GPIBSession was not imported No module named 'gpib_ctypes'.
2019-08-20 20:25:55,057 - pyvisa - DEBUG - Created library wrapper for unset
2019-08-20 20:25:55,057 - pyvisa - DEBUG - Created ResourceManager with session 4994085
2019-08-20 20:25:55,057 - pyvisa - DEBUG - USB0::62700::60984::SDSMMEBX3R2053::0::INSTR - opening ...
2019-08-20 20:25:55,449 - pyvisa - ERROR - Unknown attribute 1073676310 (0x3fff0016 - VI_ATTR_SEND_END_EN)
Traceback (most recent call last):
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/sessions.py", line 425, in set_attribute
    return self._set_attribute(attribute, attribute_state)
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/usb.py", line 173, in _set_attribute
    raise UnknownAttribute(attribute)
pyvisa-py.sessions.UnknownAttribute: Unknown attribute 1073676310 (0x3fff0016 - VI_ATTR_SEND_END_EN)
2019-08-20 20:25:55,451 - pyvisa - ERROR - Unknown attribute 1073676312 (0x3fff0018 - VI_ATTR_TERMCHAR)
Traceback (most recent call last):
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/sessions.py", line 425, in set_attribute
    return self._set_attribute(attribute, attribute_state)
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/usb.py", line 173, in _set_attribute
    raise UnknownAttribute(attribute)
pyvisa-py.sessions.UnknownAttribute: Unknown attribute 1073676312 (0x3fff0018 - VI_ATTR_TERMCHAR)
2019-08-20 20:25:55,451 - pyvisa - ERROR - Unknown attribute 1073676344 (0x3fff0038 - VI_ATTR_TERMCHAR_EN)
Traceback (most recent call last):
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/sessions.py", line 425, in set_attribute
    return self._set_attribute(attribute, attribute_state)
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/usb.py", line 173, in _set_attribute
    raise UnknownAttribute(attribute)
pyvisa-py.sessions.UnknownAttribute: Unknown attribute 1073676344 (0x3fff0038 - VI_ATTR_TERMCHAR_EN)
2019-08-20 20:25:55,452 - pyvisa - DEBUG - USB0::62700::60984::SDSMMEBX3R2053::0::INSTR - is open with session 9344971
2019-08-20 20:25:55,452 - pyvisa - ERROR - Unknown attribute 1073676312 (0x3fff0018 - VI_ATTR_TERMCHAR)
Traceback (most recent call last):
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/sessions.py", line 425, in set_attribute
    return self._set_attribute(attribute, attribute_state)
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/usb.py", line 173, in _set_attribute
    raise UnknownAttribute(attribute)
pyvisa-py.sessions.UnknownAttribute: Unknown attribute 1073676312 (0x3fff0018 - VI_ATTR_TERMCHAR)
2019-08-20 20:25:55,453 - pyvisa - ERROR - Unknown attribute 1073676344 (0x3fff0038 - VI_ATTR_TERMCHAR_EN)
Traceback (most recent call last):
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/sessions.py", line 425, in set_attribute
    return self._set_attribute(attribute, attribute_state)
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/usb.py", line 173, in _set_attribute
    raise UnknownAttribute(attribute)
pyvisa-py.sessions.UnknownAttribute: Unknown attribute 1073676344 (0x3fff0038 - VI_ATTR_TERMCHAR_EN)
2019-08-20 20:25:55,453 - pyvisa - ERROR - Unknown attribute 1073676310 (0x3fff0016 - VI_ATTR_SEND_END_EN)
Traceback (most recent call last):
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/sessions.py", line 377, in get_attribute
    return self._get_attribute(attribute)
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/usb.py", line 160, in _get_attribute
    raise UnknownAttribute(attribute)
pyvisa-py.sessions.UnknownAttribute: Unknown attribute 1073676310 (0x3fff0016 - VI_ATTR_SEND_END_EN)
2019-08-20 20:25:56,456 - pyvisa - DEBUG - USB0::62700::60984::SDSMMEBX3R2053::0::INSTR - reading 20480 bytes (last status <StatusCode.success_max_count_read: 1073676294>)
2019-08-20 20:25:56,456 - pyvisa - ERROR - Unknown attribute 1073676312 (0x3fff0018 - VI_ATTR_TERMCHAR)
Traceback (most recent call last):
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/sessions.py", line 377, in get_attribute
    return self._get_attribute(attribute)
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/usb.py", line 160, in _get_attribute
    raise UnknownAttribute(attribute)
pyvisa-py.sessions.UnknownAttribute: Unknown attribute 1073676312 (0x3fff0018 - VI_ATTR_TERMCHAR)
2019-08-20 20:25:56,456 - pyvisa - ERROR - Unknown attribute 1073676344 (0x3fff0038 - VI_ATTR_TERMCHAR_EN)
Traceback (most recent call last):
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/sessions.py", line 377, in get_attribute
    return self._get_attribute(attribute)
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/usb.py", line 160, in _get_attribute
    raise UnknownAttribute(attribute)
pyvisa-py.sessions.UnknownAttribute: Unknown attribute 1073676344 (0x3fff0038 - VI_ATTR_TERMCHAR_EN)
/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/protocols/usbtmc.py:119: UserWarning: Unexpected MsgID format. Consider updating the device's firmware. See https://github.com/pyvisa/pyvisa-py/issues/20
  warnings.warn('Unexpected MsgID format. Consider updating the device\'s firmware. See https://github.com/pyvisa/pyvisa-py/issues/20')
/home/torquil/.local/lib/python3.7/site-packages/pyvisa/resources/messagebased.py:601: UserWarning: read string doesn't end with termination characters
  return self.read()
2019-08-20 20:25:56,462 - pyvisa - DEBUG - USB0::62700::60984::SDSMMEBX3R2053::0::INSTR - reading 20480 bytes (last status <StatusCode.success_max_count_read: 1073676294>)
2019-08-20 20:25:56,462 - pyvisa - ERROR - Unknown attribute 1073676312 (0x3fff0018 - VI_ATTR_TERMCHAR)
Traceback (most recent call last):
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/sessions.py", line 377, in get_attribute
    return self._get_attribute(attribute)
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/usb.py", line 160, in _get_attribute
    raise UnknownAttribute(attribute)
pyvisa-py.sessions.UnknownAttribute: Unknown attribute 1073676312 (0x3fff0018 - VI_ATTR_TERMCHAR)
2019-08-20 20:25:56,463 - pyvisa - ERROR - Unknown attribute 1073676344 (0x3fff0038 - VI_ATTR_TERMCHAR_EN)
Traceback (most recent call last):
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/sessions.py", line 377, in get_attribute
    return self._get_attribute(attribute)
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/usb.py", line 160, in _get_attribute
    raise UnknownAttribute(attribute)
pyvisa-py.sessions.UnknownAttribute: Unknown attribute 1073676344 (0x3fff0038 - VI_ATTR_TERMCHAR_EN)
./get_trace_usb_template.py:18: UserWarning: read string doesn't end with termination characters
  more1 = oscilloscope.read()
2019-08-20 20:25:56,466 - pyvisa - DEBUG - USB0::62700::60984::SDSMMEBX3R2053::0::INSTR - reading 20480 bytes (last status <StatusCode.success_max_count_read: 1073676294>)
2019-08-20 20:25:56,467 - pyvisa - ERROR - Unknown attribute 1073676312 (0x3fff0018 - VI_ATTR_TERMCHAR)
Traceback (most recent call last):
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/sessions.py", line 377, in get_attribute
    return self._get_attribute(attribute)
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/usb.py", line 160, in _get_attribute
    raise UnknownAttribute(attribute)
pyvisa-py.sessions.UnknownAttribute: Unknown attribute 1073676312 (0x3fff0018 - VI_ATTR_TERMCHAR)
2019-08-20 20:25:56,467 - pyvisa - ERROR - Unknown attribute 1073676344 (0x3fff0038 - VI_ATTR_TERMCHAR_EN)
Traceback (most recent call last):
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/sessions.py", line 377, in get_attribute
    return self._get_attribute(attribute)
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/usb.py", line 160, in _get_attribute
    raise UnknownAttribute(attribute)
pyvisa-py.sessions.UnknownAttribute: Unknown attribute 1073676344 (0x3fff0038 - VI_ATTR_TERMCHAR_EN)
./get_trace_usb_template.py:23: UserWarning: read string doesn't end with termination characters
  more2 = oscilloscope.read()
2019-08-20 20:25:56,473 - pyvisa - DEBUG - USB0::62700::60984::SDSMMEBX3R2053::0::INSTR - closing
2019-08-20 20:25:56,473 - pyvisa - DEBUG - USB0::62700::60984::SDSMMEBX3R2053::0::INSTR - is closed
2019-08-20 20:25:56,473 - pyvisa - DEBUG - Closing ResourceManager (session: 4994085)
2019-08-20 20:25:56,473 - pyvisa - DEBUG - USB0::62700::60984::SDSMMEBX3R2053::0::INSTR - closing

SCPI command: TEMPLATE?

template:
 'TMPL "\r\n/00\r\n\t000000              SDS1000X_E:  TEMPL             8 66 111\r\n;\r\n; Explanation of the formarms and their descriptors on the\r\n; siglent Digital s,\r\n;     Software Release 5.1.3.8, 17/04/13.\r\n;\r\n; A descriptor and/or a waveform consists of one or several logic'

len(template): 271

type(template): <class 'str'>

more1:
 's\r\n; whose formats are explained below.\r\n; Usually, eforms are read: at the minimum they consist of\r\n;  ic descriptor block WAVEDESC\r\n;       a data array be more complex waveforms, e.g. Extrema data or the rFourier\r\n; transform, may contain several data arrayWhen there are more blocks, they are in the followin\n;       the basic descriptor block WAVEDESC\r\n;       the history text descriptor block USERTEXT (may or may not be'

len(nmore1): 427

type(nmore1): <class 'str'>

more2:
 '      the time array block (for RIS and sequence acqly)\r\n;       data array block\r\n;       auxiliary or array block\r\n;\r\n; In the following explanation, ever a block is described by a\r\n; single line in the fore position>   <variable name>: <variable type> ; <co  where\r\n;\r\n;   <byte position> = position in bytes set) of the variable,\r\n;                     relativinning of the block.\r\n;\r\n;   <variable name> = name ble.\r\n;\r\n;   <variable type> = string        up to 1name\r\n;                                   terminated byte\r\n;                       byte        08-bit silue\r\n;                       word        16-bit signe\r\n;                       long        32-bit signed\n;                      float        32-bit IEEE flovalue\r\n;\t\t\t\t\t\t\t\t\t with the format shown below\r\n;                                   31  30 .. 23   22 ... 0   bit po'

len(nmore2): 843

type(nmore2): <class 'str'>
MatthieuDartiailh commented 5 years ago

I forgot you were using pyvisa-py on usb... Since you instrument supports LXI, I assume you could connect to it over TCPIP rather than USB, no ? If that is the case can you run the same test over ethernet (I trust pyvisa-py more over ethernet than TCPIP). I would just like to know where we are having the issue (inside pyvisa or inside the USB backend). I will try to have a look at the USB backend for the attribute error but I do not know it well so it may take some time.

torquil commented 5 years ago

Well, I'm having even more problems with the TEMPLATE? command when using TCPIP. Simple commands such as *IDN? and TDIV? work. But whenever I send TEMPLATE? strange things happen. It all seems undeterministic. With visa.log_to_screen(), the complete correct response from the TEMPLATE? command can be seen in the log, but an error occurs so that it is not stored in the assignment variable "template". Other times it never appears in the log.

Here is the script:

import visa
visa.log_to_screen()

identifier = 'TCPIP::10.0.0.2::INSTR'
resources = visa.ResourceManager('@py')
oscilloscope = resources.open_resource(identifier, write_termination='\n', read_termination='\n')

oscilloscope.query('*IDN?')
oscilloscope.query('TDIV?')
oscilloscope.query('TEMPLATE?')

oscilloscope.close()
resources.close()

Here is an example of the visa.log_to_screen() output where the correct response is buried in the log (and below it another example where it is not):

2019-08-20 23:11:00,131 - pyvisa - DEBUG - SerialSession was not imported No module named 'serial'.
2019-08-20 23:11:00,142 - pyvisa - DEBUG - USBSession and USBRawSession were correctly imported.
2019-08-20 23:11:00,144 - pyvisa - DEBUG - TCPIPSession was correctly imported.
2019-08-20 23:11:00,144 - pyvisa - DEBUG - GPIBSession was not imported No module named 'gpib_ctypes'.
2019-08-20 23:11:00,145 - pyvisa - DEBUG - Created library wrapper for unset
2019-08-20 23:11:00,145 - pyvisa - DEBUG - Created ResourceManager with session 9324734
2019-08-20 23:11:00,145 - pyvisa - DEBUG - TCPIP::10.0.0.2::INSTR - opening ...
2019-08-20 23:11:00,145 - pyvisa - DEBUG - RawTCPClient: connecting to socket at (10.0.0.2, 111)
2019-08-20 23:11:00,145 - pyvisa - DEBUG - Make call <PortMapperVersion.get_port: 3>, (395183, 1, 6, 0), <bound method PortMapperPacker.pack_mapping of <pyvisa-py.protocols.rpc.PortMapperPacker object at 0x7fcda598b850>>, <bound method Unpacker.unpack_uint of <pyvisa-py.protocols.rpc.PortMapperUnpacker object at 0x7fcda5927310>>
2019-08-20 23:11:00,146 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42008), raddr=('10.0.0.2', 111)>: b'\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x01\x86\xa0\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x06\x00\x00\x00\x00'
2019-08-20 23:11:00,146 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42008), raddr=('10.0.0.2', 111)>: bytearray(b'\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xbe')
2019-08-20 23:11:00,146 - pyvisa - DEBUG - RawTCPClient: closing socket
2019-08-20 23:11:00,146 - pyvisa - DEBUG - RawTCPClient: connecting to socket at (10.0.0.2, 958)
2019-08-20 23:11:00,147 - pyvisa - DEBUG - Make call 10, (353261987, 0, 10000, 'inst0'), <bound method Vxi11Packer.pack_create_link_parms of <pyvisa-py.protocols.vxi11.Vxi11Packer object at 0x7fcda59e5590>>, <bound method Vxi11Unpacker.unpack_create_link_resp of <pyvisa-py.protocols.vxi11.Vxi11Unpacker object at 0x7fcda5934f50>>
2019-08-20 23:11:00,147 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: b"\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x0eY\xa3\x00\x00\x00\x00\x00\x00'\x10\x00\x00\x00\x05inst0\x00\x00\x00"
2019-08-20 23:11:00,148 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: bytearray(b'\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00')
2019-08-20 23:11:00,148 - pyvisa - DEBUG - TCPIP::10.0.0.2::INSTR - is open with session 7731179
2019-08-20 23:11:00,148 - pyvisa - DEBUG - Make call 11, (0, 2000, 10000, 136, b'*IDN?\n'), <bound method Vxi11Packer.pack_device_write_parms of <pyvisa-py.protocols.vxi11.Vxi11Packer object at 0x7fcda59e5590>>, <bound method Vxi11Unpacker.unpack_device_write_resp of <pyvisa-py.protocols.vxi11.Vxi11Unpacker object at 0x7fcda5934f50>>
2019-08-20 23:11:00,148 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: b"\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\xd0\x00\x00'\x10\x00\x00\x00\x88\x00\x00\x00\x06*IDN?\n\x00\x00"
2019-08-20 23:11:00,149 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: bytearray(b'\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06')
2019-08-20 23:11:00,149 - pyvisa - DEBUG - TCPIP::10.0.0.2::INSTR - reading 20480 bytes (last status <StatusCode.success_max_count_read: 1073676294>)
2019-08-20 23:11:00,149 - pyvisa - DEBUG - Make call 12, (0, 20480, 2000, 10000, 128, 10), <bound method Vxi11Packer.pack_device_read_parms of <pyvisa-py.protocols.vxi11.Vxi11Packer object at 0x7fcda59e5590>>, <bound method Vxi11Unpacker.unpack_device_read_resp of <pyvisa-py.protocols.vxi11.Vxi11Unpacker object at 0x7fcda5934f50>>
2019-08-20 23:11:00,149 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: b"\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00P\x00\x00\x00\x07\xd0\x00\x00'\x10\x00\x00\x00\x80\x00\x00\x00\n"
2019-08-20 23:11:00,150 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: bytearray(b'\x00\x00\x00\x03\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00:Siglent Technologies,SDS1104X-E,SDSMMEBX3R2053,8.1.6.1.33\n\x00\x00')
2019-08-20 23:11:00,150 - pyvisa - DEBUG - Make call 11, (0, 2000, 10000, 136, b'TDIV?\n'), <bound method Vxi11Packer.pack_device_write_parms of <pyvisa-py.protocols.vxi11.Vxi11Packer object at 0x7fcda59e5590>>, <bound method Vxi11Unpacker.unpack_device_write_resp of <pyvisa-py.protocols.vxi11.Vxi11Unpacker object at 0x7fcda5934f50>>
2019-08-20 23:11:00,150 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: b"\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\xd0\x00\x00'\x10\x00\x00\x00\x88\x00\x00\x00\x06TDIV?\n\x00\x00"
2019-08-20 23:11:00,151 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: bytearray(b'\x00\x00\x00\x04\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06')
2019-08-20 23:11:00,151 - pyvisa - DEBUG - TCPIP::10.0.0.2::INSTR - reading 20480 bytes (last status <StatusCode.success_max_count_read: 1073676294>)
2019-08-20 23:11:00,151 - pyvisa - DEBUG - Make call 12, (0, 20480, 2000, 10000, 128, 10), <bound method Vxi11Packer.pack_device_read_parms of <pyvisa-py.protocols.vxi11.Vxi11Packer object at 0x7fcda59e5590>>, <bound method Vxi11Unpacker.unpack_device_read_resp of <pyvisa-py.protocols.vxi11.Vxi11Unpacker object at 0x7fcda5934f50>>
2019-08-20 23:11:00,151 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: b"\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00P\x00\x00\x00\x07\xd0\x00\x00'\x10\x00\x00\x00\x80\x00\x00\x00\n"
2019-08-20 23:11:00,152 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: bytearray(b'\x00\x00\x00\x05\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x0fTDIV 1.00E-09S\n\x00')
2019-08-20 23:11:00,152 - pyvisa - DEBUG - Make call 11, (0, 2000, 10000, 136, b'TEMPLATE?\n'), <bound method Vxi11Packer.pack_device_write_parms of <pyvisa-py.protocols.vxi11.Vxi11Packer object at 0x7fcda59e5590>>, <bound method Vxi11Unpacker.unpack_device_write_resp of <pyvisa-py.protocols.vxi11.Vxi11Unpacker object at 0x7fcda5934f50>>
2019-08-20 23:11:00,152 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: b"\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\xd0\x00\x00'\x10\x00\x00\x00\x88\x00\x00\x00\nTEMPLATE?\n\x00\x00"
2019-08-20 23:11:00,153 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: bytearray(b'\x00\x00\x00\x06\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n')
2019-08-20 23:11:00,153 - pyvisa - DEBUG - TCPIP::10.0.0.2::INSTR - reading 20480 bytes (last status <StatusCode.success_max_count_read: 1073676294>)
2019-08-20 23:11:00,153 - pyvisa - DEBUG - Make call 12, (0, 20480, 2000, 10000, 128, 10), <bound method Vxi11Packer.pack_device_read_parms of <pyvisa-py.protocols.vxi11.Vxi11Packer object at 0x7fcda59e5590>>, <bound method Vxi11Unpacker.unpack_device_read_resp of <pyvisa-py.protocols.vxi11.Vxi11Unpacker object at 0x7fcda5934f50>>
2019-08-20 23:11:00,153 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: b"\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00P\x00\x00\x00\x07\xd0\x00\x00'\x10\x00\x00\x00\x80\x00\x00\x00\n"
2019-08-20 23:11:00,203 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: bytearray(b'\x00\x00\x00\x07\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00R\x15TMPL "\r\n/00\r\n\t000000              SDS1000X_E:  TEMPLATE\r\n                    8 66 111\r\n;\r\n; Explanation of the formats of waveforms and their descriptors on the\r\n; siglent Digital Oscilloscopes,\r\n;     Software Release 5.1.3.8, 17/04/13.\r\n;\r\n; A descriptor and/or a waveform consists of one or several logical data blocks\r\n; whose formats are explained below.\r\n; Usually, complete waveforms are read: at the minimum they consist of\r\n;       the basic descriptor block WAVEDESC\r\n;       a data array block.\r\n; Some more complex waveforms, e.g. Extrema data or the results of a Fourier\r\n; transform, may contain several data array blocks.\r\n; When there are more blocks, they are in the following sequence:\r\n;       the basic descriptor block WAVEDESC\r\n;       the history text descriptor block USERTEXT (may or may not be present)\r\n;       the time array block (for RIS and sequence acquisitions only)\r\n;       data array block\r\n;       auxiliary or second data array block\r\n;\r\n; In the following explanation, every element of a block is described by a\r\n; single line in the form\r\n;\r\n; <byte position>   <variable name>: <variable type> ; <comment>\r\n;\r\n;  where\r\n;\r\n;   <byte position> = position in bytes (decimal offset) of the variable,\r\n;                     relative to the beginning of the block.\r\n;\r\n;   <variable name> = name of the variable.\r\n;\r\n;   <variable type> = string        up to 16-character name\r\n;                                   terminated with a null byte\r\n;                       byte        08-bit signed data value\r\n;                       word        16-bit signed data value\r\n;                       long        32-bit signed data value\r\n;                      float        32-bit IEEE floating point value\r\n;\t\t\t\t\t\t\t\t\t with the format shown below\r\n;                                   31  30 .. 23   22 ... 0   bit position\r\n;                                   s   exponent   fraction\r\n;                                   where\r\n;                                   s = sign of the fraction\r\n;                                   exponent = 8 bit exponent e\r\n;                                   fraction = 23 bit fraction f\r\n;                                   and the final value is\r\n;                                   (-1)**s * 2**(e-127) * 1.f\r\n;                     double        64-bit IEEE floating point value\r\n;                                   with the format shown below\r\n;                                   63  62 .. 52   51 ... 0   bit position\r\n;                                   s   exponent   fraction\r\n;                                   where\r\n;                                   s = sign of the fraction\r\n;                                   exponent = 11 bit exponent e\r\n;                                   fraction = 52 bit fraction f\r\n;                                   and the final value is\r\n;                                   (-1)**s * 2**(e-1023) * 1.f\r\n;                       enum        enumerated value in the range 0 to N\r\n;                                   represented as a 16-bit data value.\r\n;                                   The list of values follows immediately.\r\n;                                   The integer is preceded by an _.\r\n;                 time_stamp        double precision floating point number,\r\n;                                   for the number of seconds and some bytes\r\n;                                   for minutes, hours, days, months and year.\r\n;\r\n;                                   double  seconds     (0 to 59)\r\n;                                   byte    minutes     (0 to 59)\r\n;                                   byte    hours       (0 to 23)\r\n;                                   byte    days        (1 to 31)\r\n;                                   byte    months      (1 to 12)\r\n;                                   word    year        (0 to 16000)\r\n;                                   word    unused\r\n;                                   There are 16 bytes in a time field.\r\n;                       data        byte, word or float, depending on the\r\n;                                   read-out mode reflected by the WAVEDESC\r\n;                                   variable COMM_TYPE, modifiable via the\r\n;                                   remote command COMM_FORMAT.\r\n;                       text        arbitrary length text string\r\n;                                   (maximum 160)\r\n;            unit_definition        a unit definition consists of a 48 character\r\n;                                   ASCII string terminated with a null byte\r\n;                                   for the unit name.\r\n;\r\n;==========================================================================\r\n;\r\nWAVEDESC: BLOCK\r\n;\r\n; Explanation of the wave descriptor block WAVEDESC;\r\n;\r\n;\r\n<  0>          DESCRIPTOR_NAME: string  ; the first 8 chars are always WAVEDESC\r\n;\r\n< 16>          TEMPLATE_NAME: string    \r\n;\r\n< 32>          COMM_TYPE: enum          ; chosen by remote command COMM_FORMAT\r\n               _0      byte             \r\n               _1      word         \r\n               endenum                  \r\n;\r\n< 34>          COMM_ORDER: enum\r\n               _0      HIFIRST          \r\n               _1      LOFIRST          \r\n               endenum                  \r\n;\r\n;\r\n; The following variables of this basic wave descriptor block specify \r\n; the block lengths of all blocks of which the entire waveform (as it is \r\n; currently being read) is composed. If a block length is zero, this \r\n; block is (currently) not present. \r\n; \r\n; Blocks and arrays that are present will be found in the same order \r\n; as their descriptions below. \r\n; \r\n;BLOCKS : \r\n; \r\n< 36>          WAVE_DESCRIPTOR: long    ; length in bytes of block WAVEDESC \r\n< 40>          USER_TEXT: long          ; length in bytes of block USERTEXT \r\n< 44>          RES_DESC1: long          ; \r\n; \r\n;ARRAYS : \r\n; \r\n< 48>          TRIGTIME_ARRAY: long     ; length in bytes of TRIGTIME array \r\n; \r\n< 52>          RIS_TIME_ARRAY: long     ; length in bytes of RIS_TIME array \r\n; \r\n< 56>          RES_ARRAY1: long         ; an expansion entry is reserved \r\n; \r\n< 60>          WAVE_ARRAY_1: long       ; length in bytes of 1st simple \r\n                                        ; data array. In transmitted waveform, \r\n                                        ; represent the number of transmitted \r\n                                        ; bytes in accordance with the NP \r\n                                        ; parameter of the WFSU remote command \r\n                                        ; and the used format (see COMM_TYPE). \r\n; \r\n< 64>          WAVE_ARRAY_2: long       ; length in bytes of 2nd simple \r\n                                        ; data array \r\n; \r\n< 68>          RES_ARRAY2: long          \r\n< 72>          RES_ARRAY3: long         ; 2 expansion entries are reserved \r\n; \r\n; The following variables identify the instrument \r\n; \r\n< 76>          INSTRUMENT_NAME: string   \r\n; \r\n< 92>          INSTRUMENT_NUMBER: long   \r\n; \r\n< 96>          TRACE_LABEL: string      ; identifies the waveform. \r\n; \r\n<112>          RESERVED1: word           \r\n<114>          RESERVED2: word          ; 2 expansion entries \r\n; \r\n; The following variables describe the waveform and the time at \r\n; which the waveform was generated. \r\n; \r\n<116>          WAVE_ARRAY_COUNT: long   ; number of data points in the data \r\n                                        ; array. If there are two data \r\n                                        ; arrays (FFT or Extrema), this number \r\n                                        ; applies to each array separately. \r\n; \r\n<120>          PNTS_PER_SCREEN: long    ; nominal number of data points \r\n                                        ; on the screen \r\n; \r\n<124>          FIRST_VALID_PNT: long    ; count of number of points to skip \r\n                                        ; before first good point \r\n                                        ; FIRST_VALID_POINT = 0 \r\n                                        ; for normal waveforms. \r\n; \r\n<128>          LAST_VALID_PNT: long     ; index of last good data point\r\n                                        ; in record before padding (blanking)\r\n                                        ; was started.\r\n                                        ; LAST_VALID_POINT = WAVE_ARRAY_COUNT-1\r\n                                        ; except for aborted sequence\r\n                                        ; and rollmode acquisitions\r\n;\r\n<132>          FIRST_POINT: long        ; for input and output, indicates\r\n                                        ; the offset relative to the\r\n                                        ; beginning of the trace buffer.\r\n                                        ; Value is the same as the FP parameter\r\n                                        ; of the WFSU remote command.\r\n;\r\n<136>          SPARSING_FACTOR: long    ; for input and output, indicates\r\n                                        ; the sparsing into the transmitted\r\n                                        ; data block.\r\n                                        ; Value is the same as the SP parameter\r\n                                        ; of the WFSU remote command.\r\n;\r\n<140>          SEGMENT_INDEX: long      ; for input and output, indicates the\r\n                                        ; index of the transmitted segment.\r\n                                        ; Value is the same as the SN parameter\r\n                                        ; of the WFSU remote command.\r\n;\r\n<144>          SUBARRAY_COUNT: long     ; for Sequence, acquired segment count,\r\n                                        ; between 0 and NOM_SUBARRAY_COUNT\r\n;\r\n<148>          SWEEPS_PER_ACQ: long     ; for Average or Extrema,\r\n                                        ; number of sweeps accumulated\r\n                                        ; else 1\r\n;\r\n<152>          POINTS_PER_PAIR: word    ; for Peak Dectect waveforms (which always\r\n                                        ; include data points in DATA_ARRAY_1 and\r\n                                       ; min/max pairs in DATA_ARRAY_2).\r\n                                        ; Value is the number of data points for\r\n                                        ; each min/max pair.\r\n;\r\n<154>          PAIR_OFFSET: word        ; for Peak Dectect waveforms only\r\n                                        ; Value is the number of data points by\r\n                                        ; which the first min/max pair in\r\n                                        ; DATA_ARRAY_2 is offset relative to the\r\n                                        ; first data value in DATA_ARRAY_1.\r\n;\r\n<156>          VERTICAL_GAIN: float     \r\n;\r\n<160>          VERTICAL_OFFSET: float   ; to get floating values from raw data :\r\n                                        ; VERTICAL_GAIN * data - VERTICAL_OFFSET\r\n;\r\n<164>          MAX_VALUE: float         ; maximum allowed value. It corresponds\r\n                                         ; to the upper edge of the grid.\r\n;\r\n<168>          MIN_VALUE: float         ; minimum allowed value. It corresponds\r\n                                         ; to the lower edge of the grid.\r\n;\r\n<172>          NOMINAL_BITS: word       ; a measure of the intrinsic precision\r\n                                         ; of the observation: ADC data is 8 bit\r\n                                         ;    averaged data is 10-12 bit, etc.\r\n;\r\n<174>          NOM_SUBARRAY_COUNT: word ; for Sequence, nominal segment count\r\n                                         ; else 1\r\n;\r\n<176>          HORIZ_INTERVAL: float    ; sampling interval for time domain\r\n                                         ;  waveforms\r\n;\r\n<180>          HORIZ_OFFSET: double     ; trigger offset for the first sweep of\r\n                                         ; the trigger, seconds between the\r\n                                         ; trigger and the first data point\r\n;\r\n<188>          PIXEL_OFFSET: double     ; needed to know how to display the\r\n                                         ; waveform\r\n;\r\n<196>          VERTUNIT: unit_definition  ; units of the vertical axis\r\n;\r\n<244>          HORUNIT: unit_definition   ; units of the horizontal axis\r\n;\r\n<292>          HORIZ_UNCERTAINTY: float ; uncertainty from one acquisition to the\r\n                                        ; next, of the horizontal offset in seconds\r\n;\r\n<296>          TRIGGER_TIME: time_stamp ; time of the trigger\r\n;\r\n<312>          ACQ_DURATION: float      ; duration of the acquisition (in sec)\r\n                                         ; in multi-trigger waveforms.\r\n                                         ; (e.g. sequence, RIS,  or averaging)\r\n;\r\n<316>          RECORD_TYPE: enum        \r\n                _0      single_sweep     \r\n                _1      interleaved      \r\n                _2      histogram        \r\n                _3      graph            \r\n                _4      filter_coefficient\r\n                _5      complex          \r\n                _6      extrema          \r\n                _7      sequence_obsolete\r\n                _8      centered_RIS     \r\n                _9      peak_detect      \r\n                endenum                  \r\n;\r\n<318>          PROCESSING_DONE: enum   \r\n                _0       no_processing   \r\n                _1       fir_filter      \r\n                _2       interpolated    \r\n                _3       sparsed         \r\n                _4       autoscaled      \r\n                _5       no_result       \r\n                _6       rolling         \r\n                _7       cumulative      \r\n                endenum                  \r\n;\r\n<320>          RESERVED5: word          ; expansion entry\r\n;\r\n<322>          RIS_SWEEPS: word         ; for RIS, the number of sweeps\r\n                                         ; else 1\r\n;\r\n; The following variables describe the basic acquisition\r\n; conditions used when the waveform was acquired\r\n;\r\n<324>          TIMEBASE: enum           \r\n               _0       200_ps/div  \r\n               _1       500_ps/div  \r\n               _2       1_ns/div  \r\n               _3       2_ns/div  \r\n               _4       5_ns/div  \r\n               _5       10_ns/div  \r\n               _6       20_ns/div  \r\n               _7       50_ns/div  \r\n               _8       100_ns/div  \r\n               _9       200_ns/div  \r\n               _10      500_ns/div  \r\n               _11      1_us/div  \r\n               _12      2_us/div  \r\n               _13      5_us/div  \r\n               _14      10_us/div  \r\n               _15      20_us/div  \r\n               _16      50_us/div  \r\n               _17      100_us/div  \r\n               _18      200_us/div  \r\n               _10      500_us/div  \r\n               _20      1_ms/div  \r\n               _21      2_ms/div  \r\n               _22      5_ms/div  \r\n               _23      10_ms/div  \r\n               _24      20_ms/div  \r\n               _25      50_ms/div  \r\n               _26      100_ms/div  \r\n               _27      200_ms/div  \r\n               _28      500_ms/div  \r\n               _29      1_s/div  \r\n               _30      2_s/div  \r\n               _31      5_s/div  \r\n               _32      10_s/div  \r\n               _33      20_s/div  \r\n               _34      50_s/div  \r\n               _35      100_s/div  \r\n               _100     EXTERNAL  \r\n               endenum                 \r\n;\r\n<326>          VERT_COUPLING: enum   \r\n               _0      DC      \r\n               _1      AC      \r\n               _2      GND      \r\n               endenum              \r\n;\r\n<328>          PROBE_ATT: float         \r\n;\r\n<332>          FIXED_VERT_GAIN: enum    \r\n               _0       500_uV/div     \r\n               _1       1_mV/div     \r\n               _2       2_mV/div     \r\n               _3       5_mV/div     \r\n               _4       10_mV/div   \r\n               _5       20_mV/div    \r\n               _6       50_mV/div   \r\n               _7       100_mV/div \r\n               _8       200_mV/div  \r\n               _9       500_mV/div  \r\n               _10       1_V/div  \r\n               _11       2_V/div \r\n               _12      5_V/div      \r\n               _13      10_V/div     \r\n               endenum            \r\n;\r\n<334>          BANDWIDTH_LIMIT: enum \r\n               _0      off              \r\n               _1      20M               \r\n               _2      200M               \r\n               endenum            \r\n;\r\n<336>          VERTICAL_VERNIER: float  \r\n;\r\n<340>          ACQ_VERT_OFFSET: float   \r\n;\r\n<344>          WAVE_SOURCE: enum       \r\n               _0      CHANNEL_1        \r\n               _1      CHANNEL_2        \r\n               _2      CHANNEL_3        \r\n               _3      CHANNEL_4        \r\n               _9      UNKNOWN        \r\n               endenum                 \r\n;\r\n/00              ENDBLOCK\r\n;\r\n;========================================================================== \r\n; \r\nUSERTEXT: BLOCK \r\n; \r\n; Explanation of the descriptor block USERTEXT at most 160 bytes long. \r\n; \r\n; \r\n<  0>          TEXT: text               ; a list of ASCII characters \r\n; \r\n/00              ENDBLOCK \r\n; \r\n;========================================================================== \r\n; \r\nTRIGTIME: ARRAY \r\n; \r\n; Explanation of the trigger time array TRIGTIME. \r\n; This optional time array is only present with SEQNCE waveforms. \r\n; The following data block is repeated for each segment which makes up \r\n; the acquired sequence record. \r\n; \r\n<  0>          TRIGGER_TIME: double     ; for sequence acquisitions, \r\n                                        ; time in seconds from first \r\n                                        ; trigger to this one \r\n; \r\n<  8>          TRIGGER_OFFSET: double   ; the trigger offset is in seconds \r\n                                        ; from trigger to zeroth data point \r\n; \r\n/00              ENDARRAY \r\n; \r\n;========================================================================== \r\n; \r\nRISTIME: ARRAY \r\n; \r\n; Explanation of the random-interleaved-sampling (RIS) time array RISTIME. \r\n; This optional time array is only present with RIS waveforms. \r\n; This data block is repeated for each sweep which makes up the RIS record \r\n; \r\n<  0>          RIS_OFFSET: double       ; seconds from trigger to zeroth \r\n                                        ; point of segment \r\n; \r\n/00              ENDARRAY \r\n; \r\n;========================================================================== \r\n; \r\nDATA_ARRAY_1: ARRAY \r\n; \r\n; Explanation of the data array DATA_ARRAY_1. \r\n; This main data array is always present. It is the only data array for \r\n; most waveforms. \r\n; The data item is repeated for each acquired or computed data point \r\n; of the first data array of any waveform. \r\n; \r\n<  0>          MEASUREMENT: data        ; the actual format of a data is \r\n                                        ; given in the WAVEDESC descriptor \r\n                                        ; by the COMM_TYPE variable. \r\n; \r\n/00              ENDARRAY \r\n; \r\n;========================================================================== \r\n; \r\nDATA_ARRAY_2: ARRAY \r\n; \r\n; Explanation of the data array DATA_ARRAY_2. \r\n; This is an optional secondary data array for special types of waveforms: \r\n;       Complex FFT     imaginary part      (real part in DATA_ARRAY_1) \r\n;       Extrema         floor trace         (roof trace in DATA_ARRAY_1) \r\n;       Peak Detect     min/max pairs       (data values in DATA_ARRAY_1) \r\n; In the first 2 cases, there is exactly one data item in DATA_ARRAY_2 for \r\n; each data item in DATA_ARRAY_1. \r\n; In Peak Detect waveforms, there may be fewer data values in DATA_ARRAY_2, \r\n; as described by the variable POINTS_PER_PAIR. \r\n; \r\n<  0>          MEASUREMENT: data        ; the actual format of a data is \r\n                                        ; given in the WAVEDESC descriptor \r\n                                        ; by the COMM_TYPE variable. \r\n; \r\n/00              ENDARRAY \r\n; \r\n;========================================================================== \r\n; \r\nSIMPLE: ARRAY \r\n; \r\n; Explanation of the data array SIMPLE. \r\n; This data array is identical to DATA_ARRAY_1. SIMPLE is an accepted \r\n; alias name for DATA_ARRAY_1. \r\n; \r\n<  0>          MEASUREMENT: data        ; the actual format of a data is \r\n                                        ; given in the WAVEDESC descriptor \r\n                                        ; by the COMM_TYPE variable. \r\n; \r\n/00              ENDARRAY \r\n; \r\n;========================================================================== \r\n; \r\nDUAL: ARRAY \r\n; \r\n; Explanation of the DUAL array. \r\n; This data array is identical to DATA_ARRAY_1, followed by DATA_ARRAY_2. \r\n; DUAL is an accepted alias name for the combined arrays DATA_ARRAY_1 and \r\n; DATA_ARRAY_2 (e.g. real and imaginary parts of an FFT). \r\n; \r\n<  0>          MEASUREMENT_1: data      ; data in DATA_ARRAY_1. \r\n; \r\n<  0>          MEASUREMENT_2: data      ; data in DATA_ARRAY_2. \r\n; \r\n/00              ENDARRAY \r\n; \r\n; \r\n000000               ENDTEMPLATE\r\n"\r\n\n\x00\x00\x00')
2019-08-20 23:11:00,203 - pyvisa - DEBUG - TCPIP::10.0.0.2::INSTR - reading 20480 bytes (last status <StatusCode.success_max_count_read: 1073676294>)
2019-08-20 23:11:00,203 - pyvisa - DEBUG - Make call 12, (0, 20480, 2000, 10000, 128, 10), <bound method Vxi11Packer.pack_device_read_parms of <pyvisa-py.protocols.vxi11.Vxi11Packer object at 0x7fcda59e5590>>, <bound method Vxi11Unpacker.unpack_device_read_resp of <pyvisa-py.protocols.vxi11.Vxi11Unpacker object at 0x7fcda5934f50>>
2019-08-20 23:11:00,203 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: b"\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00P\x00\x00\x00\x07\xd0\x00\x00'\x10\x00\x00\x00\x80\x00\x00\x00\n"
2019-08-20 23:11:02,205 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: bytearray(b'\x00\x00\x00\x08\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x00\x00\x00\x04\x00\x00\x00\x00')
2019-08-20 23:11:02,206 - pyvisa - DEBUG - TCPIP::10.0.0.2::INSTR - exception while reading: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.
Buffer content: bytearray(b'TMPL "\r\n/00\r\n\t000000              SDS1000X_E:  TEMPLATE\r\n                    8 66 111\r\n;\r\n; Explanation of the formats of waveforms and their descriptors on the\r\n; siglent Digital Oscilloscopes,\r\n;     Software Release 5.1.3.8, 17/04/13.\r\n;\r\n; A descriptor and/or a waveform consists of one or several logical data blocks\r\n; whose formats are explained below.\r\n; Usually, complete waveforms are read: at the minimum they consist of\r\n;       the basic descriptor block WAVEDESC\r\n;       a data array block.\r\n; Some more complex waveforms, e.g. Extrema data or the results of a Fourier\r\n; transform, may contain several data array blocks.\r\n; When there are more blocks, they are in the following sequence:\r\n;       the basic descriptor block WAVEDESC\r\n;       the history text descriptor block USERTEXT (may or may not be present)\r\n;       the time array block (for RIS and sequence acquisitions only)\r\n;       data array block\r\n;       auxiliary or second data array block\r\n;\r\n; In the following explanation, every element of a block is described by a\r\n; single line in the form\r\n;\r\n; <byte position>   <variable name>: <variable type> ; <comment>\r\n;\r\n;  where\r\n;\r\n;   <byte position> = position in bytes (decimal offset) of the variable,\r\n;                     relative to the beginning of the block.\r\n;\r\n;   <variable name> = name of the variable.\r\n;\r\n;   <variable type> = string        up to 16-character name\r\n;                                   terminated with a null byte\r\n;                       byte        08-bit signed data value\r\n;                       word        16-bit signed data value\r\n;                       long        32-bit signed data value\r\n;                      float        32-bit IEEE floating point value\r\n;\t\t\t\t\t\t\t\t\t with the format shown below\r\n;                                   31  30 .. 23   22 ... 0   bit position\r\n;                                   s   exponent   fraction\r\n;                                   where\r\n;                                   s = sign of the fraction\r\n;                                   exponent = 8 bit exponent e\r\n;                                   fraction = 23 bit fraction f\r\n;                                   and the final value is\r\n;                                   (-1)**s * 2**(e-127) * 1.f\r\n;                     double        64-bit IEEE floating point value\r\n;                                   with the format shown below\r\n;                                   63  62 .. 52   51 ... 0   bit position\r\n;                                   s   exponent   fraction\r\n;                                   where\r\n;                                   s = sign of the fraction\r\n;                                   exponent = 11 bit exponent e\r\n;                                   fraction = 52 bit fraction f\r\n;                                   and the final value is\r\n;                                   (-1)**s * 2**(e-1023) * 1.f\r\n;                       enum        enumerated value in the range 0 to N\r\n;                                   represented as a 16-bit data value.\r\n;                                   The list of values follows immediately.\r\n;                                   The integer is preceded by an _.\r\n;                 time_stamp        double precision floating point number,\r\n;                                   for the number of seconds and some bytes\r\n;                                   for minutes, hours, days, months and year.\r\n;\r\n;                                   double  seconds     (0 to 59)\r\n;                                   byte    minutes     (0 to 59)\r\n;                                   byte    hours       (0 to 23)\r\n;                                   byte    days        (1 to 31)\r\n;                                   byte    months      (1 to 12)\r\n;                                   word    year        (0 to 16000)\r\n;                                   word    unused\r\n;                                   There are 16 bytes in a time field.\r\n;                       data        byte, word or float, depending on the\r\n;                                   read-out mode reflected by the WAVEDESC\r\n;                                   variable COMM_TYPE, modifiable via the\r\n;                                   remote command COMM_FORMAT.\r\n;                       text        arbitrary length text string\r\n;                                   (maximum 160)\r\n;            unit_definition        a unit definition consists of a 48 character\r\n;                                   ASCII string terminated with a null byte\r\n;                                   for the unit name.\r\n;\r\n;==========================================================================\r\n;\r\nWAVEDESC: BLOCK\r\n;\r\n; Explanation of the wave descriptor block WAVEDESC;\r\n;\r\n;\r\n<  0>          DESCRIPTOR_NAME: string  ; the first 8 chars are always WAVEDESC\r\n;\r\n< 16>          TEMPLATE_NAME: string    \r\n;\r\n< 32>          COMM_TYPE: enum          ; chosen by remote command COMM_FORMAT\r\n               _0      byte             \r\n               _1      word         \r\n               endenum                  \r\n;\r\n< 34>          COMM_ORDER: enum\r\n               _0      HIFIRST          \r\n               _1      LOFIRST          \r\n               endenum                  \r\n;\r\n;\r\n; The following variables of this basic wave descriptor block specify \r\n; the block lengths of all blocks of which the entire waveform (as it is \r\n; currently being read) is composed. If a block length is zero, this \r\n; block is (currently) not present. \r\n; \r\n; Blocks and arrays that are present will be found in the same order \r\n; as their descriptions below. \r\n; \r\n;BLOCKS : \r\n; \r\n< 36>          WAVE_DESCRIPTOR: long    ; length in bytes of block WAVEDESC \r\n< 40>          USER_TEXT: long          ; length in bytes of block USERTEXT \r\n< 44>          RES_DESC1: long          ; \r\n; \r\n;ARRAYS : \r\n; \r\n< 48>          TRIGTIME_ARRAY: long     ; length in bytes of TRIGTIME array \r\n; \r\n< 52>          RIS_TIME_ARRAY: long     ; length in bytes of RIS_TIME array \r\n; \r\n< 56>          RES_ARRAY1: long         ; an expansion entry is reserved \r\n; \r\n< 60>          WAVE_ARRAY_1: long       ; length in bytes of 1st simple \r\n                                        ; data array. In transmitted waveform, \r\n                                        ; represent the number of transmitted \r\n                                        ; bytes in accordance with the NP \r\n                                        ; parameter of the WFSU remote command \r\n                                        ; and the used format (see COMM_TYPE). \r\n; \r\n< 64>          WAVE_ARRAY_2: long       ; length in bytes of 2nd simple \r\n                                        ; data array \r\n; \r\n< 68>          RES_ARRAY2: long          \r\n< 72>          RES_ARRAY3: long         ; 2 expansion entries are reserved \r\n; \r\n; The following variables identify the instrument \r\n; \r\n< 76>          INSTRUMENT_NAME: string   \r\n; \r\n< 92>          INSTRUMENT_NUMBER: long   \r\n; \r\n< 96>          TRACE_LABEL: string      ; identifies the waveform. \r\n; \r\n<112>          RESERVED1: word           \r\n<114>          RESERVED2: word          ; 2 expansion entries \r\n; \r\n; The following variables describe the waveform and the time at \r\n; which the waveform was generated. \r\n; \r\n<116>          WAVE_ARRAY_COUNT: long   ; number of data points in the data \r\n                                        ; array. If there are two data \r\n                                        ; arrays (FFT or Extrema), this number \r\n                                        ; applies to each array separately. \r\n; \r\n<120>          PNTS_PER_SCREEN: long    ; nominal number of data points \r\n                                        ; on the screen \r\n; \r\n<124>          FIRST_VALID_PNT: long    ; count of number of points to skip \r\n                                        ; before first good point \r\n                                        ; FIRST_VALID_POINT = 0 \r\n                                        ; for normal waveforms. \r\n; \r\n<128>          LAST_VALID_PNT: long     ; index of last good data point\r\n                                        ; in record before padding (blanking)\r\n                                        ; was started.\r\n                                        ; LAST_VALID_POINT = WAVE_ARRAY_COUNT-1\r\n                                        ; except for aborted sequence\r\n                                        ; and rollmode acquisitions\r\n;\r\n<132>          FIRST_POINT: long        ; for input and output, indicates\r\n                                        ; the offset relative to the\r\n                                        ; beginning of the trace buffer.\r\n                                        ; Value is the same as the FP parameter\r\n                                        ; of the WFSU remote command.\r\n;\r\n<136>          SPARSING_FACTOR: long    ; for input and output, indicates\r\n                                        ; the sparsing into the transmitted\r\n                                        ; data block.\r\n                                        ; Value is the same as the SP parameter\r\n                                        ; of the WFSU remote command.\r\n;\r\n<140>          SEGMENT_INDEX: long      ; for input and output, indicates the\r\n                                        ; index of the transmitted segment.\r\n                                        ; Value is the same as the SN parameter\r\n                                        ; of the WFSU remote command.\r\n;\r\n<144>          SUBARRAY_COUNT: long     ; for Sequence, acquired segment count,\r\n                                        ; between 0 and NOM_SUBARRAY_COUNT\r\n;\r\n<148>          SWEEPS_PER_ACQ: long     ; for Average or Extrema,\r\n                                        ; number of sweeps accumulated\r\n                                        ; else 1\r\n;\r\n<152>          POINTS_PER_PAIR: word    ; for Peak Dectect waveforms (which always\r\n                                        ; include data points in DATA_ARRAY_1 and\r\n                                       ; min/max pairs in DATA_ARRAY_2).\r\n                                        ; Value is the number of data points for\r\n                                        ; each min/max pair.\r\n;\r\n<154>          PAIR_OFFSET: word        ; for Peak Dectect waveforms only\r\n                                        ; Value is the number of data points by\r\n                                        ; which the first min/max pair in\r\n                                        ; DATA_ARRAY_2 is offset relative to the\r\n                                        ; first data value in DATA_ARRAY_1.\r\n;\r\n<156>          VERTICAL_GAIN: float     \r\n;\r\n<160>          VERTICAL_OFFSET: float   ; to get floating values from raw data :\r\n                                        ; VERTICAL_GAIN * data - VERTICAL_OFFSET\r\n;\r\n<164>          MAX_VALUE: float         ; maximum allowed value. It corresponds\r\n                                         ; to the upper edge of the grid.\r\n;\r\n<168>          MIN_VALUE: float         ; minimum allowed value. It corresponds\r\n                                         ; to the lower edge of the grid.\r\n;\r\n<172>          NOMINAL_BITS: word       ; a measure of the intrinsic precision\r\n                                         ; of the observation: ADC data is 8 bit\r\n                                         ;    averaged data is 10-12 bit, etc.\r\n;\r\n<174>          NOM_SUBARRAY_COUNT: word ; for Sequence, nominal segment count\r\n                                         ; else 1\r\n;\r\n<176>          HORIZ_INTERVAL: float    ; sampling interval for time domain\r\n                                         ;  waveforms\r\n;\r\n<180>          HORIZ_OFFSET: double     ; trigger offset for the first sweep of\r\n                                         ; the trigger, seconds between the\r\n                                         ; trigger and the first data point\r\n;\r\n<188>          PIXEL_OFFSET: double     ; needed to know how to display the\r\n                                         ; waveform\r\n;\r\n<196>          VERTUNIT: unit_definition  ; units of the vertical axis\r\n;\r\n<244>          HORUNIT: unit_definition   ; units of the horizontal axis\r\n;\r\n<292>          HORIZ_UNCERTAINTY: float ; uncertainty from one acquisition to the\r\n                                        ; next, of the horizontal offset in seconds\r\n;\r\n<296>          TRIGGER_TIME: time_stamp ; time of the trigger\r\n;\r\n<312>          ACQ_DURATION: float      ; duration of the acquisition (in sec)\r\n                                         ; in multi-trigger waveforms.\r\n                                         ; (e.g. sequence, RIS,  or averaging)\r\n;\r\n<316>          RECORD_TYPE: enum        \r\n                _0      single_sweep     \r\n                _1      interleaved      \r\n                _2      histogram        \r\n                _3      graph            \r\n                _4      filter_coefficient\r\n                _5      complex          \r\n                _6      extrema          \r\n                _7      sequence_obsolete\r\n                _8      centered_RIS     \r\n                _9      peak_detect      \r\n                endenum                  \r\n;\r\n<318>          PROCESSING_DONE: enum   \r\n                _0       no_processing   \r\n                _1       fir_filter      \r\n                _2       interpolated    \r\n                _3       sparsed         \r\n                _4       autoscaled      \r\n                _5       no_result       \r\n                _6       rolling         \r\n                _7       cumulative      \r\n                endenum                  \r\n;\r\n<320>          RESERVED5: word          ; expansion entry\r\n;\r\n<322>          RIS_SWEEPS: word         ; for RIS, the number of sweeps\r\n                                         ; else 1\r\n;\r\n; The following variables describe the basic acquisition\r\n; conditions used when the waveform was acquired\r\n;\r\n<324>          TIMEBASE: enum           \r\n               _0       200_ps/div  \r\n               _1       500_ps/div  \r\n               _2       1_ns/div  \r\n               _3       2_ns/div  \r\n               _4       5_ns/div  \r\n               _5       10_ns/div  \r\n               _6       20_ns/div  \r\n               _7       50_ns/div  \r\n               _8       100_ns/div  \r\n               _9       200_ns/div  \r\n               _10      500_ns/div  \r\n               _11      1_us/div  \r\n               _12      2_us/div  \r\n               _13      5_us/div  \r\n               _14      10_us/div  \r\n               _15      20_us/div  \r\n               _16      50_us/div  \r\n               _17      100_us/div  \r\n               _18      200_us/div  \r\n               _10      500_us/div  \r\n               _20      1_ms/div  \r\n               _21      2_ms/div  \r\n               _22      5_ms/div  \r\n               _23      10_ms/div  \r\n               _24      20_ms/div  \r\n               _25      50_ms/div  \r\n               _26      100_ms/div  \r\n               _27      200_ms/div  \r\n               _28      500_ms/div  \r\n               _29      1_s/div  \r\n               _30      2_s/div  \r\n               _31      5_s/div  \r\n               _32      10_s/div  \r\n               _33      20_s/div  \r\n               _34      50_s/div  \r\n               _35      100_s/div  \r\n               _100     EXTERNAL  \r\n               endenum                 \r\n;\r\n<326>          VERT_COUPLING: enum   \r\n               _0      DC      \r\n               _1      AC      \r\n               _2      GND      \r\n               endenum              \r\n;\r\n<328>          PROBE_ATT: float         \r\n;\r\n<332>          FIXED_VERT_GAIN: enum    \r\n               _0       500_uV/div     \r\n               _1       1_mV/div     \r\n               _2       2_mV/div     \r\n               _3       5_mV/div     \r\n               _4       10_mV/div   \r\n               _5       20_mV/div    \r\n               _6       50_mV/div   \r\n               _7       100_mV/div \r\n               _8       200_mV/div  \r\n               _9       500_mV/div  \r\n               _10       1_V/div  \r\n               _11       2_V/div \r\n               _12      5_V/div      \r\n               _13      10_V/div     \r\n               endenum            \r\n;\r\n<334>          BANDWIDTH_LIMIT: enum \r\n               _0      off              \r\n               _1      20M               \r\n               _2      200M               \r\n               endenum            \r\n;\r\n<336>          VERTICAL_VERNIER: float  \r\n;\r\n<340>          ACQ_VERT_OFFSET: float   \r\n;\r\n<344>          WAVE_SOURCE: enum       \r\n               _0      CHANNEL_1        \r\n               _1      CHANNEL_2        \r\n               _2      CHANNEL_3        \r\n               _3      CHANNEL_4        \r\n               _9      UNKNOWN        \r\n               endenum                 \r\n;\r\n/00              ENDBLOCK\r\n;\r\n;========================================================================== \r\n; \r\nUSERTEXT: BLOCK \r\n; \r\n; Explanation of the descriptor block USERTEXT at most 160 bytes long. \r\n; \r\n; \r\n<  0>          TEXT: text               ; a list of ASCII characters \r\n; \r\n/00              ENDBLOCK \r\n; \r\n;========================================================================== \r\n; \r\nTRIGTIME: ARRAY \r\n; \r\n; Explanation of the trigger time array TRIGTIME. \r\n; This optional time array is only present with SEQNCE waveforms. \r\n; The following data block is repeated for each segment which makes up \r\n; the acquired sequence record. \r\n; \r\n<  0>          TRIGGER_TIME: double     ; for sequence acquisitions, \r\n                                        ; time in seconds from first \r\n                                        ; trigger to this one \r\n; \r\n<  8>          TRIGGER_OFFSET: double   ; the trigger offset is in seconds \r\n                                        ; from trigger to zeroth data point \r\n; \r\n/00              ENDARRAY \r\n; \r\n;========================================================================== \r\n; \r\nRISTIME: ARRAY \r\n; \r\n; Explanation of the random-interleaved-sampling (RIS) time array RISTIME. \r\n; This optional time array is only present with RIS waveforms. \r\n; This data block is repeated for each sweep which makes up the RIS record \r\n; \r\n<  0>          RIS_OFFSET: double       ; seconds from trigger to zeroth \r\n                                        ; point of segment \r\n; \r\n/00              ENDARRAY \r\n; \r\n;========================================================================== \r\n; \r\nDATA_ARRAY_1: ARRAY \r\n; \r\n; Explanation of the data array DATA_ARRAY_1. \r\n; This main data array is always present. It is the only data array for \r\n; most waveforms. \r\n; The data item is repeated for each acquired or computed data point \r\n; of the first data array of any waveform. \r\n; \r\n<  0>          MEASUREMENT: data        ; the actual format of a data is \r\n                                        ; given in the WAVEDESC descriptor \r\n                                        ; by the COMM_TYPE variable. \r\n; \r\n/00              ENDARRAY \r\n; \r\n;========================================================================== \r\n; \r\nDATA_ARRAY_2: ARRAY \r\n; \r\n; Explanation of the data array DATA_ARRAY_2. \r\n; This is an optional secondary data array for special types of waveforms: \r\n;       Complex FFT     imaginary part      (real part in DATA_ARRAY_1) \r\n;       Extrema         floor trace         (roof trace in DATA_ARRAY_1) \r\n;       Peak Detect     min/max pairs       (data values in DATA_ARRAY_1) \r\n; In the first 2 cases, there is exactly one data item in DATA_ARRAY_2 for \r\n; each data item in DATA_ARRAY_1. \r\n; In Peak Detect waveforms, there may be fewer data values in DATA_ARRAY_2, \r\n; as described by the variable POINTS_PER_PAIR. \r\n; \r\n<  0>          MEASUREMENT: data        ; the actual format of a data is \r\n                                        ; given in the WAVEDESC descriptor \r\n                                        ; by the COMM_TYPE variable. \r\n; \r\n/00              ENDARRAY \r\n; \r\n;========================================================================== \r\n; \r\nSIMPLE: ARRAY \r\n; \r\n; Explanation of the data array SIMPLE. \r\n; This data array is identical to DATA_ARRAY_1. SIMPLE is an accepted \r\n; alias name for DATA_ARRAY_1. \r\n; \r\n<  0>          MEASUREMENT: data        ; the actual format of a data is \r\n                                        ; given in the WAVEDESC descriptor \r\n                                        ; by the COMM_TYPE variable. \r\n; \r\n/00              ENDARRAY \r\n; \r\n;========================================================================== \r\n; \r\nDUAL: ARRAY \r\n; \r\n; Explanation of the DUAL array. \r\n; This data array is identical to DATA_ARRAY_1, followed by DATA_ARRAY_2. \r\n; DUAL is an accepted alias name for the combined arrays DATA_ARRAY_1 and \r\n; DATA_ARRAY_2 (e.g. real and imaginary parts of an FFT). \r\n; \r\n<  0>          MEASUREMENT_1: data      ; data in DATA_ARRAY_1. \r\n; \r\n<  0>          MEASUREMENT_2: data      ; data in DATA_ARRAY_2. \r\n; \r\n/00              ENDARRAY \r\n; \r\n; \r\n000000               ENDTEMPLATE\r\n"\r\n\n')
Traceback (most recent call last):
  File "./test_visa_eth.py", line 13, in <module>
    oscilloscope.query('TEMPLATE?')
  File "/home/torquil/.local/lib/python3.7/site-packages/pyvisa/resources/messagebased.py", line 601, in query
    return self.read()
  File "/home/torquil/.local/lib/python3.7/site-packages/pyvisa/resources/messagebased.py", line 414, in read
    message = self._read_raw().decode(enco)
  File "/home/torquil/.local/lib/python3.7/site-packages/pyvisa/resources/messagebased.py", line 387, in _read_raw
    chunk, status = self.visalib.read(self.session, size)
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/highlevel.py", line 334, in read
    raise errors.VisaIOError(ret[1])
pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.
2019-08-20 23:11:02,218 - pyvisa - DEBUG - TCPIP::10.0.0.2::INSTR - closing
2019-08-20 23:11:02,218 - pyvisa - DEBUG - Make call 23, 0, <bound method Vxi11Packer.pack_device_link of <pyvisa-py.protocols.vxi11.Vxi11Packer object at 0x7fcda59e5590>>, <bound method Vxi11Unpacker.unpack_device_error of <pyvisa-py.protocols.vxi11.Vxi11Unpacker object at 0x7fcda5934f50>>
2019-08-20 23:11:02,218 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: b'\x00\x00\x00\t\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
2019-08-20 23:11:02,219 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42228), raddr=('10.0.0.2', 958)>: bytearray(b'\x00\x00\x00\t\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2019-08-20 23:11:02,219 - pyvisa - DEBUG - RawTCPClient: closing socket
2019-08-20 23:11:02,219 - pyvisa - DEBUG - TCPIP::10.0.0.2::INSTR - is closed
2019-08-20 23:11:02,224 - pyvisa - DEBUG - Closing ResourceManager (session: 9324734)

Log from an example where the response is not contained in the log:

2019-08-20 23:11:45,790 - pyvisa - DEBUG - SerialSession was not imported No module named 'serial'.
2019-08-20 23:11:45,801 - pyvisa - DEBUG - USBSession and USBRawSession were correctly imported.
2019-08-20 23:11:45,803 - pyvisa - DEBUG - TCPIPSession was correctly imported.
2019-08-20 23:11:45,804 - pyvisa - DEBUG - GPIBSession was not imported No module named 'gpib_ctypes'.
2019-08-20 23:11:45,804 - pyvisa - DEBUG - Created library wrapper for unset
2019-08-20 23:11:45,804 - pyvisa - DEBUG - Created ResourceManager with session 3963646
2019-08-20 23:11:45,804 - pyvisa - DEBUG - TCPIP::10.0.0.2::INSTR - opening ...
2019-08-20 23:11:45,804 - pyvisa - DEBUG - RawTCPClient: connecting to socket at (10.0.0.2, 111)
2019-08-20 23:11:45,805 - pyvisa - DEBUG - Make call <PortMapperVersion.get_port: 3>, (395183, 1, 6, 0), <bound method PortMapperPacker.pack_mapping of <pyvisa-py.protocols.rpc.PortMapperPacker object at 0x7f2177e95910>>, <bound method Unpacker.unpack_uint of <pyvisa-py.protocols.rpc.PortMapperUnpacker object at 0x7f2177e95650>>
2019-08-20 23:11:45,805 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42012), raddr=('10.0.0.2', 111)>: b'\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x01\x86\xa0\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x06\x00\x00\x00\x00'
2019-08-20 23:11:45,805 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42012), raddr=('10.0.0.2', 111)>: bytearray(b'\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xbe')
2019-08-20 23:11:45,805 - pyvisa - DEBUG - RawTCPClient: closing socket
2019-08-20 23:11:45,805 - pyvisa - DEBUG - RawTCPClient: connecting to socket at (10.0.0.2, 958)
2019-08-20 23:11:45,806 - pyvisa - DEBUG - Make call 10, (128172287, 0, 10000, 'inst0'), <bound method Vxi11Packer.pack_create_link_parms of <pyvisa-py.protocols.vxi11.Vxi11Packer object at 0x7f2177f2d550>>, <bound method Vxi11Unpacker.unpack_create_link_resp of <pyvisa-py.protocols.vxi11.Vxi11Unpacker object at 0x7f2177e81050>>
2019-08-20 23:11:45,806 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42232), raddr=('10.0.0.2', 958)>: b"\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\xa3\xc0\xff\x00\x00\x00\x00\x00\x00'\x10\x00\x00\x00\x05inst0\x00\x00\x00"
2019-08-20 23:11:45,807 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42232), raddr=('10.0.0.2', 958)>: bytearray(b'\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00')
2019-08-20 23:11:45,807 - pyvisa - DEBUG - TCPIP::10.0.0.2::INSTR - is open with session 6695677
2019-08-20 23:11:45,807 - pyvisa - DEBUG - Make call 11, (0, 2000, 10000, 136, b'*IDN?\n'), <bound method Vxi11Packer.pack_device_write_parms of <pyvisa-py.protocols.vxi11.Vxi11Packer object at 0x7f2177f2d550>>, <bound method Vxi11Unpacker.unpack_device_write_resp of <pyvisa-py.protocols.vxi11.Vxi11Unpacker object at 0x7f2177e81050>>
2019-08-20 23:11:45,807 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42232), raddr=('10.0.0.2', 958)>: b"\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\xd0\x00\x00'\x10\x00\x00\x00\x88\x00\x00\x00\x06*IDN?\n\x00\x00"
2019-08-20 23:11:45,808 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42232), raddr=('10.0.0.2', 958)>: bytearray(b'\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06')
2019-08-20 23:11:45,808 - pyvisa - DEBUG - TCPIP::10.0.0.2::INSTR - reading 20480 bytes (last status <StatusCode.success_max_count_read: 1073676294>)
2019-08-20 23:11:45,808 - pyvisa - DEBUG - Make call 12, (0, 20480, 2000, 10000, 128, 10), <bound method Vxi11Packer.pack_device_read_parms of <pyvisa-py.protocols.vxi11.Vxi11Packer object at 0x7f2177f2d550>>, <bound method Vxi11Unpacker.unpack_device_read_resp of <pyvisa-py.protocols.vxi11.Vxi11Unpacker object at 0x7f2177e81050>>
2019-08-20 23:11:45,808 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42232), raddr=('10.0.0.2', 958)>: b"\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00P\x00\x00\x00\x07\xd0\x00\x00'\x10\x00\x00\x00\x80\x00\x00\x00\n"
2019-08-20 23:11:45,809 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42232), raddr=('10.0.0.2', 958)>: bytearray(b'\x00\x00\x00\x03\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00:Siglent Technologies,SDS1104X-E,SDSMMEBX3R2053,8.1.6.1.33\n\x00\x00')
2019-08-20 23:11:45,809 - pyvisa - DEBUG - Make call 11, (0, 2000, 10000, 136, b'TDIV?\n'), <bound method Vxi11Packer.pack_device_write_parms of <pyvisa-py.protocols.vxi11.Vxi11Packer object at 0x7f2177f2d550>>, <bound method Vxi11Unpacker.unpack_device_write_resp of <pyvisa-py.protocols.vxi11.Vxi11Unpacker object at 0x7f2177e81050>>
2019-08-20 23:11:45,809 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42232), raddr=('10.0.0.2', 958)>: b"\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\xd0\x00\x00'\x10\x00\x00\x00\x88\x00\x00\x00\x06TDIV?\n\x00\x00"
2019-08-20 23:11:45,809 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42232), raddr=('10.0.0.2', 958)>: bytearray(b'\x00\x00\x00\x04\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06')
2019-08-20 23:11:45,809 - pyvisa - DEBUG - TCPIP::10.0.0.2::INSTR - reading 20480 bytes (last status <StatusCode.success_max_count_read: 1073676294>)
2019-08-20 23:11:45,809 - pyvisa - DEBUG - Make call 12, (0, 20480, 2000, 10000, 128, 10), <bound method Vxi11Packer.pack_device_read_parms of <pyvisa-py.protocols.vxi11.Vxi11Packer object at 0x7f2177f2d550>>, <bound method Vxi11Unpacker.unpack_device_read_resp of <pyvisa-py.protocols.vxi11.Vxi11Unpacker object at 0x7f2177e81050>>
2019-08-20 23:11:45,809 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42232), raddr=('10.0.0.2', 958)>: b"\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00P\x00\x00\x00\x07\xd0\x00\x00'\x10\x00\x00\x00\x80\x00\x00\x00\n"
2019-08-20 23:11:45,810 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42232), raddr=('10.0.0.2', 958)>: bytearray(b'\x00\x00\x00\x05\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x0fTDIV 1.00E-09S\n\x00')
2019-08-20 23:11:45,810 - pyvisa - DEBUG - Make call 11, (0, 2000, 10000, 136, b'TEMPLATE?\n'), <bound method Vxi11Packer.pack_device_write_parms of <pyvisa-py.protocols.vxi11.Vxi11Packer object at 0x7f2177f2d550>>, <bound method Vxi11Unpacker.unpack_device_write_resp of <pyvisa-py.protocols.vxi11.Vxi11Unpacker object at 0x7f2177e81050>>
2019-08-20 23:11:45,810 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42232), raddr=('10.0.0.2', 958)>: b"\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\xd0\x00\x00'\x10\x00\x00\x00\x88\x00\x00\x00\nTEMPLATE?\n\x00\x00"
2019-08-20 23:11:45,811 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42232), raddr=('10.0.0.2', 958)>: bytearray(b'\x00\x00\x00\x06\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n')
2019-08-20 23:11:45,811 - pyvisa - DEBUG - TCPIP::10.0.0.2::INSTR - reading 20480 bytes (last status <StatusCode.success_max_count_read: 1073676294>)
2019-08-20 23:11:45,811 - pyvisa - DEBUG - Make call 12, (0, 20480, 2000, 10000, 128, 10), <bound method Vxi11Packer.pack_device_read_parms of <pyvisa-py.protocols.vxi11.Vxi11Packer object at 0x7f2177f2d550>>, <bound method Vxi11Unpacker.unpack_device_read_resp of <pyvisa-py.protocols.vxi11.Vxi11Unpacker object at 0x7f2177e81050>>
2019-08-20 23:11:45,811 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42232), raddr=('10.0.0.2', 958)>: b"\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00P\x00\x00\x00\x07\xd0\x00\x00'\x10\x00\x00\x00\x80\x00\x00\x00\n"
2019-08-20 23:11:48,818 - pyvisa - DEBUG - Time out encountered in <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42232), raddr=('10.0.0.2', 958)>.Already receieved 19980 bytes. Last fragment is 1076 bytes long and we were expecting 4
2019-08-20 23:11:48,819 - pyvisa - DEBUG - TCPIP::10.0.0.2::INSTR - exception while reading: VI_ERROR_IO (-1073807298): Could not perform operation because of I/O error.
Buffer content: bytearray(b'')
Traceback (most recent call last):
  File "./test_visa_eth.py", line 13, in <module>
    oscilloscope.query('TEMPLATE?')
  File "/home/torquil/.local/lib/python3.7/site-packages/pyvisa/resources/messagebased.py", line 601, in query
    return self.read()
  File "/home/torquil/.local/lib/python3.7/site-packages/pyvisa/resources/messagebased.py", line 414, in read
    message = self._read_raw().decode(enco)
  File "/home/torquil/.local/lib/python3.7/site-packages/pyvisa/resources/messagebased.py", line 387, in _read_raw
    chunk, status = self.visalib.read(self.session, size)
  File "/home/torquil/.local/lib/python3.7/site-packages/PyVISA_py-0.4.0.dev0-py3.7.egg/pyvisa-py/highlevel.py", line 334, in read
    raise errors.VisaIOError(ret[1])
pyvisa.errors.VisaIOError: VI_ERROR_IO (-1073807298): Could not perform operation because of I/O error.
2019-08-20 23:11:48,829 - pyvisa - DEBUG - TCPIP::10.0.0.2::INSTR - closing
2019-08-20 23:11:48,829 - pyvisa - DEBUG - Make call 23, 0, <bound method Vxi11Packer.pack_device_link of <pyvisa-py.protocols.vxi11.Vxi11Packer object at 0x7f2177f2d550>>, <bound method Vxi11Unpacker.unpack_device_error of <pyvisa-py.protocols.vxi11.Vxi11Unpacker object at 0x7f2177e81050>>
2019-08-20 23:11:48,830 - pyvisa - DEBUG - Sending record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42232), raddr=('10.0.0.2', 958)>: b'\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x07\xaf\x00\x00\x00\x01\x00\x00\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
2019-08-20 23:11:48,830 - pyvisa - DEBUG - Received record through <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('10.0.0.1', 42232), raddr=('10.0.0.2', 958)>: bytearray(b'\x00\x00\x00\x08\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2019-08-20 23:11:48,830 - pyvisa - DEBUG - RawTCPClient: closing socket
2019-08-20 23:11:48,831 - pyvisa - DEBUG - TCPIP::10.0.0.2::INSTR - is closed
2019-08-20 23:11:48,835 - pyvisa - DEBUG - Closing ResourceManager (session: 3963646)

The TEMPLATE? command works reliably when sent using lxi-tools over ethernet.

MatthieuDartiailh commented 5 years ago

That is quite weird. First since you define read_termination as \n the query should return a partial result like the USB one. So I need to understand why it is not so, but I may need some time. Second it looks like your instrument may be slow to start answering (basically you should never see a hard socket timeout).

Do you get in a more reliable manner the first case if you increase the timeout ?

MatthieuDartiailh commented 5 years ago

Also note that VISA defines the termination character as a single character and hence having a redundant character does not really make sense... I will try to have a look at your instrument manual.

MatthieuDartiailh commented 5 years ago

Do you have a programming manual ? The only manual I found does not have any remote command described ?

torquil commented 5 years ago

This is the one I have been looking at: https://tinyurl.com/y2f22vjz

It mentions on page 11 that it is applicable to the SDS1000X-E series of scopes, which includes my SDS1104X-E.

MatthieuDartiailh commented 5 years ago

Currently siglent website (access easier through your link or through google) appears to have some certificate issue. I will look at it more later.

MatthieuDartiailh commented 5 years ago

I looked at the documentation (that does not help that much). I need to look more at the issue you found in the TCPIP backend (easier to investigate than the USB one) but I am swamped in other stuff and that will take time.

bjaraujo commented 5 years ago

It seems the pyvisa is terminating in the middle of the response as the response has several termination characters.

TMPL "\r\n \r\n"\n

Maybe it should ignore the termination characters inside the quoted response?

sigurdsvela commented 2 years ago

Was this issue ever solved? I'm having the exact same issue (WF retrieval using pyvisa-py on my SDS1104)

MatthieuDartiailh commented 2 years ago

Could you open a new issue for this with all the details requested in the template ?

WillMatthews commented 2 years ago

As in @torquil 's original issue message, I also I tried using read_raw, but that itself had an issue where it halted prematurely (#318). I'm not sure if it's relevant here, but I will look at updating that issue in the next few days to see if that helps make progress.

MatthieuDartiailh commented 2 years ago

The USB issue is a pain but I do not have the bandwidth to look at it. Does reading one byte at a time using read_bytes helps ?

sigurdsvela commented 2 years ago

When trying read_bytes(1) the program just hung forever on the first call.

However, when using read_bytes(1) with TCP i get the entire message(Which seems weird).
read_raw still crashes though with error VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.

Worth noting that everything seems to be working perfectly with the vxi11 python package.

Details: Mac Pro M1, Python 3.9, pyvisa@1.12.0, pyvisa-py@0.5.3

MatthieuDartiailh commented 2 years ago

I kind of remember the read_bytes(1) issue... I will try to look. However could you tell me what the message actually ends on since you claim it is complete ? Does it by any chance does not end on a termchar ? That would explain read_raw erroring.

sigurdsvela commented 2 years ago

Checked now, and the message ends with a single newline.
I'm not quite sure what the default termchar is, but adding adding inst.read_termination = '\n' yielded the same error.

MatthieuDartiailh commented 2 years ago

That's weird. It sounds like the VXI package is improperly formatted. Could you post the traceback and maybe the full log (pyvisa.log_to_screen) when you get the timeout.

sigurdsvela commented 2 years ago

Soo, I'm not sure whats happening, but I'm no longer getting the timeout. While using the scope I used the "default" button to reset to default settings. I'm not sure if thats the reason, but thats the only thing I can think of that has changed.

I am, however, getting what looks like scrambled data when using read_raw over usb.

This is what I get when using TCP (Correct. Matches what is on the display) output-tcp

And this is what I get when I try to use USB output-usb

When using USB I also get the following warning

<...PATH...>/pyvisa_py/protocols/usbtmc.py:115: UserWarning: Unexpected MsgID format. Consider updating the device's firmware. See https://github.com/pyvisa/pyvisa-py/issues/20
warnings.warn(
Code import pyvisa from matplotlib import pyplot as plt rm = pyvisa.ResourceManager('@py') sds = rm.open_resource('USB0::62700::60984::SDSMMDBD2R4502::0::INSTR') #sds = rm.open_resource('TCPIP::192.168.42.70::INSTR') sds.write("C1:WF? DAT2") result = bytearray(sds.read_raw()) # Result mapping per the Siglent SDS Remote Programming manual result = [r if r <= 128 else r - 255 for r in result] plt.plot(result)
MatthieuDartiailh commented 2 years ago

This may be a combination of you reading binary data using read_raw which you should not do (please look at the documentation of read_binary_data and if your instrument uses a weird format ask here) and the TCPIP not honoring the termination character somehow. I will try to have a look at the TCPIP issue, in the meantime could you see if things works better when you use a method ensuring you get all the binary data even though it contains the termchar ?

sigurdsvela commented 2 years ago

For read_binary_values I get a Pipe Error

Traceback USBTimeoutError Traceback (most recent call last) File ./envs/lib/python3.9/site-packages/pyvisa_py/protocols/usbtmc.py:464, in USBTMC.read(self, size) 463 try: --> 464 resp = raw_read(recv_chunk + header_size + max_padding) 465 response = BulkInMessage.from_bytes(resp) File ./envs/lib/python3.9/site-packages/pyvisa_py/protocols/usbtmc.py:271, in USBRaw.read(self, size) 269 size = 1 --> 271 data = self.usb_recv_ep.read(size, self.timeout).tobytes() 273 return data File ./envs/lib/python3.9/site-packages/usb/core.py:423, in Endpoint.read(self, size_or_buffer, timeout) 411 r"""Read data from the endpoint. 412 413 The parameter size_or_buffer is either the number of bytes to (...) 421 For details, see the Device.read() method. 422 """ --> 423 return self.device.read(self, size_or_buffer, timeout) File ./envs/lib/python3.9/site-packages/usb/core.py:1029, in Device.read(self, endpoint, size_or_buffer, timeout) 1027 buff = util.create_buffer(size_or_buffer) -> 1029 ret = fn( 1030 self._ctx.handle, ... 603 else: --> 604 raise USBError(_strerror(ret), ret, _libusb_errno[ret]) 606 return ret USBError: [Errno 32] Pipe error

The instrument does use, what looks to me like, kinda weird formating. But I'm not sure whats common.

Per the manual

The head of message: C1:WF ALL. These are followed by the string #900000070, the beginning of a binary block in which nine ASCII integers are used to give the length of the block (70 bytes).After the length of block, is beginning of wave data. At the last meet ―0A 0A‖, means the end of data.

Screenshot 2022-06-29 at 23 04 52

So it uses ascii values to give the length of the data in the header of the message. That part is however not included with the WF? DAT2 command, which only returns the data.

The message should end on hex 0A 0A, double newline. Maybe thats the issue? That 0A is showing up in the data? I cant see in the manual any mention of how it is "escaped" if it shows up in the data. As in, what if the waveform data contains 0x0A0A at some point?

I think the most pressing issue might be that read_bytes is not working(Over USB it gives the same pipe error, and over TCP it returns the entire message) If that worked, I would be able to implement any weird formatting myself.

MatthieuDartiailh commented 2 years ago

The #NXXXX is known as a IEEE header and is the de facto standard. It is however a bit unusual to see extra stuff before it but anyway those are things that read_binary_values handles for you. However the double newline is weird and that may trip the read_binary_values and may require to temporary modify the term_char PyVISA expect. Because the IEEE give you a length there is no need to escape what may be a termchar inside a binary block.

Regarding read_bytes, does it always fail for USB or just here (possibly because we ask for a lot of data at once) ? Fixing TCPIP should be fairly straightforward, as it simply needs to keep a buffer around for extra non requested data in tcpip.py. Feel free to have a look if you have the time to do so. I will also try to look into it but it may not be before mid next-week.

sigurdsvela commented 2 years ago

Ah, okay, thanks! But then, why is a term_char needed at all if the length of the message is given in the message header? (Asking out of curiosity) Also, how will PyVisa know when the message ends, if i use the WF? DAT2 command, which –as far as i understand– omits the header completely?

Testing read_bytes(1) over usb with the *IDN? command fails as well, so it seems like it does indeed fail regardless of the length of data.

I tried adding inst.term_char = "\n\n", which did not seem to make a difference.

code import pyvisa from matplotlib import pyplot as plt rm = pyvisa.ResourceManager('@py') sds = rm.open_resource('') sds.term_chars = "\n\n" sds.write("*IDN?") result = sds.read_bytes(1) #<--- [Errno 32] Pipe Error. print(result)

Same error and traceback as earlier. [Errno 32] Pipe Error.

I'm not sure I'm knowledgeable enough to fix it, but I'll check it out!

MatthieuDartiailh commented 2 years ago

Some instrument omit the term char after a binary block there is no standard (I have seen different instruments from the same manufacturer behave differently).

In the case of WF? DAT2, there is not even a IEEE header ? If so then you have to assume the same size as WF? DAT1 and read all the data manually (if read_bytes fail you can use read_raw repeatedly till you get all the data).

My suggestion to alter the term char (which is actually read_termination sorry) was simply so that read_binary_values read all the characters and does not leave a feedline unread.

dernasherbrezon commented 4 months ago

Found the similar issue with Rigol DS1054Z. (PyVISA==1.14.1). When I open device like this:

_rigol = _resource_manager.open_resource('USB0::0x1AB1::0x04CE::DS1ZA253502774::INSTR', write_termination='\n', read_termination='\n')

PyVisa correctly splits output by first '\n', but if second '\n' found in the stream, it will output it during read_raw. Can it be caused by two consecutive \n\n in the stream?