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

DS1000Z 2 channel issue (stride=2) w/ easy fix #8

Closed ziceva closed 4 years ago

ziceva commented 4 years ago

Hello,

I needed a way to parse some large wfm files (large enough that exporting them to csv directly took waay too long) and came across this wonderful project. For me it did not work out-of-the-box. It turned out to be because I had only exported 2 channels. Since I am not a "native python speaker" :), It took me a while to figure it out even though it is trivial; I am posting it here so that maybe someone else may benefit from it; it should probably be fixed in the master also at some point.

channel.py
93c93
-             raw_bytes = np.array(data.raw2 & 0x00FF, dtype=np.uint8)
+             raw_bytes = np.array(np.uint16(data.raw2) & 0x00FF, dtype=np.uint8)
95c95
-             raw_bytes = np.array(data.raw2 & 0xFF00) >> 8, dtype=np.uint8)
+             raw_bytes = np.array((np.uint16(data.raw2) & 0xFF00) >> 8, dtype=np.uint8)

Best regards, John

scottprahl commented 4 years ago

Thanks for the bug fix!

(I did not have a .wfm file with just two channels so that particular bit of code did not get exercised.)