Modern (digital) oscilloscopes usually perform a simulation of a phosphor-based CRT. These are described by various terms like digital phosphor, intensity grading, color temperature display, etc.
These algorithms don’t simply draw a uniform intensity pixel at each point the waveform sweeps through but draw brighter pixels where the signal dwells or repeatedly visits, or use a color map to convey similar information. For waveforms with a lot more points than plot width and particularly for modulated waveforms this can give a much better depiction.
Does anyone know if this has been implemented somewhere in the Julia plotting universe?
I don’t have other solutions regarding “digital phosphor” plots themselves, but I might have other tools you might want - and a possible home for the solution you might find/develop.
This version is particularly useful if you run parametric sweep simulations. (I should also try to consolidate the two implementations, but I haven’t put in the energy to find an adequate layering)
Thank you! I was poking around JuliaTelecom the other day - I have an RTL-SDR that I’ve played with for a couple of years and an RSP1A on the way just now and want to play with SDR in Julia eventually!
Regarding the phosphor emulation - I am thinking about using FFTResampling to upsample if necessary, forming a image in which each pixel location holds a count or dwell value, then mapping that to a color space. I previously figured out how to plot on an image using Plots.jl (for a chromaticity diagram) which would allow plotting of other things (e.g. results of math performed on the waveform) in the coordinate space of the data.
If I sweep a Gaussian spot, pick the right green, emulate misfocus and astigmatism, I should be able to get quite realistic old school scope effect. That’s taking it a bit farther than necessary but might be fun!
using Plots; gr(bg=:black, legend=false)
N=1000; Nc=100; # number of points; number of curves
t = LinRange(0, 6, N)
y = [ sin.(t .+ rand()/2) for i in 1:Nc]
p = plot()
for i in 1:Nc
plot!([t, t], [y[i], -y[i]], lc=:yellow,lw=2,la=2/Nc)
end
display(p)
using WAV
using GR
file = joinpath(dirname(Base.find_package("GR")), "..", "examples", "Monty_Python.wav")
y, fs = WAV.wavread(file)
shade(y, colormap=-GR.COLORMAP_BLUESCALE, ylim=(-1,1))
Could also be read with FileIO, but seems to be buggy (see !307).
I’m late to the party, but these excellent visualizations make me want to recreate the “oscilloscope music” from Jerobeam Fenderson - Blocks - YouTube in a more accurate style. I wrote a very simple wav → video converter here: Oscilloscope Music ← but my persistence implementation was pretty basic.