[AstroPy] Re : Re : strange error with ctypes

Jerome Caron jerome_caron_astro@ymail....
Thu Feb 16 23:43:38 CST 2012

I actually found the code from P.Thevenaz is better than Scipy. There is published information about its implementation and performance. It's explained how to use it for images, and finally P.Thevenaz answers to technical questions by email. The implementation is very nice, mirror conditions and Bsplines with order 2 to 9. It should also be faster because all in pure C. I like Scipy and I am using several Scipy modules for my library (ndimage, fftpack) but Bspline has a central role so I am concerned about it. Using ctypes is a very strong advantage of Python; I also re-coded the median calculation in C and gained several orders of magnitude wrt computation time.

De : Erik Bray <embray@stsci.edu>
À : astropy@scipy.org 
Envoyé le : Jeudi 16 février 2012 21h34
Objet : Re: [AstroPy] Re : strange error with ctypes

On 02/16/2012 02:47 PM, Jerome Caron wrote:
> Dear James,
>>I believe it could cause an error if either the pointer Line has been
>>changed, so you are trying to free the wrong memory, or something has
>>inadvertently overwritten the memory you're trying to free
> Thanks for the suggestion ! You're right, this could be a possibility. I
> checked carefully the code, but the only instructions with Line are
> assignments and arithmetic operations with Line[i], i varying from 0 to
> Width-1. There is not a single operation with the pointer itself. So I
> don't see what could be wrong...
> This piece of code in my dll is a third party library
> (http://bigwww.epfl.ch/thevenaz/interpolation/). The code is nicely
> written, and it's clear than the author knows what he's doing.
> I am a bit puzzled, I am sure if there was such error there would be an
> exception thrown by the dll. But there's no exception: Python reports an
> error in the dll, and the dll does not see any error. It looks like
> Python and C++ do not understand each other. Might this be something
> wrong with my Python code, a bad usage of ctypes ??
> Jerome

Forgive my asking, since I know this wasn't really your question. But is 
there some reason not to use SciPy's interpolation?

AstroPy mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/astropy/attachments/20120217/2aeff670/attachment.html 

More information about the AstroPy mailing list