From ca7cd3fafbbd6ff6b5d74095bc743afb1a9b7e70 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 18 Nov 2012 17:27:46 -0500 Subject: [PATCH] FFT_tools: two spaces before inline comments (PEP8) --- FFT_tools.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/FFT_tools.py b/FFT_tools.py index a60777b..78c4e29 100644 --- a/FFT_tools.py +++ b/FFT_tools.py @@ -201,7 +201,7 @@ def _test_unitary_rfft_rect( #_test_unitary_rfft_parsevals(x, samp_freq, freq_axis, X) # remove the phase due to our time shift - j = _numpy.complex(0.0,1.0) # sqrt(-1) + j = _numpy.complex(0.0,1.0) # sqrt(-1) for i in range(len(freq_axis)): f = freq_axis[i] inverse_phase_shift = _numpy.exp(j*2.0*_numpy.pi*time_shift*f) @@ -255,7 +255,7 @@ def _test_unitary_rfft_gaussian( #_test_unitary_rfft_parsevals(x, samp_freq, freq_axis, X) # remove the phase due to our time shift - j = _numpy.complex(0.0,1.0) # sqrt(-1) + j = _numpy.complex(0.0,1.0) # sqrt(-1) for i in range(len(freq_axis)): f = freq_axis[i] inverse_phase_shift = _numpy.exp(j*2.0*_numpy.pi*time_shift*f) @@ -303,7 +303,7 @@ def power_spectrum(data, freq=1.0): # >>> help(numpy.fft.fftpack.rfft) for Numpy's explaination. # See Numerical Recipies for a details. trans = _numpy.fft.rfft(data[0:nsamps]) - power = (trans * trans.conj()).real # We want the square of the amplitude. + power = (trans * trans.conj()).real # we want the square of the amplitude return (freq_axis, power) @@ -350,7 +350,7 @@ def _test_unitary_power_spectrum_sin(sin_freq=10, samp_freq=512, samples=1024): imax = _numpy.argmax(power) expected = _numpy.zeros((len(freq_axis),), dtype=_numpy.float) - df = samp_freq/_numpy.float(samples) # df = 1/T, where T = total_time + df = samp_freq/_numpy.float(samples) # df = 1/T, where T = total_time i = int(sin_freq/df) # average power per unit time is # P = @@ -561,13 +561,13 @@ def avg_power_spectrum(data, freq=1.0, chunk_size=2048, raise ValueError( 'chunk_size {} should be a power of 2'.format(chunk_size)) - nchunks = len(data)/chunk_size # integer division = implicit floor + nchunks = len(data)/chunk_size # integer division = implicit floor if overlap: chunk_step = chunk_size/2 else: chunk_step = chunk_size - win = window(chunk_size) # generate a window of the appropriate size + win = window(chunk_size) # generate a window of the appropriate size freq_axis = _numpy.linspace(0, freq/2, chunk_size/2+1) # nsamps/2+1 b/c zero-freq and nyqist-freq are both fully real. # >>> help(numpy.fft.fftpack.rfft) for Numpy's explaination. @@ -617,9 +617,9 @@ def _test_unitary_avg_power_spectrum_sin( imax = _numpy.argmax(power) expected = _numpy.zeros((len(freq_axis),), dtype=_numpy.float) - df = samp_freq/_numpy.float(chunk_size) # df = 1/T, where T = total_time + df = samp_freq/_numpy.float(chunk_size) # df = 1/T, where T = total_time i = int(sin_freq/df) - expected[i] = 0.5 / df # see _test_unitary_power_spectrum_sin() + expected[i] = 0.5 / df # see _test_unitary_power_spectrum_sin() print('The power should peak at {} Hz of {} ({}, {})'.format( sin_freq, expected[i], freq_axis[imax], power[imax])) -- 2.26.2