JuliaDSP/DSP.jl — pull request #41 by gummif (2014-06-18 04:25:20+00:00)
Title: Periodogram Type

Hello
This is `module Periodograms` which has a type `Periodogramt` (the t is to avoid conflict with current module). This would replace `module Periodogram`. There is a bunch of temporary timings and tests at the end of the module. Please comment any suggestions or improvements.

1. Return types are equivalent to input types (64->64 and 32->32) and all input signals are of type `Array{DSPNumber,1}`.

2. Approximately 10x speedup compared to current functions (timing below)

3. 1 and 2 sided (always 2 sided for complex input)

4. An object `P` after construction can be called with `power(P)`, `freq(P)`, `time(P)`, `spectrogram(P)`, `p,f=pf(P)` (power and freq), `s,t,f=stf(P)` (spectrogram, time and freq). So one could call e.g.
`p, f = pf(welch_pgram(s, 64, 32))`

5. The current DSP functions are there and return an object with appropriate default fields. The default now is set to 2-sided, but 1-sided is probably better. The only required field for the constructor is the signal, all others are some default.

6. Row and column matrix vectors get converted to 1D arrays for consisted 1D array output

7. The output of `stf(P)` using `sided=1` corresponds exactly to the `spectrogram` in matlab, not just partially as before.

`P ? sided` are the functions implemented in Periodograms
```julia
welch periodograms :

P 2 sided
elapsed time: 0.021335438 seconds (26964584 bytes allocated)
Array{Float64,1} 4096
old welch
elapsed time: 0.200602274 seconds (74207008 bytes allocated, 16.96% gc time)
Array{Float64,1} 4096
P 1 sided
elapsed time: 0.01473209 seconds (26793864 bytes allocated)
Array{Float64,1} 2049

periodograms :

P 2 sided
elapsed time: 0.010130985 seconds (15749704 bytes allocated)
Array{Float64,1} 32768
old periodogram
elapsed time: 0.102803906 seconds (34109504 bytes allocated, 12.01% gc time)
Array{Float64,1} 32768
P 1 sided
elapsed time: 0.00562507 seconds (11828104 bytes allocated)
Array{Float64,1} 16385

spectrograms :

P spectrogram
elapsed time: 0.008545558 seconds (18373384 bytes allocated)
Array{Float64,2} 32768
old spectrogram
elapsed time: 0.098646124 seconds (47232168 bytes allocated, 13.40% gc time)
Array{Float64,2} 32768
P spectrogram 1 sided
elapsed time: 0.005934701 seconds (17073864 bytes allocated)
Array{Float64,2} 16385
```