On Tue, Sep 13, 2011 at 18:22, Anthony Palomba <apalomba@austin.rr.com> wrote:
> Just to be super clear...
>> Instead of using a range, a la np.linspace, I want to be able
> to interpolate a list of paired tuples,
>> like [x1, y1, x2, y2, x3, y3, x4, y4]
>> Any ideas?
I am going to assume you meant [(x1,y1), (x2,y2), ...].
def interpmap(c, points):
x, y = np.array(points).transpose()
f = interpolate.interp1d(x, y)
return f(c)
> On Tue, Sep 13, 2011 at 5:57 PM, Anthony Palomba <apalomba@austin.rr.com>
> wrote:
>>>> Hey scipyers,
>>>> I have an interpolation question...
>>>> I have a function that I am currently using to do interpolation.
>>>> def interpmap(c, x1, y1, x2, y2, base = None):
>> range1 = np.linspace(x1, y1, 20)
>> range2 = np.linspace(x2, y2, 20)
>> f = interpolate.interp1d(range1, range2)
>> return f(c)
>>>> I takes range (x1 <= y1) and maps it on to (x2 <= y2).
>>>> I would like to be able to specify a list of points as
>> the range. Is it possible to create a linspace from a list?
>>>>>>>> Thanks,
>> Anthony
>>>>> _______________________________________________
> SciPy-User mailing list
>SciPy-User@scipy.org>http://mail.scipy.org/mailman/listinfo/scipy-user>>
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco