Created
October 16, 2019 14:38
-
-
Save steveway/05739b2edd1340e189909d0675af5cee to your computer and use it in GitHub Desktop.
This should currently be able to take a screenshot Rigol DS1000E devices. (Tested with 2 DS1102E connected)
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 visa | |
| def main(): | |
| # Get list of connected Rigol devices | |
| rm = visa.ResourceManager() | |
| device_list = {} | |
| for device_name in rm.list_resources(): | |
| device_id = "" | |
| try: | |
| device_id = rm.open_resource(device_name).query("*IDN?") | |
| except visa.VisaIOError: | |
| pass | |
| if device_id.lower().startswith("rigol"): | |
| if device_name not in device_list: | |
| device_list[device_name] = rm.open_resource(device_name) | |
| # Get screenshot from all found Rigol devices | |
| for name in device_list.keys(): | |
| device = device_list[name] | |
| buf = device.query_binary_values(':DISP:DATA?', datatype='B', chunk_size=1152054) | |
| filename = "Rigol_{}.bmp".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