scottprahl / RigolWFM

Parsers for .wfm binary files created by a wide range of Rigol oscilloscopes
BSD 3-Clause "New" or "Revised" License
46 stars 6 forks source link

"Exception: unexpected fixed contents" error on DS2202, converting to csv #10

Closed danbates2 closed 4 years ago

danbates2 commented 4 years ago

Hi, I'm getting the following error trying to convert a wfm to csv

d4machine% wfmconvert E csv test.wfm     
Traceback (most recent call last):
  File "/usr/local/bin/wfmconvert", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/RigolWFM/wfmconvert.py", line 93, in main
    scope_data = rigol.Wfm.from_file(filename, args.model)
  File "/usr/local/lib/python3.7/site-packages/RigolWFM/wfm.py", line 180, in from_file
    ch = RigolWFM.channel.Channel(w, ch_number, pname, enabled_channels)
  File "/usr/local/lib/python3.7/site-packages/RigolWFM/channel.py", line 132, in __init__
    self.seconds_per_point = w.header.seconds_per_point
  File "/usr/local/lib/python3.7/site-packages/RigolWFM/wfm1000e.py", line 365, in header
    self._m_header = self._root.Header(self._io, self, self._root)
  File "/usr/local/lib/python3.7/site-packages/RigolWFM/wfm1000e.py", line 207, in __init__
    self._read()
  File "/usr/local/lib/python3.7/site-packages/RigolWFM/wfm1000e.py", line 210, in _read
    self.magic = self._io.ensure_fixed_contents(b"\xA5\xA5\x00\x00")
  File "/usr/local/lib/python3.7/site-packages/kaitaistruct.py", line 279, in ensure_fixed_contents
    (actual, expected)
Exception: unexpected fixed contents: got b'\xa5\xa58\x00', was waiting for b'\xa5\xa5\x00\x00'

The scope's on the latest firmware. 00.03.06

Any clues?

I've tried with a couple different files now. I can use the plotter to plot both files out, so that's working. Perhaps there's another way to pip the data to a csv?

Here's the test file:

test.wfm.zip

scottprahl commented 4 years ago

Well, first you have a DS2000 scope, not a DS1000E so your command should be

wfmconvert 2 csv test.wfm

I just tried this and discovered a small bug in how units for the DS2000 scope were handled. I fixed this in the github repository, but have not generated a new release (so you can't just do pip install --upgrade RigolWFM yet)

In any case, your file converted without problems with the current version.

danbates2 commented 4 years ago

Apologies, I missed that part of the documentation.

Thank you.

At least a bug was found!

danbates2 commented 4 years ago

I got a new error running the new command.

Traceback (most recent call last):
  File "/usr/local/bin/wfmconvert", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/RigolWFM/wfmconvert.py", line 94, in main
    actionMap[args.action](args, scope_data, filename)
  File "/usr/local/lib/python3.7/site-packages/RigolWFM/wfmconvert.py", line 33, in csv
    s = scope_data.csv()
  File "/usr/local/lib/python3.7/site-packages/RigolWFM/wfm.py", line 304, in csv
    s += ",%s%s" % (v_prefix, ch.unit.name.upper())
AttributeError: 'int' object has no attribute 'name'
scottprahl commented 4 years ago

I explicitly said that the correction was only in the repository!

In any case, I just released v.0.6.5 that you can install

pip install --upgrade RigolWFM