[SciPy-User] 2D phase unwrapping
Gregor Thalhammer
gregor.thalhammer at gmail.com
Mon May 14 11:11:37 EDT 2012
Am 12.5.2012 um 11:58 schrieb Ralf Gommers:
>
>
> On Fri, May 11, 2012 at 9:29 PM, Gregor Thalhammer <gregor.thalhammer at gmail.com> wrote:
> Hi all,
>
> I have beend searching for an implementation for phase unwrapping in 2D (and possibly also 3D). I found this old thread in the numpy mailing list
>
> http://mail.scipy.org/pipermail/numpy-discussion/2008-November/038873.html
>
> which mentions the C implementation from GERI: http://www.ljmu.ac.uk/GERI/90202.htm
>
> While searching I found remarks by the authors that these algorithms have been incorporated into scipy, however I am unable to find them in current scipy or numpy. Am I missing something obvious?
> Instead I found this wrapper: https://github.com/pointtonull/pyunwrap
> This seems to be based on a wrapper already mentioned in the above mentioned discussion, but the links mentioned there are dead. I added some setup.py, and with some small modifications I managed to compile the extension both on OS X and Windows.
>
> I would like to see these algorithms included in scipy, and I am willing to work on this.
>
> Great!
>
> So now my questions: In the old numpy-discussion thread licensing issues are raised, can anybody tell more? On the GERI homepage they distribute their code under a non-commercial-use license, but the authors seem to agree on incorporating their code into scipy.
> Except from this, what else would be required?
>
> The emails about the license seem to be very clear to me, there's no issue. So all it would take is someone submitting a complete wrapper (with the normal requirements on docs/tests). The only things to decide are then: do we want it in scipy (+1 from me), where to put it and what the API should look like.
Over the weekend I worked on the 2D and 3D phase unwrappers. I put a first version on github:
https://github.com/geggo/phase-unwrap
git://github.com/geggo/phase-unwrap.git
I tested it on OS X with gcc-4.2, Python 2.7 and recent cython. (it crashes on Windows (MSVC 9), probably related to cython, but thats another story).
Seems to work ok, only one basic test, no docs yet.
The interface is quite simple:
def unwrap(wrapped_array,
wrap_around_axis_0 = False,
wrap_around_axis_1 = False,
wrap_around_axis_2 = False):
it accepts an 2d or 3d numpy array or an masked array, and returns an masked array if one was given. A fresh float32 array is returned. The additional arguments can be used to specify cyclic boundary conditions along the given axis. The calculations are internally performed with float32. It should be quite straightforward to extend this to other types, but I think for the most common use cases for this algorithm (unwrapping of noisy data) a float32 array is sufficient.
I guess a proper place in scipy would be to add this extension to scipy.ndimage.
Please, any comments are welcome. And also some hints, why it crashes on Windows - or how to debug.
Gregor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20120514/12abcf9a/attachment.html>
More information about the SciPy-User
mailing list