Last active
February 2, 2023 05:24
-
-
Save mobilinkd/8a07cc124946c87715c6a1458118411e to your computer and use it in GitHub Desktop.
Revisions
-
mobilinkd revised this gist
Apr 16, 2021 . 1 changed file with 25 additions and 9 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,35 +1,51 @@ #!/usr/bin/env python import argparse import sys, time import pyvisa as visa from pyvisa.constants import StatusCode from PIL import Image from io import BytesIO def screendump(device, filename): rm = visa.ResourceManager('@py') # Siglent device scope = rm.open_resource('TCPIP::%s' % device) scope.timeout = 1000 # ms scope.read_trermination = None print(scope.query('*IDN?')) scope.write('SCDP') print(scope.last_status) if scope.last_status == StatusCode.success: time.sleep(1) fp = BytesIO() count = 0 try: data = scope.read_raw(20000000) fp.write(data) count = len(data) except: print("timeout") pass print("Read {} bytes.".format(count)) image = Image.open(fp) image.save(filename) scope.close() rm.close() if __name__ == '__main__': parser = argparse.ArgumentParser( description='Grab a screenshot from a Siglent LXI device.') parser.add_argument('--output', '-o', dest='filename', required=True, help='the output filename') parser.add_argument('device', metavar='DEVICE', nargs=1, help='the ip address or hostname of the DSO') args = parser.parse_args() screendump(args.device[0], args.filename)
-
mobilinkd revised this gist
Sep 29, 2017 . 1 changed file with 6 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,9 @@ import visa, sys from pyvisa.constants import StatusCode from PIL import Image from cStringIO import StringIO def screendump(device, filename): rm = visa.ResourceManager('@py') @@ -14,7 +17,8 @@ def screendump(device, filename): if status == StatusCode.success: scope.read_termination = None data = scope.read_raw(2000000) image = Image.open(StringIO(data)) image.save(filename) scope.close() rm.close() @@ -25,8 +29,7 @@ def screendump(device, filename): parser.add_argument('--output', '-o', dest='filename', required=True, help='the output filename') parser.add_argument('device', metavar='DEVICE', nargs=1, help='the ip address or hostname of the DSO') args = parser.parse_args() screendump(args.device[0], args.filename) -
mobilinkd created this gist
Jul 10, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ #!/usr/bin/env python import argparse import visa, sys from pyvisa.constants import StatusCode def screendump(device, filename): rm = visa.ResourceManager('@py') # Siglent SDS2204X scope = rm.open_resource('TCPIP::%s' % device) n, status = scope.write('SCDP') if status == StatusCode.success: scope.read_termination = None data = scope.read_raw(2000000) open(filename, "w").write(data) scope.close() rm.close() if __name__ == '__main__': parser = argparse.ArgumentParser( description='Grab a screenshot from a Siglent DSO.') parser.add_argument('--output', '-o', dest='filename', required=True, help='the output filename') parser.add_argument('device', metavar='DEVICE', nargs=1, help='the ip address or hostname of the DSO') args = parser.parse_args() screendump(args.device[0], args.filename)