[SciPy-User] Antwort: Re: polyval, polyfit on 2D array

markus.proeller at ifm.com markus.proeller at ifm.com
Fri Sep 4 02:18:06 EDT 2009


>>
>> Hello everyone,
>>
>> I have a two dimensional array with a shape of (600,800) and want to 
apply
>> polyval and polyfit on each of the 600 lines.
>> Is there an elegant way to avoid a for loop over axis 0?
>> So for one line my code would be this:
>>
>>>>> x=arange(800)
>>>>> p = polyfit(x, y[0,:])
>>>>> y_new = polyval(p, x)
>>
>> Thanks for help,
>>
>> Markus
>
>if you want just a linear fit then there was the discussion and recipe
>some time ago on numpy-discussion
>"polyfit on multiple data points" and "performance issue (again)"
>
>Josef

Unfortunately I don't make a linear fit, so I will use a for loop.

Thanks,

Markus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20090904/d02b5d85/attachment.html>


More information about the SciPy-User mailing list