Package: rigol-ds1000z
rigol-ds1000zIn addition to this README, I have also written ablog postabout this application.An oscilloscope user interface that never leaves the terminal.A simple command line tool for grabbing data and pictures.rigol-ds1000z--help
rigol-ds1000z--visarsrc--displaypath/to/file.png
rigol-ds1000z--visarsrc--waveformsrcpath/to/file.csvUnless a VISA resource is specified with the--visaargument, the CLI will search for a Rigol DS1000Z series oscilloscope and connect to the first one it finds.The CLI can capture and save to file an image of the display (--display) or the waveform data of the specified source channel (--waveform).A compact Python interface for automating test procedures.See the providedexamplesand read thedocumentation.fromrigol_ds1000zimportRigol_DS1000Zfromrigol_ds1000zimportprocess_display,process_waveformfromtimeimportsleepwithRigol_DS1000Z()asoscope:# reset to defaults and print the IEEE 488.2 instrument identifierieee=oscope.ieee(rst=True)print(ieee.idn)# configure channels 1 and 2, the timebase, and the triggerchannel1=oscope.channel(1,probe=1,coupling="AC",offset=3.0,scale=2)channel2=oscope.channel(2,probe=1,scale=1,display=True)timebase=oscope.timebase(main_scale=200e-6)trigger=oscope.trigger(mode="EDGE",source=2,coupling="DC",level=1.5)# send an SCPI commands to setup the math channeloscope.write(":MATH:DISPlay ON")oscope.write(":MATH:OPER SUBT")oscope.write(":MATH:SOUR2 CHAN2")oscope.write(":MATH:SCAL 5")oscope.write(":MATH:OFFS -10")# wait three seconds then single triggersleep(3)oscope.single()# capture the display imagedisplay=oscope.display()process_display(display,show=True)# plot the channel 1 waveform datawaveform=oscope.waveform(source=1)process_waveform(waveform,show=True)Installation instructions and notes to the user.pip install rigol-ds1000zAvailable onPyPI. This package usesPyVISAto communicate with the oscilloscope. The user will have to install some VISA backend library for their operating system such as National Instrument's VISA library or libusb (this package supports both the "@ivi" and "@py" PyVISA backends transparently).This software has been tested on Windows (Command Prompt and PowerShell), although it should be possible to run in other shells and/or operating systems. For best visual performance, a default of white text on a black background is recommended.The software does insert some sleep time on specific commands (such as reset and autoscale) to ensure fluid operation of the oscilloscope. The user may find that they require additional downtime after certain command sequences.Software development and references.Rigol DS1000Z programming manual.Command CategoryCoverageAUToscale, etc.YESACQuirenoCALibratenoCHANnelYESCURSornoDECodernoDISPlayYESETABlenoFUNCtionnoIEEE 488.2YESLAnoLANnoMATHnoMASKnoMEASurenoREFerencenoSTORagenoSYSTemnoTIMebaseYESTRIGgerPARTIALWAVeformYESPackage management byPoetry.Automated processing hooks bypre-commit.Code formatting in compliance withPEP8byisort,black, andflake8.Static type checking in compliance withPEP484bymypy.Test execution with random ordering and code coverage analysis bypytest.Automated documentation generation bysphinx.Installing the development environment requires running the following command sequence.poetryinstall
poetryrunpre-commitinstallIn order for all tests to pass channel 2 must be connected to the calibration square wave.