From: W. Trevor King Date: Sat, 4 Oct 2008 14:04:22 +0000 (-0400) Subject: Added some more Parseval's checks, but they failed. X-Git-Tag: v0.2~4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7d28642acf2a56ddee0ea4adf3d949f807c71012;p=stepper.git Added some more Parseval's checks, but they failed. TODO, figure out why and fix it, so I can uncomment the checks. --- diff --git a/FFT_tools.py b/FFT_tools.py index b6b7b35..7174d1d 100644 --- a/FFT_tools.py +++ b/FFT_tools.py @@ -45,7 +45,6 @@ def ceil_pow_of_two(num) : return num def _test_rfft(xs, Xs) : - print "Test numpy rfft definition" # Numpy's FFT algoritm returns # n-1 # X[k] = SUM x[m] exp (-j 2pi km /n) @@ -70,6 +69,7 @@ def _test_rfft(xs, Xs) : "Mismatch on Parseval's, %g != 1/%d * %g" % (timeSum, n, freqSum) def _test_rfft_suite() : + print "Test numpy rfft definition" xs = [1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1] _test_rfft(xs, rfft(xs)) @@ -120,7 +120,6 @@ def unitary_rfft(data, freq=1.0) : return (freq_axis, trans) def _test_unitary_rfft_parsevals(xs, freq, freqs, Xs): - print "Test unitary rfft on Parseval's theorem" # Which should satisfy the discretized integral form of Parseval's theorem # n-1 n-1 # SUM |x_m|^2 dt = SUM |X_k|^2 df @@ -139,6 +138,7 @@ def _test_unitary_rfft_parsevals(xs, freq, freqs, Xs): % (lhs, rhs) def _test_unitary_rfft_parsevals_suite(): + print "Test unitary rfft on Parseval's theorem" xs = [1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1] dt = pi freqs,Xs = unitary_rfft(xs, 1.0/dt) @@ -161,6 +161,7 @@ def _test_unitary_rfft_rect(a=1.0, time_shift=5.0, samp_freq=25.6, samples=256) t = i*dt x[i] = _rect(a*(t-time_shift)) freq_axis, X = unitary_rfft(x, samp_freq) + #_test_unitary_rfft_parsevals(x, samp_freq, freq_axis, X) # remove the phase due to our time shift j = complex(0.0,1.0) # sqrt(-1) @@ -209,6 +210,7 @@ def _test_unitary_rfft_gaussian(a=1.0, time_shift=5.0, samp_freq=25.6, samples=2 t = i*dt x[i] = _gaussian(a, (t-time_shift)) freq_axis, X = unitary_rfft(x, samp_freq) + #_test_unitary_rfft_parsevals(x, samp_freq, freq_axis, X) # remove the phase due to our time shift j = complex(0.0,1.0) # sqrt(-1)