I do this in python/matplotlib using hardy's multiquadric
interpolation.... I've posted here before promising to attach some code,
but haven't done so yet, since really need to clean things up a little.
Will try to get it done on my 10 hour flight tonight... and post within
the next few days...
Cheers,
Peter
Eric Emsellem wrote:
> Hi
> thanks for the input, however scipy interpolation scheme is on a
> regular grid.
>
> The positions I have are not even on an ORTHOGONAL grid: they are
> randomly distributed!
> So I have a set of x,y random positions with Z values and I wish to
> know the interpolated value
> at a new position xnew, ynew...
>
> It seems that this does not exist in scipy. Someone pointed out
> Scientific Python but this again does not work
> (using irregular but orthogonal grids)...
>
> This would be pretty bad if I cannot do this in python!!!
>
> Any help welcome!
>
> Cheers
> Eric
>
> Eric Emsellem wrote:
>
>> Hi,
>>
>> I know this may be a question for scipy or numarray but since
>> matplotlib is using something close to what I wish to have..., here
>> is the question:
>>
>> - I would like to use some 2D interpolation of a set of x, y, z
>> points (not regularly positioned). If possible I would like to test
>> various interpolation schemes (bilinear, splines, etc), and have a
>> FLAG to tell me if I am trying to EXTRAPOLATE (so that I can control
>> the output). I looked at scipy but this is really bad: as far as I
>> understand the doc mentions that it takes 1D array (what I want), but
>> in fact works on 2D arrays (NOT what I want).... (and it only
>> provides splines)
>>
>> I know that imshow has this built in with many different options for
>> the visualisation. So how is this done? Is it hard coded in one of
>> the matplotlib routine ? Could not find it there...
>>
>> thanks for the help
>>
>> Eric Emsellem
>>
>> On Jul 19, 2005, at 2:17 AM, Eric Emsellem wrote:
>>
>> > - I would like to use some 2D interpolation of a set of x, y, z
>> points > (not regularly positioned). If possible I would like to test
>> various > interpolation schemes (bilinear, splines, etc), and have a
>> FLAG to > tell me if I am trying to EXTRAPOLATE (so that I can
>> control the > output). I looked at scipy but this is really bad: as
>> far as I > understand the doc mentions that it takes 1D array (what I
>> want), but > in fact works on 2D arrays (NOT what I want).... (and it
>> only provides > splines)
>>
>> You have at least 2 general approaches: Delaunay triangulation and
>> splines. Straight Delaunay triangulation would be linear
>> interpolation, but can be embellished with fancier interpolation
>> techniques. As far as I know, Delaunay triangulation and associated
>> interpolation routines are not (yet) available in scipy. Surface
>> splines are available in scipy -- check out bisplrep/bisplev.
>>
>> As far as a FLAG to tell if you want to EXTRAPOLATE, I don"t know.
>> They may not be in ALL CAPS, either, so read the fine print. :)
>>
>> > I know that imshow has this built in with many different options
>> for > the visualisation. So how is this done? Is it hard coded in one
>> of the > matplotlib routine ? Could not find it there...
>>
>> I don"t think imshow does anything as fancy as what you suggest. The
>> contour routines are more sophisticated and may be useful to you, but
>> I haven"t followed how they work.
>>
>>
>>
>
--
Peter Groszkowski Gemini Observatory
Tel: +1 808 9742509 670 N. A'ohoku Place
Fax: +1 808 9359235 Hilo, Hawai'i 96720, USA
|