A general-purpose curve fitting utility with a graphical user interface

What is PAN?

PAN Feature Summary

PAN News

How do I get PAN to read in my data?

PAN controls

Data analysis example

Submit your own function to include in PAN

Download PAN

Disclaimer

Acknowledgments

Return to IDL programs page

What is PAN?

PAN is a general-purpose curve-fitting utility with a graphical user interface written in IDL. This means that you must have IDL running on your computer to run PAN. I wrote PAN using IDL v5.4 but it might work ok on earlier versions of IDL. You can use PAN to fit your ASCII data to any one of a library of fit functions and/or type in your own custom fit function. There is no limit to the number of functions to which you can fit your data but more functions result in more computation time.

PAN was written such that the amount of typing done by the user (in entering initial parameter guesses, for instance) is minimized. This was accomplished largely through the use of IDL’s sophisticated API toolkit. One of the features of this program is that the user can select a function from the built-in library and use the mouse to specify amplitude, position and width, all with a few mouse clicks.

The version of PAN discussed on this web site is slightly different from the one found in the DAVE distribution. In that distribution, which is a stand-alone executable, PAN has some more functionality specifically relevant to neutron scatterers such as the incorporation of the instrumental resolution function in fitting spectra.

Back to top

- Library of fit functions from which to choose (Gaussian, Lorentzians, lognormal, sloping background)
- Use the mouse for interactive initial parameter entry

- Automatically fit multiple groups to the same model
- Plot group dependence of fit parameters
- Define, save, and restore your own function to be used in the fitting
- Save/restore fits
- Constrain parameters: upper/lower bounds
- Tie parameters
- Fix parameters
- Specify number of fit iterations
- Interrupt/resume fitting
- Postscript and JPEG output of fits and fit parameters
- Create a web page (HTML) session log with output from your fitting session, adding comments where desired. Any plot created in PAN can be put into the session log.
- Visualize the correlation of fit parameters in an intuitive way.
- Use bootstrap Monte-Carlo to perform error estimates.

PAN News

-**October 11, 2002:** Posted PAN distribution and documentation to web site.

-**October 12, 2002:** Added capability to print screen, EISF, and parameter group
dependence to a JPEG file.

-**October 14, 2002:** Made minor modifications. Default PS and JPEG
filenames are the names of the data files. Fixed minor bug in updating the curve selection slider control. Autoscaling
axes now takes into account range including error bars. Now (3-column) ascii files written out using the parameter group
dependence utility and EISF utility can be read back into PAN for analysis.

-**October 15, 2002:** Made major change to handling fit interrupts based on a suggestion
by Craig Markwardt resulting in a substantial increase in the fit speed. Also removed option to view the
fits during an iteration suggested by NCNR users.

-**October 18, 2002:** Added ability to log your results into an HTML file. This is an undocumented feature
but this functionality will be discussed in the documentation soon. Also fixed a bug associated with reading in
3-column ascii data after having analyzed grouped data.

-**October 21, 2002:** Users can now save and restore user-defined fit function expressions. Also added feature
allowing user to rebin data. Documentation (on-line and PDF) for HTML session log added.

-**October 31, 2002:** Trimmed unnecessary code and removed unnecessary files.

-**November 4, 2002:** Fixed a bug found when adding a user-defined function.

-**November 15, 2002:** PAN receives an honorable mention in RSI code contest.

-**January 28, 2003:** Now PAN can read in tab-delimited ascii files.

-**August 20, 2003:** Added capability to visualize fit parameter correlations.

-**May 11, 2005:** Added capability to perform bootstrap
Monte-Carlo error estimate.

How do I get PAN to read in my data?

Your data can come in two varieties in which PAN will read it: (a)
single group or (b) multiple groups

(a). 3-column tab- or space- delimited: x,z,zerr where
x is the independent variable, z is the dependent variable, and zerr is
the measurement error in the dependent variable.

Example: Simple data set consisting of x, z and zerr

0.000
1.000 1.000

2.000 4.000
2.000

6.000 9.000
3.000

(b). Grouped ASCII data: x,y,z,zerr where x and y are
the independent variables, z is the dependent variable, and zerr is the measurement
error in the dependent variable.

All lines that begin with a hash # are comment lines and are ignored by
PAN. PAN expects the first number to appear without a hash mark to be
the number of x values and the second without a hash to be the number of
y values. The y values follow next and then two columns of z and zerr
grouped by their y value.

Example: In this example we have 5 xvalues and 3 yvalues resulting
in 15 total data (z) points. The value of z at x=-2.0 and y=1.0 is
200. The corresponding error, zerr, is 14.1.

# Number
of x-values

5

# Number of y-values

3

# xvalues:

-2.0000000

-1.0000000

0.00000000

1.0000000

2.0000000

# yvalues:

0.250000

1.00000

1.75000

# Group: 0

229.00000 15.132746

451.00000 21.236761

4380.0000 66.181568

455.00000 21.330729

209.00000 14.456832

# Group: 1

200.00000 14.142136

426.00000 20.639767

3260.0000 57.096410

393.00000 19.824228

219.00000 14.798649

# Group: 2

203.00000 14.247807

320.00000 17.888544

2103.0000 45.858478

333.00000 18.248288

232.00000 15.231546

Back to top

Download PAN

In order to run PAN you must first download the
PAN distribution (393 kb)
and unzip it onto your computer. Wherever you unzip it, make sure that the new
folders created on your computer are in your IDL path. Next type
PAN at the IDL
command prompt.

Download
PAN documentation
(PDF-351 kb)

Download PAN
source code
and associated files (zipped-438 kb)

Back to top

Acknowledgments

This programming effort was done primarily for DAVE, the Data Analysis
and Visualization Environment, which is a software package developed at
the NIST Center for Neutron Research for the reduction, visualization, and
analysis of inelastic neutron scattering data. This work is based
upon activities supported by the National Science Foundation under Agreement
No. DMR-0086210.

I would like to acknowledge valuable contributions from David Fanning,
Craig Markwardt, Ronn Kling, Mark Piper, and Michael D. Galloy. I
would also like to acknowledge valuable feedback on this software from David
Fanning, Zema Chowdhuri, Jeff Lynn, Matt Woodward, Paul Sokol, Alan Munter,
Sungil Park, John Copley, Richard Azuah, Dan Neumann, Craig Brown, and the
many users at the NIST Center for Neutron Research.

Back to top

Disclaimer

This software is provided as is without any warranty whatsoever. Permission
to use, copy, modify, and distribute modified or unmodified copies is granted,
provided this disclaimer is included unchanged.

PAN written by

Back to topRob Dimeo

NIST Center for Neutron Research

100 Bureau Drive, Stop 8562

Gaithersburg, MD 20899