[SciPy-Dev] Find points in delaunay triangulation : scipy.spatial vs. scipy.interpolation

Pablo Winant pablo.winant at gmail.com
Sun May 13 12:12:10 EDT 2012


Le 13/05/2012 11:40, josef.pktd at gmail.com a écrit :
> On Sun, May 13, 2012 at 10:57 AM, Pablo Winant<pablo.winant at gmail.com>  wrote:
>> Le 13/05/2012 08:44, josef.pktd at gmail.com a écrit :
>>> On Sat, May 12, 2012 at 8:13 PM, Pablo Winant<pablo.winant at gmail.com>    wrote:
>>>> Hi,
>>>>
>>>> I tried to use interpolation routines in scipy recently and I have found
>>>> two slight performance issues
>>>>
>>>>    - The LinearNDInterpolation object implemented in cython requires a
>>>> list of points and a list of values to be created. But is is not
>>>> documented how to change the values of the interpolator without doing
>>>> the mesh again. This is useful when one is solving the values of a
>>>> function at the vertices of the mesh : one doesn't want to do the
>>>> triangulation again and again. Maybe there could be a simple specific
>>>> method to set the values in this case. In that case it would consist in
>>>> changing the value of a property but it would be consistent with more
>>>> general interpolation schemes.
>>>>
>>>> - I tried to use the delaunay object from scipy and noticed a strange
>>>> thing: for a given set of coordinates it takes longer to get the indices
>>>> of the triangles containing the points than it takes to perform the
>>>> interpolation using LinearND object. This is puzzling since apparently
>>>> the implementation of LinearND performs many calls to the qhull library
>>>> to get this indices. Attached is a simple exampe demonstrating this anomaly.
>>>>
>>>> One last thing: I have written an interpolation object on sparse grids,
>>>> using smolyak product of chebychev polynomials. It is written in pure
>>>> python (vectorized) and licensed under the bsd license. Currently it
>>>> lives in another library but I guess it would make more sense to have
>>>> something like that in a more general scientific lib. Let me know if you
>>>> are interested. (it is available there anyway:
>>>> https://github.com/albop/dynare-python/tree/master/dolo/src/dolo/numeric: chebychev.py
>>>> and smolyak.py)
>>> Pablo,
>>>
>>> what is actually your license for dolo?
>> It used to be GPL, but I changed it to BSD a while ago, precisely in
>> order to integrate better with the python community.
>> As I was using google-code at that time I switched to the new-bsd
>> license which was the only bsd option.
>> If I understand well, it is refered to as BSD-3.
>>
>> Now I must say I am a bit lost in this jungle, so I guess I would follow
>> your suggestion if you say BSD-n is better.
> A while ago I got confused about all these qualifiers for BSD (for
> statsmodels), BSD with number is less ambiguous or easier to remember.
> I don't think which BSD or which MIT doesn't matter as long as it is
> clearly stated.
>
>> There several other parts of the library which would fit better outside
>> (such as a nonlinear solver with complementarity constraints) so it is
>> important to me that the license makes a sensible relocation of the code
>> possible.
>>
>>> your license file is GPL
>> Thank you for spotting that. I will need to properly do all these legal
>> stuff once I am sure about the good license.
>>> https://github.com/albop/dynare-python/blob/master/dolo/LICENSE
>>> but setup.py says BSD and and I found another package using some of
>>> your code as BSD-2
>> Can you tell me which one it is ?
> https://github.com/christophe-gouel/RECS/blob/master/LICENSE.txt
> I only looked briefly, he uses your code to parse the model definition
> files, otherwise matlab.
> see bottom of this page https://github.com/christophe-gouel/RECS
Ah, I know this one: he is a friend. He has written a software to solve 
rational expectation models in matlab. In addition to dolo, it uses the 
compecon toolbox which has some interesting interpolation routines 
(everything is documented in a book "/Applied Computational Economics 
and Finance/, Mario J. Miranda & Paul L. Fackler, MIT Press" 
<http://www4.ncsu.edu/%7Epfackler/compecon/index.htm> ). They have three 
kind of one-dimensional interpolation routines (linear, splines, 
chebychev) and they provide a flexible way to produce multidimensional 
interpolation as a product of these one-dimensional routines.

>
> I was just browsing after your link. There is some interesting code
> and it would be good if we can share some of it.
I would be very glad to do so. Until now, I have been very busy doing 
research (thesis, post-doc,...) but I am now trying to turn the code 
from dolo into something useful for others.
> I also didn't know about a python - octave bridge.
> and was trying to see how easily we could create qnwnorm with scipy.
qnwnorm comes from the compecon toolbox. It is based on a very well 
known algorithm for the one-dimensional quadrature and it should be 
fairly easy to rewrite/port it to python. I can do that if you are 
interested (it is also something I tried a while ago).

>
> Cheers,
>
> Josef
>
>> Best,
>>
>> Pablo
>>
>>> Thanks,
>>>
>>> Josef
>>>
>>>> Best regards,
>>>>
>>>> Pablo
>>>> _______________________________________________
>>>> SciPy-Dev mailing list
>>>> SciPy-Dev at scipy.org
>>>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>>> _______________________________________________
>>> SciPy-Dev mailing list
>>> SciPy-Dev at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>> _______________________________________________
>> SciPy-Dev mailing list
>> SciPy-Dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-dev
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20120513/9248234c/attachment.html>


More information about the SciPy-Dev mailing list