[Numpy-discussion] newbie question (curve fitting Z=f(X,Y))

Benjamin Root ben.root at ou.edu
Wed Jan 5 21:06:18 EST 2011


On Tue, Jan 4, 2011 at 1:31 AM, Sachin Kumar Sharma <SSharma84 at slb.com>wrote:

> Hi,
>
>
>
> Absolute basic question I want to do following
>
>
>
> ·        Read data from excel sheet (three columns – X,Y,Z)
>
> ·        Curve fit a function Z=F(X,Y)
>
> ·        Plot X Vs Z (from data) and plot X Vs Z (from curve fit)
>
>
>
>
>
> Kindly advise me how to write a basic python script for the same.
>
>
>
> Thanks & Regards
>
>
>
> Sachin
>
>
Sachin,

If you need to read data from excel files directly, there is a tool called
python-excel:

http://www.python-excel.org/

Although, personally, I would just simply recommend exporting the excel data
into a csv file and then use numpy's loadtxt() function to read the text
file.

As for curve-fitting, you are likely want to use scipy's optimize toolkit:

http://docs.scipy.org/doc/scipy/reference/optimize.html

Finally, you use matplotlib for plotting.

This is very high-level and doesn't go into much detail, but I am sure if
you read up on how to use these tools, you will be able to get what you
want.  If you have any specific questions, then try asking either here in
the numpy mailing list (for numpy-related issues), or the scipy-users
mailing list (for scipy related issues) or the matplotlib-users mailing list
(for plotting issues).

I hope that helps!
Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110105/14482302/attachment.html>


More information about the NumPy-Discussion mailing list