Programming Example: SDS Oscilloscope save a copy of a screen image via Python/PyVISA

February 26, 2020

Here is a brief code example written in Python 3.4 that uses PyVISA to pull a display image (screenshot) from a SIGLENT SDS oscilloscope via USB
and save it to a drive on the controlling computer.

NOTE: This program saves the picture/display image file to the E: drive, which may or may not exist on the specific computer being used to run the application.

Download Python 3.4, connect a SIGLENT SDS Oscilloscope using a USB cable, get the scope USB VISA address, and run the attached .PY program to save an image of the oscilloscope display. The type of file saved is determined by the instruments setting when the program is run.

You can download the .PY file here:[Download not found]

Tested with:

Python 3.4

SDS1102CML+

#Example that returns a copy of the displayed image on SIGLENT SDS
#Oscilloscopes via USB and saves to a drive location
#
#Dependencies:
#Python 3.4 32 bit
#PyVisa 1.7
#
#Rev 1: 02262020 JC

import visa
import time # for sleep

def main():
_rm = visa.ResourceManager()
sds = _rm.open_resource("USB0::0xF4EC::0xEE3A::SDS1MFCQ3R5086::INSTR") #Replace with specific USB information from scope
file_name = "E:\SCDP.bmp" #Make suere that the drive specified is available on your computer
sds.write("SCDP")
result_str = sds.read_raw()
f = open(file_name,'wb')
f.write(result_str)
f.flush()
f.close()
if __name__=='__main__':
main()