s_complex = np.fft.rfft(y, n=n, axis=0, norm=norm)
assert s_complex.shape[0] == n // 2 + 1
R, I = s_complex.real, s_complex.imag
return R * R + I * I
def modphase(y, n=4096, norm=None):
Phase of modulation spectrum.
After Change
s_complex = np.fft.rfft(x, n=n, axis=0, norm=norm)
assert s_complex.shape[0] == n // 2 + 1
R, I = s_complex.real, s_complex.imag
ms = R * R + I * I
// TODO: this is ugly...
if return_phase:
return ms, np.exp(1.j * np.angle(s_complex))
else:
return ms