Skip to main content

Read and parse Rigol Oscilloscope WFM files

Project description

https://mybinder.org/badge_logo.svg https://colab.research.google.com/assets/colab-badge.svg https://img.shields.io/badge/kaitai-struct-green.svg https://img.shields.io/badge/nbviewer-docs-yellow.svg https://img.shields.io/badge/readthedocs-latest-blue.svg

This project is intended to be a comprehensive resource for interpreting waveform .wmf files created by any Rigol oscilloscope. Open source (and Rigol’s own applications) that parse/convert Rigol’s binary .wfm files are sadly balkanized: each program tends to support a single oscilloscope group and the available efforts are spread across a range of languages.

This project leverages a domain specific language (kaitai struct) to represent the binary files. Once a binary file has been described in this text format, parsers can be generated for a wide range of languages (C++/STL, C#, Go, Java, JavaScript, Lua, Perl, PHP, Python, and Ruby).

Kaitai Struct <https://kaitai.io> also has a slick web IDE <https://ide.kaitai.io> that allows one to interactively reverse engineer binary file formats directly in your browser. This is super helpful for those Rigol .wfm formats that are undocumented.

Installation

The RigolWFM package can be installed via pip:

pip install RigolWFM

Usage

Once this is done, one can plot the signals from binary Rigol .wfm files by:

import matplotlib.pyplot as plt
import RigolWFM.wfm as rigol

filename = 'example.wfm'
scope = 'DS1000E'

w = rigol.Wfm.from_file(filename, scope)
w.plot()
plt.show()

Alternatively, wfmconvert can be used from the command line. For example, the following should convert all the DS1000E files in the current directory to the .csv format:

prompt> wfmconvert E csv *.wfm

If you just wanted to convert channel 1 from a single file to .csv then:

prompt> wfmconvert --channel 1 E csv DS1102E.wfm

If you wanted to a signal .wav file using the second channel waveform (for use with LTspice) then:

prompt> wfmconvert --channel 2 E wav *.wfm

If you want to create a .wav file with channels one and four as signals (and autoscale for use with Audacity or Sigrok Pulseview):

prompt> wfmconvert --autoscale --channel 14 E wav *.wfm

More extensive documentation can be found at <https://RigolWFM.readthedocs.io>

Status

There is a bit of work remaining (testing, validation, repackaging) but there are binary file descriptions for .wfm files created by the following scopes:

  • DS1000C tested (one file only)

  • DS1000E tested

  • DS1000Z tested, but with wonky voltage offsets

  • DS2000 tested

  • DS4000 tested

  • DS6000 untested

Resources

This has been a bit of an adventure. In the process of nailing down the basic formats, I have gleaned information from a wide range of projects started by others.

Source code repository

<https://github.com/scottprahl/RigolWFM>

License

BSD 3-clause – see the file LICENSE for details.

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

RigolWFM-0.8.0.tar.gz (24.2 kB view details)

Uploaded Source

File details

Details for the file RigolWFM-0.8.0.tar.gz.

File metadata

  • Download URL: RigolWFM-0.8.0.tar.gz
  • Upload date:
  • Size: 24.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

File hashes

Hashes for RigolWFM-0.8.0.tar.gz
Algorithm Hash digest
SHA256 ba216381d605e93d636a25c79bf7accc642d51f32078b8e5dc92c8c0b9edc67a
MD5 0e90e6810742c49622fc70cb10c37d1c
BLAKE2b-256 d81e11da9f479cc951dc2eee1367904a79baec6f3c0c072d69d784dff18a9be2

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