How to see the output from DSP.Periodograms.periodogram?

Thank you for taking the time to look at my rookie problem. I cannot find documentation on the periodogram type variable and consequently cannot access the results of DSP periodograms routine.
Can you help?
The steps/data I’m using are listed below.

julia> using DSP

julia> s
4096-element Array{Float64,1}:
 -13.02
 -14.07
 -19.87
 :
 -20.3
 -20.78
 -14.65

 ps=periodogram(s)
DSP.Periodograms.Periodogram{Float64,Frequencies}([475.002, 747.338, 88.3251, 1890.08, 938.792, 4904.95, 7845.16, 1386.74, 4073.1, 4158.63  …  409.203, 310.278, 845.878, 312.647, 382.544, 423.588, 596.257, 64.2432, 848.588, 348.645], [0.0, 0.000244141, 0.000488281, 0.000732422, 0.000976563, 0.0012207, 0.00146484, 0.00170898, 0.00195313, 0.00219727  …  0.497803, 0.498047, 0.498291, 0.498535, 0.498779, 0.499023, 0.499268, 0.499512, 0.499756, 0.5])

julia> ps
DSP.Periodograms.Periodogram{Float64,Frequencies}([475.002, 747.338, 88.3251, 1890.08, 938.792, 4904.95, 7845.16, 1386.74, 4073.1, 4158.63  …  409.203, 310.278, 845.878, 312.647, 382.544, 423.588, 596.257, 64.2432, 848.588, 348.645], [0.0, 0.000244141, 0.000488281, 0.000732422, 0.000976563, 0.0012207, 0.00146484, 0.00170898, 0.00195313, 0.00219727  …  0.497803, 0.498047, 0.498291, 0.498535, 0.498779, 0.499023, 0.499268, 0.499512, 0.499756, 0.5])

julia> typeof(ps)
DSP.Periodograms.Periodogram{Float64,Frequencies}

Showall() does not appear to work for this type of variable.

  1. How do I see all the rows/save the periodogram variable to a file?
  2. How do I plot the periodogram variable? (I see DSP had a plot_spectrogram(f,fs) but cannot find documentation on the fs parameter.)

Edit note: added intro and clarified questions.

In general, you can use fieldnames to inspect what are the fields of the type of the variable (hint: typeof).

julia> fieldnames(typeof(ps))
(:power, :freq)

So now you can retrieve the information from ps

julia>  ps.power
4096-element Array{Float64,1}:
...

If you need to see the result in a plot, here is an example of plotting the power spectrum using Plots.jl

using DSP, Plots

fs = 44_000;
fc = 12_000;
t = 0:1/fs:1024*(1/fc)

m = sinc.(fc/8*t)

y = cos.(2*pi*fc*t) .* m

Y = periodogram(y; fs=fs)

plot(Y.freq, DSP.pow2db.(Y.power))
4 Likes

Thank you. The retrieval of the single column is a great clue and the plot command is valuable.
I will investigate when I reinstall Atom after the recent debacle with its update.