Closed aphoffmann closed 1 year ago
Thanks for your comment. I don't think that plotting should be included in the nsgt functionality. Apart from that, only a spectrogram matrix is needed which boils down to
nsgt = CQ_NSGT(lowf, fmax, bins, fs, length, real=True, matrixform=True)
B = numpy.abs(nsgt.forward(sig))
This matrix can then be plotted using, e.g., pyplot.imshow(B, aspect="auto", origin="lower")
Thank you for the tip!
In this case, how would I find the frequencies for labeling the Y-axis? I noticed that nsgt.frqs has a different shape than the output matrix from nsgt.forward().
Thanks.
The frequencies are given by nsgt.frqs
.
If the argument to CQ_NSGT
reducedform=0
, then there are additional spectral bins for zero and Nyquist.
If reducedform=1
, these will be omitted. With reducedform=2
, also the fmin and fmax bins will be omitted. The fmax bin is often very dense, and omitting will reduce the spectrogram size. Clearly, only with reducedform=0
the transformation is invertible.
A very useful feature would be a standalone spectrogram function. For example:
It could use matplotlib, or any common plotting library on the back end. I had a difficult time working through spectrogram.py to try to plot my numpy array of magnetic field data.
Another very useful function would be a coherence-gram.
Love your work!