# >>> help(numpy.fft.fftpack.rfft) for Numpy's explaination.
# See Numerical Recipies for a details.
trans = rfft(data[0:nsamps])
- power = trans * trans.conj() # We want the square of the amplitude.
+ power = (trans * trans.conj()).real # We want the square of the amplitude.
return (freq_axis, power)
def unitary_power_spectrum(data, freq=1.0) :
starti = i*chunk_step
stopi = starti+chunk_size
fft_chunk = rfft(data[starti:stopi]*win)
- p_chunk = fft_chunk * fft_chunk.conj()
+ p_chunk = (fft_chunk * fft_chunk.conj()).real
power += p_chunk.astype(float)
power /= float(nchunks)
return (freq_axis, power)