[SciPy-user] phase wrapping algorithm

Travis Oliphant oliphant.travis at ieee.org
Tue Oct 10 13:52:49 CDT 2006

Ryan Krauss wrote:
> Thanks Travis.
> I looked in scipy.signal and when I didn't see, I just assumed it didn't exist.
> I was just starting to make good progess on my FORTRAN version too.....
The FORTRAN version would be faster and not require memory use.  The 
NumPy version creates the difference vector, finds discontinuites and 
forms a correction vector that is cumsummed and added to the original.
> I may need to revisit this when I need more control over messy
> experimental data.  Is there a tricky in-place way to calculate the
> difference between a vector and itself shift by 1 or more elements?

c[:-1] -= c[1:]  # shift-by-one
c[:-2] -= c[2:]  # shift-by-two


This will leave un-changed the last elements of the array.


More information about the SciPy-user mailing list