Package: grace
Version: 5.1.22-5
One of the most used features in software for scientific data
analysis is the ability to perform non linear peak fitting (specifically
Lorentzian and Gaussian fits). Xmgrace sorely lacks this capability,
unless you consider adding manually the required formula.
The attached patch attempts to resolve this issue, by extending the
non-linear panel with new menu entries (under a new "Library" menu
entry) for:
Gaussian (single, double, chromatography), Lorentzian (single
double), Pseudo Voigt 1, Pseudo Voigt 2, Asymmetric double sigmoidal,
Log Normal Function, Gram-Charlier A-Series, Edgeworth-Cramer Series,
Inverse Polynomial Function.
It also includes, Periodic Peak functions (Sine, Sine square, Sine
damp), and Baseline Functions (Exponential Decay 1, Exponential Decay 2,
Exponential Growth 1, Exponential Growth 2, Hyperbolic, Bradley,
Logarithm 3 parameters).
The modifications are minor, and flexible for future implementations of
other possible usable formulas and more important, for multi-peak
fitting.
I realize this patch should be pushed upstream first. However
development upstream has been nonexistent for more than a year now, and
the patch I submitted many months back is still sitting there. Given the
more active development via Debian, I try this as a more viable mean to
get it through.
The same bug has been filed for Ubuntu:
https://bugs.launchpad.net/ubuntu/+source/grace/+bug/535459
and upstream
http://plasma-gate.weizmann.ac.il/Grace/phpbb/w3todo.php?action=view_report&project_id=1&todo_id=2220
Testing binaries are available (for ubuntu only) here:
https://launchpad.net/~grace-extended/+archive/ppa/+packages
I am using:
GNU/Linux 2.6.31-20-generic #58-Ubuntu SMP i686
libc6 2.10.1-0ubuntu16
_________________________________________________________________
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1
diff -Nru grace-5.1.22.orig/doc/UsersGuide.html grace-5.1.22/doc/UsersGuide.html
--- grace-5.1.22.orig/doc/UsersGuide.html 2008-05-21 13:52:14.000000000 -0700
+++ grace-5.1.22/doc/UsersGuide.html 2010-03-17 11:25:06.868989520 -0700
@@ -1516,6 +1516,89 @@
sample range or to produce an evenly spaced set from an irregular
one.</P>
+<P>Under the "Library" menu, several functions are available under the
+categories: "Gaussian Functions", "Lorentzian Functions", "Peak Functions",
+ "Periodic Peak Functions" and "Baseline Functions".</P>
+
+<P><i>Gaussian</i><br>  y = A0 + (A3*2*sqrt(ln(2)/pi)/A2)*exp(-4*ln(2)*((x-A1)/A2)^2)<br>
+  where: A0: Baseline offset; A1: Center of the peak; A2: Full width at half
+maximum; A3: Peak area.<br>  <i>Gaussian (Chromatography):</i><br>
+  y = A0 + (1/sqrt(2*pi))*(A3/A2)*exp(-(x-A1)^2/2*A2^2)
+ A0: Baseline offset; A1: Center of the peak (retention time); A2:
+ Standard deviation of the peak; A3: Peak area.</P>
+
+<br>
+<P><i>Lorentzian</i><br>  y = A0 + (2*A2*A3/pi)/(4*(x-A1)^2 + A2^2)<br>
+  where: A0: Baseline offset; A1: Center of the peak; A2: Full width at half
+maximum; A3: Peak area.</P>
+
+<br>
+<P><i>Peak Functions</i><br>
+<i>Pseudo Voigt 1</i><br>
+  y = A0 + A3 * (A4*(2/pi)*A2/(4*(x-A1)^2+A2^2) + <br>(1-A4)*exp(-4*ln(2)*(x-A1)^2/A2^2)*(sqrt(4*ln(2))/(A2*sqrt(pi))))<br>
+  where: Gaussian and Lorentzian have the same width; A0: Baseline offset;
+ A1: Center of the peak; A2: Full width at half maximum; A3: Amplitude;
+ A4: Profile shape factor.<br>
+<i>Pseudo Voigt 2</i><br>
+  y = A0 + A3 * (A5*(2/pi)*A2/(4*(x-A1)^2+A2^2) + (1-A5)*exp(-4*ln(2)*(x-A1)^2/A4^2)*(sqrt(4*ln(2))/(A2*sqrt(pi))))<br>
+  where: Gaussian and Lorentzian have different width; A0: Baseline offset;
+ A1: Center of the peak; A2: Full width at half maximum; A3: Amplitude;
+ A4: Profile shape factor.<br>
+<i>Asymmetric double Sigmoidal</i><br>
+  y = A0 + A3*(1/(1+exp(-(x-A1+A2/2)/A4)))*(1-(1/(1+exp(-(x-A1-A2/2)/A5))))<br>
+  where: A0: Baseline offset; A1: Center of the peak; A2: Width 1;
+ A3: Amplitude; A4: Width 2; A5: Width 5.<br>
+<i>Logarithm Normal:</i> <br>
+  y = A0 + A3*exp(-((ln(x)-ln(A1))^2)/(2*A2))<br>
+  where: A0: Baseline offset; A1: Center of the peak; A2: Width <br>
+<i>Gram-Charlier A-Series (GCAS)</i><br>
+  y = A0 + A3/(A2*sqrt(2*pi))*exp(-0.5*((x-A1)/A2)^2)*(1+(A4/6)*
+ (((x-A1)/A2)^3-3*(x-A1)/A2)+(A5/24)*(((x-A1)/A2)^4-6*((x-A1)/A2)^3+3))<br>
+  where: A0: Baseline offset; A1: Center of the peak; A2: Standard deviation;
+ A3: Peak Area; A4: Skew; A5: Excess. <br>
+<i>Edgeworth-Cramer Series</i><br>
+  y = A0 + A3/(A2*sqrt(2*pi))*exp(-0.5*((x-A1)/A2)^2)*(1+(A4/6)*
+ (((x-A1)/A2)^3-3*(x-A1)/A2)+(A5/24)*(((x-A1)/A2)^4-6 *((x-A1)/A2)^3+3)
+ +(A5^2/720)*(((x-A1)/A2)^6-15*((x-A1)/A2)^4+45*((x-A1)/A2)^2-15))<br>
+  where: A0: Baseline offset; A1: Center of the peak; A2: Standard deviation;
+ A3: Peak Area; A4: Skew; A5: Excess. <br>
+<i>Inverse Polynomial</i><br>
+  y=A0+A3/(1+ A4*(2*(x-A1)/A2)^2 + A5*(2*(x-A1)/A2)^4 + A6*(2*(x-A1)/A2)^6) <br>
+  where: A0: Baseline offset; A1: Center of the peak; A2: Standard deviation;
+ A3: Peak Area; A4, A5, A6: Parameters. <br>
+ </P>
+
+<br>
+<P><i>Periodic Peak Functions</i><br>
+<i>Sine:</i> <br>
+ y=A0+A3*sin(pi*(x-A1)/A2)<br>
+ where: A0: Baseline offset; A1: Center; A2: Width; A3: Amplitude.<br>
+<i>Sine Square: </i><br>
+ y=A0+A3*sin(pi*(x-A1)/A2)^2<br>
+ where: A0: Baseline offset; A1: Center; A2: Width; A3: Amplitude.<br>
+<i>Sine damp: </i><br>
+ y=A0+A3*exp(-x/A4)*sin(pi*(x-A1)/A2)<br>
+ where: A0: Baseline offset; A1: Center; A2: Width; A3: Amplitude; A4: Decay time. <br>
+</P>
+
+<br>
+<P><i>Baseline Functions</i><br>
+<i>Exponential Decay 1:</i><br>
+ y=A0+A3*exp(-(x-A1)/A2)<br>
+<b>Exponential Decay 2:</b> <br>
+ y=A0+A3*exp(-(x-A1)/A2)+A6*exp(-(x-A4)/A5);<br>
+<i>Exponential Growth 1:</i> <br>
+ y=A0+A3*exp((x-A1)/A2)<br>
+<i>Exponential Growth 2: </i><br>
+ y=A0+A3*exp(-(x-A1)/A2)+A6*exp((x-A4)/A5);<br>
+<i>Hyperbolic:</i><br>
+ y=A0+(A1*x)/(A2+x)<br>
+<i>Bradley:</i> <br>
+ y=A0*ln(-A1*ln(x))<br>
+<i>Logarithm 3 Parameters: </i><br>
+ y=A0-A1*ln(x+A2)<br>
+</P>
+
<H3><A NAME="correlation/covariance"></A> Correlation/covariance </H3>
<P>This popup can be used to compute autocorrelation
diff -Nru grace-5.1.22.orig/src/draw.c grace-5.1.22/src/draw.c
--- grace-5.1.22.orig/src/draw.c 2005-11-19 13:53:24.000000000 -0800
+++ grace-5.1.22/src/draw.c 2010-03-17 11:25:06.872982387 -0700
@@ -258,6 +258,12 @@
return (vp);
}
+WPoint Vpoint2Wpoint(VPoint vp)
+{
+ WPoint wp;
+ view2world(vp.x, vp.y, &wp.x, &wp.y);
+ return (wp);
+}
void symplus(VPoint vp, double s)
{
diff -Nru grace-5.1.22.orig/src/draw.h grace-5.1.22/src/draw.h
--- grace-5.1.22.orig/src/draw.h 2004-07-03 13:47:45.000000000 -0700
+++ grace-5.1.22/src/draw.h 2010-03-17 11:25:06.872982387 -0700
@@ -236,6 +236,7 @@
double xy_xconv(double wx);
double xy_yconv(double wy);
VPoint Wpoint2Vpoint(WPoint wp);
+WPoint Vpoint2Wpoint(VPoint vp);
int world2view(double x, double y, double *xv, double *yv);
void view2world(double xv, double yv, double *xw, double *yw);
diff -Nru grace-5.1.22.orig/src/events.c grace-5.1.22/src/events.c
--- grace-5.1.22.orig/src/events.c 2008-04-26 12:12:11.000000000 -0700
+++ grace-5.1.22/src/events.c 2010-03-17 11:25:06.872982387 -0700
@@ -487,6 +487,13 @@
}
select_line(anchor_x, anchor_y, x, y, 0);
break;
+ case PEAK_POS:
+ anchor_point(x, y, vp);
+ nonl_parms[1].value = Vpoint2Wpoint(vp).x;
+ nonl_parms[3].value = Vpoint2Wpoint(vp).y;
+ set_actioncb(NULL);
+ update_nonl_frame();
+ break;
default:
break;
}
@@ -760,6 +767,10 @@
set_cursor(0);
set_left_footer("Pick ending point");
break;
+ case PEAK_POS:
+ set_cursor(0);
+ set_left_footer("Click on the approximate position of the maximum of the peak");
+ break;
}
action_flag = act;
diff -Nru grace-5.1.22.orig/src/events.h grace-5.1.22/src/events.h
--- grace-5.1.22.orig/src/events.h 2004-07-03 13:47:45.000000000 -0700
+++ grace-5.1.22/src/events.h 2010-03-17 11:25:06.872982387 -0700
@@ -81,7 +81,8 @@
ZOOMY_1ST,
ZOOMY_2ND,
DISLINE1ST,
- DISLINE2ND
+ DISLINE2ND,
+ PEAK_POS
} CanvasAction;
/* add points at */
diff -Nru grace-5.1.22.orig/src/nonlwin.c grace-5.1.22/src/nonlwin.c
--- grace-5.1.22.orig/src/nonlwin.c 2006-05-17 13:53:13.000000000 -0700
+++ grace-5.1.22/src/nonlwin.c 2010-03-17 11:35:39.048972353 -0700
@@ -7,6 +7,7 @@
* Copyright (c) 1996-2000 Grace Development Team
*
* Maintained by Evgeny Stambulchik
+ * Additional non linear fitting functions by Nicola Ferralis
*
*
* All Rights Reserved
@@ -47,6 +48,7 @@
#include "parser.h"
#include "motifinc.h"
#include "protos.h"
+#include "events.h"
/* nonlprefs.load possible values */
#define LOAD_VALUES 0
@@ -98,6 +100,31 @@
static void nonl_wf_cb(int value, void *data);
static void do_constr_toggle(int onoff, void *data);
+static void nonl_Lorentzian_cb(void *data);
+static void nonl_doubleLorentzian_cb(void *data);
+static void nonl_tripleLorentzian_cb(void *data);
+static void nonl_Gaussian_cb(void *data);
+static void nonl_doubleGaussian_cb(void *data);
+static void nonl_tripleGaussian_cb(void *data);
+static void nonl_Gaussian2_cb(void *data);
+static void nonl_PsVoight1_cb(void *data);
+static void nonl_PsVoight2_cb(void *data);
+static void nonl_Asym2Sig_cb(void *data);
+static void nonl_LogNormal_cb(void *data);
+static void nonl_GCAS_cb(void *data);
+static void nonl_ECS_cb(void *data);
+static void nonl_InvPoly_cb(void *data);
+static void nonl_Sine_cb(void *data);
+static void nonl_Sinesq_cb(void *data);
+static void nonl_Sinedamp_cb(void *data);
+static void nonl_ExpDec1_cb(void *data);
+static void nonl_ExpDec2_cb(void *data);
+static void nonl_ExpGrow1_cb(void *data);
+static void nonl_ExpGrow2_cb(void *data);
+static void nonl_Hyperbol_cb(void *data);
+static void nonl_Bradley_cb(void *data);
+static void nonl_Log3_cb(void *data);
+
static void update_nonl_frame_cb(void *data);
static void reset_nonl_frame_cb(void *data);
@@ -118,7 +145,7 @@
if (nonl_frame == NULL) {
int i;
OptionItem np_option_items[MAXPARM + 1], option_items[5];
- Widget menubar, menupane;
+ Widget menubar, menupane, submenugauss, submenulorentz, submenupeak, submenubaseline, submenuperiodic;
Widget nonl_tab, nonl_main, nonl_advanced;
Widget sw, title_fr, fr3, rc1, rc2, rc3, lab;
@@ -145,6 +172,50 @@
CreateMenuSeparator(menupane);
CreateMenuButton(menupane, "Update", 'U', update_nonl_frame_cb, NULL);
+ menupane = CreateMenu(menubar, "Library", 'L', FALSE);
+
+ submenugauss = CreateMenu(menupane, "Gaussian Functions", 'G', FALSE);
+ CreateMenuButton(submenugauss, "Single", 's', nonl_Gaussian_cb, NULL);
+ CreateMenuButton(submenugauss, "Double", 'D', nonl_doubleGaussian_cb, NULL);
+ CreateMenuButton(submenugauss, "Triple", 'T', nonl_tripleGaussian_cb, NULL);
+ CreateMenuSeparator(submenugauss);
+ CreateMenuButton(submenugauss, "Single (chromatography)", 'c', nonl_Gaussian2_cb, NULL);
+ CreateMenuSeparator(menupane);
+
+ submenulorentz = CreateMenu(menupane, "Lorentzian Functions", 'L', FALSE);
+ CreateMenuButton(submenulorentz, "Single", 'S', nonl_Lorentzian_cb, NULL);
+ CreateMenuButton(submenulorentz, "Double", 'D', nonl_doubleLorentzian_cb, NULL);
+ CreateMenuButton(submenulorentz, "Triple", 'T', nonl_tripleLorentzian_cb, NULL);
+ CreateMenuSeparator(menupane);
+
+ submenupeak = CreateMenu(menupane, "Peak Functions", 'P', FALSE);
+ CreateMenuButton(submenupeak, "Pseudo Voigt 1", 'V', nonl_PsVoight1_cb, NULL);
+ CreateMenuButton(submenupeak, "Pseudo Voigt 2", 'V', nonl_PsVoight2_cb, NULL);
+ CreateMenuButton(submenupeak, "Asymmetric Double Sigmoidal", 'S', nonl_Asym2Sig_cb, NULL);
+ CreateMenuButton(submenupeak, "LogNormal", 'L', nonl_LogNormal_cb, NULL);
+ CreateMenuButton(submenupeak, "Gram-Charlier A-Series", 'C', nonl_GCAS_cb, NULL);
+ CreateMenuButton(submenupeak, "Edgeworth-Cramer Series", 'E', nonl_ECS_cb, NULL);
+ CreateMenuButton(submenupeak, "Inverse Polynomial", 'I', nonl_InvPoly_cb, NULL);
+ CreateMenuSeparator(menupane);
+
+ submenuperiodic = CreateMenu(menupane, "Periodic Peak Functions", 'p', FALSE);
+ CreateMenuButton(submenuperiodic, "Sine", 'S', nonl_Sine_cb, NULL);
+ CreateMenuButton(submenuperiodic, "Sine Square", 'q', nonl_Sinesq_cb, NULL);
+ CreateMenuButton(submenuperiodic, "Sine Damp", 'D', nonl_Sinedamp_cb, NULL);
+ CreateMenuSeparator(menupane);
+
+ submenubaseline = CreateMenu(menupane, "Baseline Functions", 'B', FALSE);
+ CreateMenuButton(submenubaseline, "Exponential Decay 1", 'D', nonl_ExpDec1_cb, NULL);
+ CreateMenuButton(submenubaseline, "Exponential Decay 2", 'e', nonl_ExpDec2_cb, NULL);
+ CreateMenuButton(submenubaseline, "Exponential Growth 1", 'G', nonl_ExpGrow1_cb, NULL);
+ CreateMenuButton(submenubaseline, "Exponential Growth 2", 'r', nonl_ExpGrow2_cb, NULL);
+ CreateMenuButton(submenubaseline, "Hyperbolic Function", 'H', nonl_Hyperbol_cb, NULL);
+ CreateMenuSeparator(submenubaseline);
+ CreateMenuButton(submenubaseline, "Bradley", 'B', nonl_Bradley_cb, NULL);
+ CreateMenuButton(submenubaseline, "Logarithm 3", 'L', nonl_Log3_cb, NULL);
+ CreateMenuSeparator(menupane);
+
+ CreateMenuButton(menupane, "Reset fit parameters", 'R', reset_nonl_frame_cb, NULL);
menupane = CreateMenu(menubar, "Help", 'H', TRUE);
CreateMenuHelpButton(menupane, "On fit", 'f',
@@ -712,3 +783,288 @@
}
return TRUE;
}
+
+
+static void nonl_Lorentzian_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Lorentzian function");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y = A0 + (2*A2*A3/pi)/(4*(x-A1)^2 + A2^2)");
+ nonl_opts.parnum = 4;
+
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+
+ sprintf(buf, "A0: Baseline offset\nA1: Center of the peak\nA2: Full width at half maximum\nA3: Peak area\n");
+ stufftext(buf);
+
+ set_actioncb( (void *) PEAK_POS);
+ update_nonl_frame();
+}
+
+static void nonl_doubleLorentzian_cb(void *data)
+{
+ nonl_opts.title = copy_string(nonl_opts.title, "Double Lorentzian function");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y = A0 + (2*A2*A3/pi)/(4*(x-A1)^2 + A2^2) + (2*A5*A6/pi)/(4*(x-A4)^2 + A5^2)");
+ nonl_opts.parnum = 7;
+ sprintf(buf, "A0: Baseline offset\nA1, A4: Center of peaks 1, 2\nA2, A5: Full width at half maximum of peaks 1, 2\nA3, A6: Area of peaks 1, 2\n\n");
+ stufftext(buf);
+ update_nonl_frame();
+}
+
+static void nonl_tripleLorentzian_cb(void *data)
+{
+ nonl_opts.title = copy_string(nonl_opts.title, "Double Lorentzian function");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y = A0 + (2*A2*A3/pi)/(4*(x-A1)^2 + A2^2) + (2*A5*A6/pi)/(4*(x-A4)^2 + A5^2) + (2*A8*A9/pi)/(4*(x-A7)^2 + A8^2)");
+ nonl_opts.parnum = 10;
+ sprintf(buf, "A0: Baseline offset\nA1, A4, A7: Center of peaks 1, 2, 3\nA2, A5, A7: Full width at half maximum of peaks 1, 2, 3\nA3, A6, A9: Area of peaks 1, 2, 3\n\n");
+ stufftext(buf);
+ update_nonl_frame();
+}
+
+static void nonl_Gaussian_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Gaussian function");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y = A0 + (A3*2*sqrt(ln(2)/pi)/A2)*exp(-4*ln(2)*((x-A1)/A2)^2)");
+ nonl_opts.parnum = 4;
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+ sprintf(buf, "A0: Baseline offset\nA1: Center of the peak\nA2: Full width at half maximum\nA3: Peak area\n");
+ stufftext(buf);
+ set_actioncb( (void *) PEAK_POS);
+ update_nonl_frame();
+}
+
+static void nonl_doubleGaussian_cb(void *data)
+{
+ nonl_opts.title = copy_string(nonl_opts.title, "Double Gaussian function");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y = A0 + (A3*2*sqrt(ln(2)/pi)/A2)*exp(-4*ln(2)*((x-A1)/A2)^2) + (A6*2*sqrt(ln(2)/pi)/A5)*exp(-4*ln(2)*((x-A4)/A5)^2)");
+ nonl_opts.parnum = 7;
+ sprintf(buf, "A0: Baseline offset\nA1, A4: Center of peaks 1, 2\nA2, A5: Full width at half maximum of peaks 1, 2\nA3, A6: Area of peaks 1, 2\n");
+ stufftext(buf);
+ update_nonl_frame();
+}
+
+static void nonl_tripleGaussian_cb(void *data)
+{
+ nonl_opts.title = copy_string(nonl_opts.title, "Double Gaussian function");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y = A0 + (A3*2*sqrt(ln(2)/pi)/A2)*exp(-4*ln(2)*((x-A1)/A2)^2) + (A6*2*sqrt(ln(2)/pi)/A5)*exp(-4*ln(2)*((x-A4)/A5)^2)+ (A9*2*sqrt(ln(2)/pi)/A8)*exp(-4*ln(2)*((x-A7)/A8)^2)");
+ nonl_opts.parnum = 10;
+ sprintf(buf, "A0: Baseline offset\nA1, A4, A7: Center of peaks 1, 2, 3\nA2, A5, A8: Full width at half maximum of peaks 1, 2, 3\nA3, A6, A9: Area of peaks 1, 2, 3\n");
+ stufftext(buf);
+ update_nonl_frame();
+}
+
+static void nonl_Gaussian2_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Gaussian (chromatography) function");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y = A0 + (1/sqrt(2*pi))*(A3/A2)*exp(-(x-A1)^2/2*A2^2)");
+ nonl_opts.parnum = 4;
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+ sprintf(buf, "A0: Baseline offset\nA1: Center of the peak (retention time)\nA2: Standard deviation of the peak\nA3: Peak area\n");
+ stufftext(buf);
+ set_actioncb( (void *) PEAK_POS);
+ update_nonl_frame();
+}
+
+static void nonl_PsVoight1_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Pseudo Voigt 1 function");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y = A0 + A3 * (A4*(2/pi)*A2/(4*(x-A1)^2+A2^2) + (1-A4)*exp(-4*ln(2)*(x-A1)^2/A2^2)*(sqrt(4*ln(2))/(A2*sqrt(pi))))");
+ nonl_opts.parnum = 5;
+ for (i=0; i<nonl_opts.parnum-1; i++)
+ {nonl_parms[i].value=1;}
+ nonl_parms[4].value=0.5;
+ sprintf(buf, "Gaussian and Lorentzian have the same width\nA0: Baseline offset\nA1: Center of the peak\nA2: Full width at half maximum\nA3: Amplitude\nA4: Profile shape factor \n");
+ stufftext(buf);
+ set_actioncb( (void *) PEAK_POS);
+ update_nonl_frame();
+}
+
+static void nonl_PsVoight2_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Pseudo Voigt 2 function");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y = A0 + A3 * (A5*(2/pi)*A2/(4*(x-A1)^2+A2^2) + (1-A5)*exp(-4*ln(2)*(x-A1)^2/A4^2)*(sqrt(4*ln(2))/(A2*sqrt(pi))))");
+ nonl_opts.parnum = 6;
+ for (i=0; i<nonl_opts.parnum-1; i++)
+ {nonl_parms[i].value=1;}
+ nonl_parms[5].value=0.5;
+ sprintf(buf, "Gaussian and Lorentzian have different width\nA0: Baseline offset\nA1: Center of the peak\nA2: Full width at half maximum (Lorentzian)\nA3: Amplitude\nA4: Full width at half maximum (Gaussian) \nA5: Profile shape factor \n");
+ stufftext(buf);
+ set_actioncb( (void *) PEAK_POS);
+ update_nonl_frame();
+}
+
+static void nonl_Asym2Sig_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Asymmetric double sigmoidal function");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y = A0 + A3*(1/(1+exp(-(x-A1+A2/2)/A4)))*(1-(1/(1+exp(-(x-A1-A2/2)/A5))))");
+ nonl_opts.parnum = 6;
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+ sprintf(buf, "A0: Baseline offset\nA1: Center of the peak\nA2: Width 1\nA3: Amplitude\nA4: Width 2\nA5: Width 5 \n");
+ stufftext(buf);
+ set_actioncb( (void *) PEAK_POS);
+ update_nonl_frame();
+}
+
+static void nonl_LogNormal_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Log Normal Function");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y = A0 + A3*exp(-((ln(x)-ln(A1))^2)/(2*A2))");
+ nonl_opts.parnum = 4;
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+ sprintf(buf, "A0: Baseline offset\nA1: Center of the peak\nA2: Width\nA3: Amplitude\n");
+ stufftext(buf);
+ set_actioncb( (void *) PEAK_POS);
+ update_nonl_frame();
+}
+
+static void nonl_GCAS_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Gram-Charlier A-Series");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y = A0 + A3/(A2*sqrt(2*pi))*exp(-0.5*((x-A1)/A2)^2)*(1+(A4/6)*(((x-A1)/A2)^3-3*(x-A1)/A2)+(A5/24)*(((x-A1)/A2)^4-6*((x-A1)/A2)^3+3))");
+ nonl_opts.parnum = 5;
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+ sprintf(buf, "A0: Baseline offset\nA1: Center of the peak\nA2: Standard deviation\nA3: Peak Area\nA4: Skew\nA5: Excess\n");
+ stufftext(buf);
+ set_actioncb( (void *) PEAK_POS);
+ update_nonl_frame();
+}
+
+static void nonl_ECS_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Edgeworth-Cramer Series");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y = A0 + A3/(A2*sqrt(2*pi))*exp(-0.5*((x-A1)/A2)^2)*(1+(A4/6)*(((x-A1)/A2)^3-3*(x-A1)/A2)+(A5/24)*(((x-A1)/A2)^4-6*((x-A1)/A2)^3+3) + (A5^2/720)*(((x-A1)/A2)^6-15*((x-A1)/A2)^4+45*((x-A1)/A2)^2-15))");
+ nonl_opts.parnum = 5;
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+ sprintf(buf, "A0: Baseline offset\nA1: Center of the peak\nA2: Standard deviation\nA3: Peak Area\nA4: Skew\nA5: Excess\n");
+ stufftext(buf);
+ set_actioncb( (void *) PEAK_POS);
+ update_nonl_frame();
+}
+
+static void nonl_InvPoly_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Inverse Polynomial Function");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y=A0+A3/(1+ A4*(2*(x-A1)/A2)^2 + A5*(2*(x-A1)/A2)^4 + A6*(2*(x-A1)/A2)^6)");
+ nonl_opts.parnum = 7;
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+ sprintf(buf, "A0: Baseline offset\nA1: Center of the peak\nA2: Standard deviation\nA3: Peak Area\nA4, A5, A6: Parameters\n");
+ stufftext(buf);
+ set_actioncb( (void *) PEAK_POS);
+ update_nonl_frame();
+}
+
+static void nonl_Sine_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Sine Function");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y=A0+A3*sin(pi*(x-A1)/A2)");
+ nonl_opts.parnum = 4;
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+ sprintf(buf, "A0: Baseline offset\nA1: Center\nA2: Width\nA3: Amplitude\n");
+ stufftext(buf);
+ set_actioncb( (void *) PEAK_POS);
+ update_nonl_frame();
+}
+
+static void nonl_Sinesq_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Sine Function");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y=A0+A3*(sin(pi*(x-A1)/A2))^2");
+ nonl_opts.parnum = 4;
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+ sprintf(buf, "A0: Baseline offset\nA1: Center\nA2: Width\nA3: Amplitude\n");
+ stufftext(buf);
+ set_actioncb( (void *) PEAK_POS);
+ update_nonl_frame();
+}
+
+static void nonl_Sinedamp_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Sine Function");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y=A0+A3*exp(-x/A4)*sin(pi*(x-A1)/A2)");
+ nonl_opts.parnum = 5;
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+ sprintf(buf, "A0: Baseline offset\nA1: Center\nA2: Width\nA3: Amplitude\nA4: Decay time\n");
+ stufftext(buf);
+ set_actioncb( (void *) PEAK_POS);
+ update_nonl_frame();
+}
+
+static void nonl_ExpDec1_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Exponential Decay 1");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y=A0+A3*exp(-(x-A1)/A2)");
+ nonl_opts.parnum = 4;
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+ update_nonl_frame();
+}
+
+static void nonl_ExpDec2_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Exponential Decay 2");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y=A0+A3*exp(-(x-A1)/A2)+A6*exp(-(x-A4)/A5)");
+ nonl_opts.parnum = 7;
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+ update_nonl_frame();
+}
+
+static void nonl_ExpGrow1_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Exponential Growth 1");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y=A0+A3*exp((x-A1)/A2)");
+ nonl_opts.parnum = 4;
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+ update_nonl_frame();
+}
+
+static void nonl_ExpGrow2_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Exponential Growth 2");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y=A0+A3*exp((x-A1)/A2)+A6*exp((x-A4)/A5)");
+ nonl_opts.parnum = 7;
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+ update_nonl_frame();
+}
+
+static void nonl_Hyperbol_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Hyperbolic");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y=A0+(A1*x)/(A2+x)");
+ nonl_opts.parnum = 3;
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+ update_nonl_frame();
+}
+
+static void nonl_Bradley_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Bradley");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y=A0*ln(-A1*ln(x))");
+ nonl_opts.parnum = 2;
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+ update_nonl_frame();
+}
+
+static void nonl_Log3_cb(void *data)
+{ int i;
+ nonl_opts.title = copy_string(nonl_opts.title, "Logarithm 3");
+ nonl_opts.formula = copy_string(nonl_opts.formula, "y=A0-A1*ln(x+A2)");
+ nonl_opts.parnum = 3;
+ for (i=0; i<nonl_opts.parnum; i++)
+ {nonl_parms[i].value=1;}
+ update_nonl_frame();
+}