Make your own web-based curve fitter like zunzun.com, a tutorial

2,324 views
Skip to first unread message

zunzun.com

unread,
Nov 9, 2014, 5:54:13 PM11/9/14
to zunzun_...@googlegroups.com
Attached to this post is a simple tutorial on making your own web-based curve fitter similar to the functionality provided by zunzun.com.  The tutorial uses the Python Flask web framework.  I do not have software install instructions for Mikerslop Dang Windoze version Eleventy-Twelve or whatever they call it now.

Here is the README.txt file contents:

---------------------------

Welcome to FlaskFit, a tutorial on creating
a web-based curve fitting tool with Python Flask


Step 1: Install flask, scipy and matplotlib

On Debian or Ubuntu Linux, use this command:

sudo apt-get install python-flask python-scipy python-matplotlib



Step 2: Verify software installation

On Debian or Ubuntu Linux, run the command:

python -c "import flask, scipy, matplotlib"

If there is no error message, the installation is good.



Step 3: Run  test file with Flask

From a command line in the FlaskFit directory, run:

python TestInstallation.py

On the command line you should see:

* Running on http://127.0.0.1:5000/

When you open this URL you should see the message

"Everything Imports!"

Use Control-C to exit the Flask dev server.



Step 4: Run a test curve fit

From a command line in the FlaskFit directory, run:

python FlaskFit_One.py

and on the command line you should again see:

* Running on http://127.0.0.1:5000/

When you open this URL you should see a single graph
showing some data points and a fitted straight line.

Use Control-C to exit the Flask dev server.



Step 5: Celebrate

Congratulations, you are now fitting data using Flask!



Step 6: Future steps

What to do now?  I suggest the following:

A) Write a Flask form to submit user data for fitting

B) Re-organize the tutorial code to separate the
fitting, graphing and HTML generation code

C) Present users with a menu selection of
available equations before submitting forms

D) Create scatterplots of the curve fitting errors

E) Use matplotlib's 3D capability to display 3D
surface plots of fitted 3D equations

F) Look at the included pyeq2 source code examples
for details on displaying fit statistics, etc.

---------------------------

Post here if you have any questions or comments, I will do my best to help.

James
FlaskFit.zip

Andy Kubiak

unread,
Jan 14, 2015, 2:03:34 PM1/14/15
to zunzun_...@googlegroups.com
Hi James,

I'm curious what pdf-generating library, if any, you used to use for the website. Sphinx? Reportlab? I didn't see one in the source.

Thanks very much,
-Andy

zunzun.com

unread,
Jan 15, 2015, 5:38:30 AM1/15/15
to zunzun_...@googlegroups.com
Reportlab open source.  I could call reportlab.platypus.Preformatted(html text string) and convert the fitting results HTML from the web pages to be included in the PDF file, ensuring an exact matching hardcopy record.

My goal was direct HTML-to-PDF conversion, and when I found that in reportlab I stopped looking.
James

Andy Kubiak

unread,
Jan 16, 2015, 9:09:47 AM1/16/15
to zunzun_...@googlegroups.com
Hello again James,

Great, thanks very much for the quick reply.

Apologies for the non sequitur, but I just came across a stackoverflow post outlining a number of tools and workflows for blind software developers. You may or may not have an interest, but I thought I would pass it along: http://stackoverflow.com/questions/118984/how-can-you-program-if-youre-blind


All the best,
-Andy
Reply all
Reply to author
Forward
0 new messages