Skip to main content

Python library for interfacing with Rigol DS1000Z series oscilloscopes.

Project description

rigol-ds1000z

In addition to this README, I have also written a blog post about this application.

An oscilloscope user interface that never leaves the terminal.

RigolDS1000Z_StillScreen

Rigol_DS1000Z_Animated

A simple command line tool for grabbing data and pictures.

rigol-ds1000z --help
rigol-ds1000z --visa rsrc --display path/to/file.png
rigol-ds1000z --visa rsrc --waveform src path/to/file.csv 

Unless a VISA resource is specified with the --visa argument, 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 provided examples and read the documentation.

from rigol_ds1000z import Rigol_DS1000Z
from rigol_ds1000z import process_display, process_waveform
from time import sleep

with Rigol_DS1000Z() as oscope:
    # reset to defaults and print the IEEE 488.2 instrument identifier
    ieee = oscope.ieee(rst=True)
    print(ieee.idn)

    # configure channels 1 and 2, the timebase, and the trigger
    channel1 = 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 channel
    oscope.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 trigger
    sleep(3)
    oscope.single()

    # capture the display image
    display = oscope.display()
    process_display(display, show=True)

    # plot the channel 1 waveform data
    waveform = oscope.waveform(source=1)
    process_waveform(waveform, show=True)

Installation instructions and notes to the user.

pip install rigol-ds1000z

Available on PyPI. This package uses PyVISA to 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 Category Coverage
AUToscale, etc. YES
ACQuire no
CALibrate no
CHANnel YES
CURSor no
DECoder no
DISPlay YES
ETABle no
FUNCtion no
IEEE 488.2 YES
LA no
LAN no
MATH no
MASK no
MEASure no
REFerence no
STORage no
SYSTem no
TIMebase YES
TRIGger PARTIAL
WAVeform YES
  • Package management by Poetry.
  • Automated processing hooks by pre-commit.
  • Code formatting in compliance with PEP8 by isort, black, and flake8.
  • Static type checking in compliance with PEP484 by mypy.
  • Test execution with random ordering and code coverage analysis by pytest.
  • Automated documentation generation by sphinx.

Installing the development environment requires running the following command sequence.

poetry install
poetry run pre-commit install

In order for all tests to pass channel 2 must be connected to the calibration square wave.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rigol-ds1000z-0.3.0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rigol_ds1000z-0.3.0-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

Details for the file rigol-ds1000z-0.3.0.tar.gz.

File metadata

  • Download URL: rigol-ds1000z-0.3.0.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.9.4 Windows/10

File hashes

Hashes for rigol-ds1000z-0.3.0.tar.gz
Algorithm Hash digest
SHA256 eac9e84a687ba06ab3d58710e2c3a82d72f21fca292fa41aae1e159662a45b31
MD5 be5016b8b9f3bcb3161885c55d40e436
BLAKE2b-256 85725087eb034e45fc44278533f98b63bc3e0bc2c4fe6d6708bed88278fadd39

See more details on using hashes here.

File details

Details for the file rigol_ds1000z-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: rigol_ds1000z-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 24.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.9.4 Windows/10

File hashes

Hashes for rigol_ds1000z-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4e228d38d4b5cf5923ee4ef94c888d92fa823dfdf8e5a21bbbe5d7e09fb9acf
MD5 6ac84f846e17831b7cadf4012d857bf8
BLAKE2b-256 e9ccd07e45470433c6355dd16588553aa45734898b13f4aac165b6a440ac8eb7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page