Rigol oscilloscope binary file parser


So, just a day before my vacation trip I got a brand new RIGOL DS1052E. I was very eager to get back from my travels to check out my new scope. Unfortunately, I soon discovered that there is no good program to parse the native wfm files generated by the scope.

There already exist several attempts in generating a parser for the file format. The first attempt seems to be a script for Matlab. But this script suffers from not parsing all the available information and doing errors in alternate trigger mode. There are several derivations of this code on the Internet – all suffering more or less from the same problems.

New code

The problem was finally solved by Dexter who successfully reverse-engineered most fields of the Rigol wfm file format and uses it in its awesome wfm_view program. Unfortunately, it does only work under Windows and closed-source. Fortunately, he opened up the source code regarding the parsing of the wfm file. While it is not usable in it’s own it can be used to extract a protocol definition from it.

Armed with this wealth of information, I’ve re-implemented the file parser in standard Python. The code has been tested with Python 2.7.3 and 3.3.0 and should work without any modification.

The code contains an example usage of the library, see wfmutil.py. Which can be used to

  • extract header information
  • export to CSV as if the CSV was generated on the scope
  • plot the waveform and its FFT. (This requires numpymatplotlib and scipy)


Inspired by Dexter’s work, I’ve also put an antenna to one input of my Rigol DS1052E and could clearly see all the radio stations I have here:

Radio with a Rigol DS1052E

Get it

You can find the code on my Github page:


9 thoughts on “Rigol oscilloscope binary file parser

  1. Use baudline (OS X / Linux) and open the wfm file directly (its automagic detector will see the data start)- set the sample rate to e.g 500,000 for the 1052E. It will also playback the audio of the capture wave which sounds pretty odd. Unfortunately its not possible to specify the offset for the 2nd channel decode, so e.g stereo playback or import from two channels isnt possible. It will simply play channel 1 data then channel 2. Making a tool to split the wfm file to two seperate files, or one interleaved ch1,ch2, etc would enabled stereo playback / analysis. (cross correlation and impulses)

    1. Hi Mike,

      interesting tip! I’ve played with baudline and it works indeed. But I think automagic is just for compression and will *not* detect the data start. So you will have garbage in the beginning. What you can also do, is to open a CSV file from your scope (or generated by my program). It seems to work well for the files I tried.

      It would also be fairly simple to generate a file just containing the data interleaved – just some simple python code. I’d except a merge request on github 😉


  2. Hallo Matthias!

    vielen Dank für deinen Python script 🙂

    But whereas it seems to work for the E series, I have a DS1024C whose WMF file your tool does not parse. I got the following error:

    ./wfmutil.py info Bouton0.wfm
    Format does not follow the known file format. Try the –forgiving option.
    If you’d like to help development, please report this error:

    Field smpRate >= 0 not met, got -1.03636966193e-21

    So there seems to be some discrepancy between C series and E series WMF…
    Genieß Sommerzeit!

  3. BTW, commenting out the line that holds the requirement for smpRate evidently skips this error, but another one appears, and so on. It seems the file format is *really* somewhat different.

Leave a Reply

Your email address will not be published. Required fields are marked *