On Jun 29, 2008, at 1:00 PM, Ryan May wrote:
> Pauli Virtanen wrote:
>> Fri, 27 Jun 2008 16:46:30 -0400, Ryan May wrote:
>>>>> Pauli Virtanen wrote:
>>>> Hi,
>>>>>>>> Fri, 27 Jun 2008 14:13:22 -0400, Ryan May wrote:
>>>>> Can anyone help me use scipy.interpolate correctly. Here's my
>>>>> problem: I'm trying to make a 2D lookup table to save some
>>>>> calculations. The two parameters over which the lookup table is
>>>>> generated are independent and I have complete control over how I
>>>>> divide up the domain. Using this lookup table, I'd like to then
>>>>> calculate values over an unstructured set of parameter values
>>>>> (ie. a
>>>>> list of pairs of parameter values). Is there a function in
>>>>> scipy.interpolate that can help here? What I'd really like to be
>>>>> able
>>>>> to do is generate an interpolator object from my 2D array, and
>>>>> then
>>>>> pass a pair of 1D arrays to the object and have it return 1D
>>>>> array of
>>>>> values.
>> [clip]
>>>> Another hint: looking at
>>>> scipy.ndimage.map_coordinates
>>>> may turn out to be useful: it seems to be able to interpolate from a
>> regular grid to a vector of coordinates.
>>>> Jackpot! This works really well. There's a good example on using
> it here:
>>http://www.scipy.org/Cookbook/Interpolation>> Which is important, because I had to read the docstring a dozen
> times to
> understand what was going on. It should also be noted that while the
> example interpolates to a regular grid, there's nothing precluding
> interpolating to an irregular collection of points. What's weird is
> that you need to manually scale the points to which you're
> interpolating
> to be floating point indices within the original grid. This is
> probably due to the ndimage-focused nature of map_coordinates.
>> Moving some of the functionality of map_coordinates, in a more generic
> fashion, into scipy.interpolate wouldn't be the worst idea in the
> world.
> Then again, I don't know if anyone else is planning on improving
> scipy.interpolate to gain this functionality (interpolation to array
> of
> irregular set of points) in another way. (I also can't volunteer to
> step up and do it at this time.)
>> Ryan
>> --
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
Ryan,
It looks like you were bitten by the same organizational problem that
Shane mentions here (4th paragraph about where to find interpolation):
http://www.vetta.org/2008/05/scipy-some-more-thoughts/
Seems like we should address this both in the documentation and in the
actual organization/location of the routines. Thoughts?
Travis