[SciPy-user] Phase Unwrapping Algorithm

John Hunter jdh2358@gmail....
Thu Mar 8 11:55:26 CST 2007


On 3/8/07, Jared Peacock <jpeacock@mesoscopic.mines.edu> wrote:
>
> Does anybody know of a good phase unwrapping algorithm in Python?

Does scipy.signal.hilbert do what you want?

"""
Analytic signal s(t) = a(t) * sin( phi(t) )
"""
from pylab import figure, nx, show
from scipy.signal import hilbert

t = nx.arange(0.0, 0.5, 0.001)
s = nx.sin(2*nx.pi*10*t) + nx.mlab.randn(len(t))
h = hilbert(s)

a = nx.absolute(h)
phase = nx.angle(h)

fig = figure()
ax1 = fig.add_subplot(211)
ax1.plot(t, s, 'g-', t, a*nx.cos(phase), 'b-')

ax2 = fig.add_subplot(212)
ax2.plot(t, s-a*nx.cos(phase))

show()


More information about the SciPy-user mailing list