Created
November 28, 2022 11:25
-
-
Save steveway/74794d8cfd50125be3a8d2b8d0054b91 to your computer and use it in GitHub Desktop.
Receives the configuration of a Siglent Oscilloscope using the PNSU command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env python3 | |
| import pyvisa as visa | |
| from serial.serialutil import SerialException | |
| def main(): | |
| # Get list of connected Siglent devices | |
| rm = visa.ResourceManager() | |
| device_list = {} | |
| for device_name in rm.list_resources(): | |
| print(device_name) | |
| device_id = "" | |
| try: | |
| device_id = rm.open_resource(device_name).query("*IDN?") | |
| except (visa.VisaIOError, FileNotFoundError, SerialException): | |
| pass | |
| if device_id.lower().startswith("siglent"): | |
| if device_name not in device_list: | |
| device_list[device_name] = rm.open_resource(device_name) | |
| for name in device_list.keys(): | |
| device = device_list[name] | |
| device.timeout = 30000 | |
| print(name.split("::")[3]) | |
| buf = device.query_binary_values('PNSU?', datatype='B', delay=3) | |
| filename = "Siglent_{}.lss".format(name.split("::")[3]) | |
| with open(filename, 'wb') as f: | |
| f.write(bytearray(buf)) | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment