I keep all my scripts out of the way in a file in this directory.
using DSP, PyPlot, Polynomials, FFTW, Statistics
sc = include("WFbyCKMSplus_scripts.jl")
at = include("../AnalysisToolbox.jl")
mrb = include("../WFMR_bs.jl")
mr = include("../WFMR.jl")
whf = include("../WhiteningFilters.jl")
util = include("../Utils.jl")
As a working test case I pick the AR(2) process $y_n = 5/4y_{n-1} - 3/8y_{n-2} + e_n$ as signal to be estimated and $x_n = y_n + u_n$
sig, pred = sc.KSEdata(10^5; pred_ind = 1:1, sig_ind= 1:1, geni = 1)
[sig; pred]
function testdisp(h,sig,pred; vew = 90:200, f)
figure(figsize=(12,4))
title("The filters")
f == 0 || plot(f,"k.-",label = "exact")
plot(h[:],"r.:",label = "approx")
xlabel("lag"); legend()
sig_hat = at.my_filt(h,pred);
res = util.TakeLook(sig,sig_hat; vew)
suptitle("A trajectory and Error over a Window")
println("MSE: ",var(res[100:end]))
end
# Benchmark
h = @timed mrb.get_wf_bs(sig,pred; M_out = 20)
tim = h.time; h = h.value
vew = 1000:2000
testdisp(h,sig,pred; f=0, vew)
println("Time: ",tim," sec")
# Benchmark
h = @timed mr.get_wf(sig,pred; M_out = 20)
tim = h.time; h = h.value
testdisp(h,sig,pred; f=0 , vew)
println("Time: ",tim," sec")
# Benchmark
h = @timed sc.vector_wiener_filter_fft(sig,pred, maxit = 1)
tim = h.time; h = h.value
testdisp(h,sig,pred; f = 0, vew)
println("Time: ",tim," sec")
# Benchmark
h = @timed sc.vector_wiener_filter_fft(sig,pred, maxit = 2)
tim = h.time; h = h.value
testdisp(h,sig,pred; f = 0, vew)
println("Time: ",tim," sec")
# Benchmark
h = @timed sc.vector_wiener_filter_fft(sig,pred, maxit = 3)
tim = h.time; h = h.value
testdisp(h,sig,pred; f = 0, vew)
println("Time: ",tim," sec")