Trying to write a script to recreate an oscilloscope-style display using raw data, matplotlib really isn't the most appropriate tool for this task, I needed a lot of hacks just to add graticules inside the grid...


Almost done. Now the script can recreate high-quality vector images for my oscilloscope measurements.

· · Web · 3 · 2 · 6

With the help of the script, I finally can stop worrying about whether the horizontal and vertical offsets are aligned to the graticule lines before taking a screenshot, everything can be changed and recreated from raw data for better presentation.

Now I need to calculate the waveform parameters from raw data (instead of using the oscilloscope to do it), such as 10%-90% rise time. It's harder than it looks since real-life data has noise and may not be monotonically increasing. Differentiation to find dv/dt and di/dt on noisy data also gives you a lot of garbage. It seems the standard method is running a spline curve fitting to smooth the waveform first... 🤔

The voltage across 15 Ω looks like this, so the peak di/dt seems to be over 400 A/µs! 📈 This is pretty concerning, 800% of the component rating 💥...

@puniko @niconiconi That looks really nifty.

I have a quite old digital oscilloscope, I may need to do the same kind of process one day.

@maddiefuzz @puniko My oscilloscope's 320x240 resolution is low, but not too bad. I did this mainly to make data <del>manipulation</del> post-processing easier. Whenever I take a screenshot, I always end up finding some settings are bad, e.g. accidentally selecting the "system" menu when you want to show the "measure" menu... Even in this image, the vertical offset of channel 1 is not aligned to graticule.

@puniko @maddiefuzz It's just a quick and dirty script in 200 lines. Everything is tied to both the internal data format of both this particular oscilloscope, and my ad-hoc JSON format to represent a dump of that data. There is no any kind of control to adjust anything on the plot either. So it's not useful to anyone else. Perhaps I'll post that someday when I have the motivation to clean it up. CC @brethil

@niconiconi @puniko That makes sense. I believe my oscilloscope is 320x240 as well.

I honestly haven’t used my scope very much in the ten years I’ve had it, but it’s been crucial a few times. I don’t work with hardware nearly as often as software.

That's super cool. Are you planning to open source it? I would see this to be super useful for teacher of electronics courses

@niconiconi yer a wizard! A matplotlib wizard. This looks great! I recently got a hantek 6022be USB oscilloscope which can also export data. I might give something like this a try.

Sign in to participate in the conversation

cybrespace: the social hub of the information superhighway jack in to the mastodon fediverse today and surf the dataflow through our cybrepunk, slightly glitchy web portal support us on patreon or liberapay!