org-arl / SignalAnalysis.jl

Signal analysis toolbox for Julia
MIT License
42 stars 11 forks source link

add support for psd function to return the output result as variables or expose base function #18

Open AbelHo opened 3 years ago

AbelHo commented 3 years ago

psd function is useful for automated data analysis process the output as well, would be nice to have it as a function call instead of just a plot.

mchitre commented 3 years ago

Just had a look at the psd() and specgram() code:

psd() is computed with essentially a single statement: p = welch_pgram(x, nfft, noverlap; fs=framerate(x)) and freq(p) gives you the frequency bins and power(p) gives you the PSD value.

specgram() is computed with also essentially a single statement: p = spectrogram(x, nfft, noverlap; fs=framerate(x)) and time(p), freq(p) and power(p) give you the time values, frequency bins and the spectrogram value respectively.

Both welch_pgram() and spectrogram() come from the DSP package, so you'll need using DSP.

Since these are single liner calls, we don't gain much by wrapping them further. Suggest using these directly instead.

mchitre commented 3 years ago

As discussed with @AbelHo, there may be value in having this available for multichannel signals.