This page was created by the IDL library routine
mk_html_help
. For more information on
this routine, refer to the IDL Online Help Navigator
or type:
? mk_html_help
at the IDL command line prompt.
Last modified: Tue Dec 20 11:48:26 2005.
NAME: GCURV -- Calculate multiple (N) Gaussians + offset. PURPOSE: Calculate multiple (N) Gaussians + offset. CALLING SEQUENCE: GCURV, xdata, zro1, hgt1, cen1, wid1, tfit INPUTS: xdata: the x-values at which the data points exist. zro1: the estimated constant zero offset of the data points. hgt1: the array of N estimated heights of the Gaussians. cen1: the array of N estimated centers of the Gaussians. wid1: the array of N estimated halfwidths of the Gaussians. OUTPUTS: tfit: the calculated points. EXAMPLE: You have two Gaussians. The heights are hgt1=[1.5, 2.5], the centers cen1=[12., 20.], and the widths are wid1=[5., 6.]. There are 100 values of x (xdata). GCURV, xdata, zro1, hgt1, cen1, wid1, tfit RELATED PROCEDURES: GFIT HISTORY: Written by Carl Heiles. 21 Mar 1998.
(See /dzd2/heiles/idl/gen/gaussians/gcurv.pro)
NAME: GCURV2D PURPOSE: Calculate multiple (N) Gaussians + offset. CALLING SEQUENCE: GCURV2D, xdata, ydata, zro1, hgt1, cenx1, ceny1, wid1, tfit INPUTS: xdata: the x-values at which the data points exist. ydata: the y-values at which the data points exist. zro1: the estimated constant zero offset of the data points. hgt1: the array of N estimated heights of the Gaussians. cenx1: the array of N estimated x-centers of the Gaussians. ceny1: the array of N estimated y-centers of the Gaussians. wid1: the array of N estimated halfwidths of the Gaussians. OUTPUTS: tfit: the calculated points. EXAMPLE: You have two Gaussians. The heights are hgt1=[1.5, 2.5], the centers cen1=[12., 20.], and the widths are wid1=[5., 6.]. There are 100 values of x (xdata). GCURV, xdata, zro1, hgt1, cen1, wid1, tfit RELATED PROCEDURES: GFIT2D HISTORY: GCURV Written by Carl Heiles. 21 Mar 1998. Upgraded to 2D by Paul Demorest 6 jan 2003
(See /dzd2/heiles/idl/gen/gaussians/gcurv2d.pro)
NAME: GCURVSLOPE -- Calculate multiple (N) Gaussians + offset + SLOPE PURPOSE: Calculate multiple (N) Gaussians + offset + SLOPE CALLING SEQUENCE: GCURV, xdata, zro1, slp1, hgt1, cen1, wid1, tfit INPUTS: xdata: the x-values at which the data points exist. zro1: the zero offset of the data points. slp1: the slope. hgt1: the array of N estimated heights of the Gaussians. cen1: the array of N estimated centers of the Gaussians. wid1: the array of N estimated halfwidths of the Gaussians. OUTPUTS: tfit: the calculated points. EXAMPLE: You have two Gaussians. The heights are hgt1=[1.5, 2.5], the centers cen1=[12., 20.], and the widths are wid1=[5., 6.]. There are 100 values of x (xdata). GCURV, xdata, zro1, slp1, hgt1, cen1, wid1, tfit RELATED PROCEDURES: GFITSLOPE HISTORY: Written by Carl Heiles. 21 Mar 1998.
(See /dzd2/heiles/idl/gen/gaussians/gcurvslope.pro)
NAME: GFIT -- Fit multiple (N) Gaussians + an offset to a one-d array of data points PURPOSE: Fit multiple (N) Gaussians to a one-d array of data points CALLING SEQUENCE: GFIT, look, xdata, tdata, zro0, hgt0, cen0, wid0, tfit, sigma, zro1, hgt1, cen1, wid1, sigzro1, sighgt1, sigcen1, sigwid1, problem, cov INPUTS: look: if >=0, plots the iteratited values for the Gaussian whose number is equal to look. Then it prompts you to plot a different Gaussian number. xdata: the x-values at which the data points exist. tdata: the data points. zro0: the estimated constant zero offset of the data points. hgt0: the array of N estimated heights of the Gaussians. cen0: the array of N estimated centers of the Gaussians. wid0: the array of N estimated halfwidths of the Gaussians. OUTPUTS: tfit: the fitted values of the data at the points in xdata. sigma: the rms of the residuals. zro1: the fitted zero offset. hgt1: the array of N fitted heights. cen1: the array of N fitted centers. wid1: the array of N fitted half-power widths. sigzro1: the 'error of the mean' of the fitted zero offset. sighgt1: the array of errors of the N fitted heights. sigcen1: the array of errors of the N fitted centers. sigwid1: the array of errors of the N fitted widths. problem: 0, OK; -1, excessive width; -2, >50 loops; -3, negative sigmas, ; 4, bad derived values. cov: the normalized covariance matrix of the fitted coefficients. RESTRICTIONS: The data and x values NO LONGER NEED be in asympototic x order, either increasing or decreasing. Gaussians are not an orthogonal set of functions! This doesn't matter for many cases; convergence is unique UNLESS... Convergence is NOT unique when Gaussians are close together or when multiple Gaussians lie within a single peak. In these cases, you can get different outputs from different inputs. And sometimes in these cases the fits will not converge! This procedure uses the classical nonlinear least squares technique, which utilizes analytically-calculated derivatives, to iteratively solve for the least squares coefficients. Some criteria on the parameters used to update the iterated coefficients are used to make the fit more stable (and more time-consuming). The number of iterations is limited to 50; if you need more, enter the routing again, using the output parameters as input for the next attampt. EXAMPLE: You have two Gaussians that are well-separated. This counts as an easy case; for the estimated parameters, you need not be accurate at all. The heights are hgt0=[1.5, 2.5], the centers cen0=[12., 20.], and the widths are [5., 6.]. There are 100 data points (tdata) at 100 values of x (xdata). You don't wish to see plots of the iterations, you don't care about the uncertainties, but you want the fitted points and also the rms of the residuals. gfit, look, xdata, tdata, zro0, hgt0, cen0, wid0, tfit, sigma If you have two Gaussians that are mixed, you must be careful in your estimates! RELATED PROCEDURES: GCURV HISTORY: Written by Carl Heiles. 21 Mar 1998. Modified 16 jul 98, with 'problems' enhancement. Modified 7 apr 2002, restriction on asymptotic x removed.
(See /dzd2/heiles/idl/gen/gaussians/gfit.pro)
NAME: GFIT2D PURPOSE: Fit multiple (N) Gaussians to a 2-d array of data points CALLING SEQUENCE: GFIT2D, look, xdata, ydata, tdata, zro0, hgt0, cenx0, ceny0, wid0, tfit, sigma, zro1, hgt1, cenx1, ceny1, wid1, sigzro1, sighgt1, sigcenx1,sigceny1, sigwid1, problem, cov INPUTS: look: if >=0, plots the iteratited values for the Gaussian whose number is equal to look. Then it prompts you to plot a different Gaussian number. xdata: the x-values at which the data points exist. ydata: the y-values at which the data points exist. tdata: the data points. zro0: the estimated constant zero offset of the data points. hgt0: the array of N estimated heights of the Gaussians. cenx0: the array of N estimated x-centers of the Gaussians. ceny0: the array of N estimated y-centers of the Gaussians. wid0: the array of N estimated halfwidths of the Gaussians. OUTPUTS: tfit: the fitted values of the data at the points in xdata. sigma: the rms of the residuals. zro1: the fitted zero offset. hgt1: the array of N fitted heights. cenx1: the array of N fitted x-centers. ceny1: the array of N fitted y-centers. wid1: the array of N fitted half-power widths. sigzro1: the 'error of the mean' of the fitted zero offset. sighgt1: the array of errors of the N fitted heights. sigcenx1: the array of errors of the N fitted x-centers. sigceny1: the array of errors of the N fitted y-centers. sigwid1: the array of errors of the N fitted widths. problem: 0, OK; -1, excessive width; -2, >50 loops; -3, negative sigmas, ; 4, bad derived values. cov: the normalized covariance matrix of the fitted coefficients. RESTRICTIONS: The data and x values NO LONGER NEED be in asympototic x order, either increasing or decreasing. Gaussians are not an orthogonal set of functions! This doesn't matter for many cases; convergence is unique UNLESS... Convergence is NOT unique when Gaussians are close together or when multiple Gaussians lie within a single peak. In these cases, you can get different outputs from different inputs. And sometimes in these cases the fits will not converge! This procedure uses the classical nonlinear least squares technique, which utilizes analytically-calculated derivatives, to iteratively solve for the least squares coefficients. Some criteria on the parameters used to update the iterated coefficients are used to make the fit more stable (and more time-consuming). The number of iterations is limited to 50; if you need more, enter the routing again, using the output parameters as input for the next attampt. EXAMPLE: You have two Gaussians that are well-separated. This counts as an easy case; for the estimated parameters, you need not be accurate at all. The heights are hgt0=[1.5, 2.5], the centers cen0=[12., 20.], and the widths are [5., 6.]. There are 100 data points (tdata) at 100 values of x (xdata). You don't wish to see plots of the iterations, you don't care about the uncertainties, but you want the fitted points and also the rms of the residuals. gfit, look, xdata, tdata, zro0, hgt0, cen0, wid0, tfit, sigma If you have two Gaussians that are mixed, you must be careful in your estimates! RELATED PROCEDURES: GCURV2D HISTORY: GFIT Written by Carl Heiles. 21 Mar 1998. Modified 16 jul 98, with 'problems' enhancement. Modified 7 apr 2002, restriction on asymptotic x removed. Upgraded to 2D by Paul Demorest 6 jan 2003.
(See /dzd2/heiles/idl/gen/gaussians/gfit2d.pro)
NAME: GFITCFIX PURPOSE: Fit multiple (N) Gaussians to a one-d array of data points; THIS VERSION KEEPS THE CENTER FIXED but **DOES** FIT THE ZERO OFFSET. CALLING SEQUENCE: GFITCFIX, look, xdata, tdata, zro0, hgt0, cen0, wid0, tfit, sigma, zro1, hgt1, cen1, wid1, sigzro1, sighgt1, sigcen1, sigwid1, cov INPUTS: look: if >=0, plots the iteratited values for the Gaussian whose number is equal to look. Then it prompts you to plot a different Gaussian number. xdata: the x-values at which the data points exist. tdata: the data points. zro0: the estimated zero offset of the data points. hgt0: the array of N estimated heights of the Gaussians. cen0: the array of N estimated centers of the Gaussians. wid0: the array of N estimated halfwidths of the Gaussians. OUTPUTS: tfit: the fitted values of the data at the points in xdata. sigma: the rms of the residuals. zro1: the fitted zero offset. hgt1: the array of N fitted heights. cen1: the array of N fitted centers. wid1: the array of N fitted half-power widths. sigzro1: the error in the fitted zero offset. sighgt1: the array of errors of the N fitted heights. sigcen1: the array of errors of the N fitted centers. sigwid1: the array of errors of the N fitted widths. cov: the normalized covariance matrix of the fitted coefficients. RESTRICTIONS: The data and x values should be in asympototic x order, either increasing or decreasing. Gaussians are not an orthogonal set of functions! This doesn't matter for many cases; convergence is unique UNLESS... Convergence is NOT unique when Gaussians are close together or when multiple Gaussians lie within a single peak. In these cases, you can get different outputs from different inputs. And sometimes in these cases the fits will not converge! This procedure uses the classical nonlinear least squares technique, which utilizes analytically-calculated derivatives, to iteratively solve for the least squares coefficients. Some criteria on the parameters used to update the iterated coefficients are used to make the fit more stable (and more time-consuming). The number of iterations is limited to 50; if you need more, enter the routing again, using the output parameters as input for the next attampt. EXAMPLE: You have two Gaussians that are well-separated. This counts as an easy case; for the estimated parameters, you need not be accurate at all. The heights are hgt0=[1.5, 2.5], the centers cen0=[12., 20.], and the widths are [5., 6.]. There are 100 data points (tdata) at 100 values of x (xdata). You don't wish to see plots of the iterations, you don't care about the uncertainties, but you want the fitted points and also the rms of the residuals. gfit, look, xdata, tdata, zro0, hgt0, cen0, wid0, tfit, sigma If you have two Gaussians that are mixed, you must be careful in your estimates! RELATED PROCEDURES: GCURV HISTORY: Written by Carl Heiles. 21 Mar 1998.
(See /dzd2/heiles/idl/gen/gaussians/gfitcfix.pro)
NAME: GFITCWFIX PURPOSE: Fit multiple (N) Gaussians to a one-d array of data points; THIS VERSION KEEPS THE CENTER AND THE WIDTH FIXED. CALLING SEQUENCE: GFITCWFIX, look, xdata, tdata, zro0, hgt0, cen0, wid0, tfit, sigma, zro1, hgt1, cen1, wid1, sigzro1, sighgt1, sigcen1, sigwid1, cov INPUTS: look: if >=0, plots the iteratited values for the Gaussian whose number is equal to look. Then it prompts you to plot a different Gaussian number. xdata: the x-values at which the data points exist. tdata: the data points. zro0: the estimated zero offset of the data points. hgt0: the array of N estimated heights of the Gaussians. cen0: the array of N estimated centers of the Gaussians. wid0: the array of N estimated halfwidths of the Gaussians. BECAUSE THIS IS NOT A NONLINEAR FIT, THE NUMERICAL VALUES OF THE ABOVE DON'T MATTER AT ALL... OUTPUTS: tfit: the fitted values of the data at the points in xdata. sigma: the rms of the residuals. zro1: the fitted zero offset. hgt1: the array of N fitted heights. cen1: the array of centers--equal to cen0. wid1: the array of widths--equal to wid0. sigzro1: the error in the fitted zero offset. sighgt1: the array of errors of the N fitted heights. sigcen1: meaningless--equal to 0. sigwid1: meaningless--equal to 0. cov: the normalized covariance matrix of the fitted coefficients. RESTRICTIONS: none--this is not a nonlinear fit, so no iterations are required. EXAMPLE: You have two Gaussians whose centers, widths are known. you think that The heights are hgt0=[1.5, 2.5], the centers cen0=[12., 20.], and the widths are [5., 6.]. There are 100 data points (tdata) at 100 values of x (xdata). gfitcwfix, look, xdata, tdata, zro0, hgt0, cen0, wid0, tfit, sigma If you have two Gaussians that are mixed, you must be careful in your estimates! RELATED PROCEDURES: GCURV HISTORY: Written by Carl Heiles. 21 Mar 1998.
(See /dzd2/heiles/idl/gen/gaussians/gfitcwfix.pro)
NAME: GFITCWZFIX PURPOSE: Fit multiple (N) Gaussians to a one-d array of data points; THIS VERSION KEEPS THE CENTER, WIDTH, and ZERO POINT FIXED. CALLING SEQUENCE: GFITCWZFIX, look, xdata, tdata, zro0, hgt0, cen0, wid0, tfit, sigma, zro1, hgt1, cen1, wid1, sigzro1, sighgt1, sigcen1, sigwid1, cov INPUTS: look: if >=0, plots the iteratited values for the Gaussian whose number is equal to look. Then it prompts you to plot a different Gaussian number. xdata: the x-values at which the data points exist. tdata: the data points. zro0: the zero offset of the data points. hgt0: the array of N estimated heights of the Gaussians. cen0: the array of N estimated centers of the Gaussians. wid0: the array of N estimated halfwidths of the Gaussians. BECAUSE THIS IS NOT A NONLINEAR FIT, THE NUMERICAL VALUES OF THE ABOVE DON'T MATTER AT ALL... OUTPUTS: tfit: the fitted values of the data at the points in xdata. sigma: the rms of the residuals. zro1: the zero offset, equal to zro0. hgt1: the array of N fitted heights. cen1: the array of centers--equal to cen0. wid1: the array of widths--equal to wid0. sigzro1: meaningless--equal to 0. sighgt1: the array of errors of the N fitted heights. sigcen1: meaningless--equal to 0. sigwid1: meaningless--equal to 0. cov: the normalized covariance matrix of the fitted coefficients. RESTRICTIONS: none--this is not a nonlinear fit, so no iterations are required. EXAMPLE: You have two Gaussians whose centers, widths are known. you think that The heights are hgt0=[1.5, 2.5], the centers cen0=[12., 20.], and the widths are [5., 6.]. There are 100 data points (tdata) at 100 values of x (xdata). gfitcwfix, look, xdata, tdata, zro0, hgt0, cen0, wid0, tfit, sigma If you have two Gaussians that are mixed, you must be careful in your estimates! RELATED PROCEDURES: GCURV HISTORY: Written by Carl Heiles. 21 Mar 1998.
(See /dzd2/heiles/idl/gen/gaussians/gfitcwzfix.pro)
NAME: GFITCZFIX PURPOSE: Fit multiple (N) Gaussians to a one-d array of data points; THIS VERSION KEEPS THE CENTER FIXED AND ALSO THE ZERO OFFSET FIXED. CALLING SEQUENCE: GFITCZFIX, look, xdata, tdata, zro0, hgt0, cen0, wid0, tfit, sigma, zro1, hgt1, cen1, wid1, sigzro1, sighgt1, sigcen1, sigwid1, cov INPUTS: look: if >=0, plots the iteratited values for the Gaussian whose number is equal to look. Then it prompts you to plot a different Gaussian number. xdata: the x-values at which the data points exist. tdata: the data points. zro0: the zero offset of the data points. hgt0: the array of N estimated heights of the Gaussians. cen0: the array of N estimated centers of the Gaussians. wid0: the array of N estimated halfwidths of the Gaussians. OUTPUTS: tfit: the fitted values of the data at the points in xdata. sigma: the rms of the residuals. zro1: equal to zro0, the inputted zero offset. hgt1: the array of N fitted heights. cen1: the array of N fitted centers. wid1: the array of N fitted half-power widths. sigzro1: meaningless. Set equal to zero. sighgt1: the array of errors of the N fitted heights. sigcen1: the array of errors of the N fitted centers. sigwid1: the array of errors of the N fitted widths. cov: the normalized covariance matrix of the fitted coefficients. RESTRICTIONS: The data and x values should be in asympototic x order, either increasing or decreasing. Gaussians are not an orthogonal set of functions! This doesn't matter for many cases; convergence is unique UNLESS... Convergence is NOT unique when Gaussians are close together or when multiple Gaussians lie within a single peak. In these cases, you can get different outputs from different inputs. And sometimes in these cases the fits will not converge! This procedure uses the classical nonlinear least squares technique, which utilizes analytically-calculated derivatives, to iteratively solve for the least squares coefficients. Some criteria on the parameters used to update the iterated coefficients are used to make the fit more stable (and more time-consuming). The number of iterations is limited to 50; if you need more, enter the routing again, using the output parameters as input for the next attampt. EXAMPLE: You have two Gaussians that are well-separated. This counts as an easy case; for the estimated parameters, you need not be accurate at all. The heights are hgt0=[1.5, 2.5], the centers cen0=[12., 20.], and the widths are [5., 6.]. There are 100 data points (tdata) at 100 values of x (xdata). You don't wish to see plots of the iterations, you don't care about the uncertainties, but you want the fitted points and also the rms of the residuals. gfit, look, xdata, tdata, zro0, hgt0, cen0, wid0, tfit, sigma If you have two Gaussians that are mixed, you must be careful in your estimates! RELATED PROCEDURES: GCURV HISTORY: Written by Carl Heiles. 21 Mar 1998.
(See /dzd2/heiles/idl/gen/gaussians/gfitczfix.pro)
NAME: GFITFLEX -- fit N gaussians keeping any arrbitrary set of parameters fixed PURPOSE: Fit multiple (N) Gaussians to a one-d array of data points, keeping any arbitrary set of parameters fixed and not included in the fit. CALLING SEQUENCE: GFITFLEX, look, xdata, tdata, zro0, hgt0, cen0, wid0, $ zro0yn, hgt0yn, cen0yn, wid0yn, $ tfit, sigma, zro1, hgt1, cen1, wid1, $ sigzro1, sighgt1, sigcen1, sigwid1, cov INPUTS: look: if >=0, plots the iteratited values for the Gaussian whose number is equal to look. Then it prompts you to plot a different Gaussian number. xdata: the x-values at which the data points exist. tdata: the data points. xrange: 2n-element vector: 2 values for each of n index ranges specifying which indices of tdata to include in the fit. zro0: the estimated constant zero offset of the data points. hgt0: the array of N estimated heights of the Gaussians. cen0: the array of N estimated centers of the Gaussians. wid0: the array of N estimated halfwidths of the Gaussians. zr0yn: if 0, does not fit zero level; if 1, it does. hgt0yn: array of N 0 or 1; 0 does not fit the hgt, 1 does. cen0yn: array of N 0 or 1; 0 does not fit the hgt, 1 does. wid0yn: array of N 0 or 1; 0 does not fit the hgt, 1 does. OUTPUTS: tfit: the fitted values of the data at the points in xdata. sigma: the rms of the residuals. zro1: the fitted zero offset (held constant if zro0yn=0). hgt1: the array of N fitted heights. cen1: the array of N fitted centers. wid1: the array of N fitted half-power widths. sigzro1: the error of the fitted zero offset; zero if zr0yn=0. sighgt1: the array of errors of the N fitted heights; zero if hgt0yn=0). sigcen1: the array of errors of the N fitted centers; zero if cen0yn=0). sigwid1: the array of errors of the N fitted widths; zero if wid0yn=0). problem: 0, OK; -1, excessive width; -2, >50 loops; -3, negative sigmas, ; 4, bad derived values. cov: the normalized covariance matrix of the fitted coefficients. RESTRICTIONS: The data and x values should be in asympototic x order, either increasing or decreasing. Gaussians are not an orthogonal set of functions! This doesn't matter for many cases; convergence is unique UNLESS... Convergence is NOT unique when Gaussians are close together or when multiple Gaussians lie within a single peak. In these cases, you can get different outputs from different inputs. And sometimes in these cases the fits will not converge! This procedure uses the classical nonlinear least squares technique, which utilizes analytically-calculated derivatives, to iteratively solve for the least squares coefficients. Some criteria on the parameters used to update the iterated coefficients are used to make the fit more stable (and more time-consuming). The number of iterations is limited to 50; if you need more, enter the routing again, using the output parameters as input for the next attampt. EXAMPLE: You have two Gaussians that are well-separated. This counts as an easy case; for the estimated parameters, you need not be accurate at all. The heights are hgt0=[1.5, 2.5], the centers cen0=[12., 20.], and the widths are [5., 6.]. You wish to hold the width of the second Gaussian fixed in the fit, so you set wid0yn=[1,0]. There are 100 data points (tdata) at 100 values of x (xdata) and you want to fit indices 25-75 and 77-80 only, so you set xrange=[50,75,77,80]. You don't wish to see plots of the iterations, you don't care about the uncertainties, but you want the fitted points and also the rms of the residuals. If you have two Gaussians that are mixed, you must be careful in your estimates! RELATED PROCEDURES: GCURV HISTORY: Original GFIT Written by Carl Heiles. 21 Mar 1998. FLEX options added 4 feb 00.
(See /dzd2/heiles/idl/gen/gaussians/gfitflex.pro)
NAME: GFITSLOPE -- fit n gaussians plus an offset and slope PURPOSE: Fit multiple (N) Gaussians to a one-d array of data points. ALSO FITS A ZERO OFFSET AND SLOPE. CALLING SEQUENCE: GFITSLOPE, look, xdata, tdata, zro0, slp0, hgt0, cen0, wid0, tfit, sigma, zro1, slp1, hgt1, cen1, wid1, sigzro1, sigslp1, sighgt1, sigcen1, sigwid1, problem, cov INPUTS: look: if >=0, plots the iterated values for the Gaussian whose component number is equal to look. Then it prompts you to plot a different Gaussian component number. xdata: the x-values at which the data points exist. tdata: the data points. zro0: the estimated constant zero offset of the data points. slp0: the estimated slope. hgt0: the array of N estimated heights of the Gaussians. cen0: the array of N estimated centers of the Gaussians. wid0: the array of N estimated halfwidths of the Gaussians. OUTPUTS: tfit: the fitted values of the data at the points in xdata. sigma: the rms of the residuals. zro1: the fitted zero offset slp1: the fitted slope hgt1: the array of N fitted heights. cen1: the array of N fitted centers. wid1: the array of N fitted half-power widths. sigzro1: the 'error of the mean' of the fitted zero offset. sigslp1: the 'error of the mean' of the fitted slope. sighgt1: the array of errors of the N fitted heights. sigcen1: the array of errors of the N fitted centers. sigwid1: the array of errors of the N fitted widths. problem: 0, OK; -1, excessive width; -2, >50 loops; -3, negative sigmas, ; 4, bad derived values. cov: the normalized covariance matrix of the fitted coefficients. RESTRICTIONS: The data and x values should be in asympototic x order, either increasing or decreasing. Gaussians are not an orthogonal set of functions! This doesn't matter for many cases; convergence is unique UNLESS... Convergence is NOT unique when Gaussians are close together or when multiple Gaussians lie within a single peak. In these cases, you can get different outputs from different inputs. And sometimes in these cases the fits will not converge! This procedure uses the classical nonlinear least squares technique, which utilizes analytically-calculated derivatives, to iteratively solve for the least squares coefficients. Some criteria on the parameters used to update the iterated coefficients are used to make the fit more stable (and more time-consuming). The number of iterations is limited to 50; if you need more, enter the routing again, using the output parameters as input for the next attampt. EXAMPLE: You have two Gaussians that are well-separated. This counts as an easy case; for the estimated parameters, you need not be accurate at all. The heights are hgt0=[1.5, 2.5], the centers cen0=[12., 20.], and the widths are [5., 6.]. There are 100 data points (tdata) at 100 values of x (xdata). You don't wish to see plots of the iterations, you don't care about the uncertainties, but you want the fitted points and also the rms of the residuals. gfitslope, look, xdata, tdata, zro0, slp0, hgt0, cen0, wid0, tfit, sigma If you have two Gaussians that are mixed, you must be careful in your estimates! RELATED PROCEDURES: GCURVSLOPE HISTORY: Written by Carl Heiles. 11 Jul 1998. Modified 16 jul 98, with 'problems' enhancement.
(See /dzd2/heiles/idl/gen/gaussians/gfitslope.pro)
NAME: GFITWZFIX PURPOSE: Fit multiple (N) Gaussians to a one-d array of data points. The WFIX means that the Widths are FIXED to be the values in wid0. CALLING SEQUENCE: GFIT, look, xdata, tdata, zro0, hgt0, cen0, wid0, tfit, sigma, zro1, hgt1, cen1, wid1, sigzro1, sighgt1, sigcen1, sigwid1, cov INPUTS: look: if >=0, plots the iteratited values for the Gaussian whose number is equal to look. Then it prompts you to plot a different Gaussian number. xdata: the x-values at which the data points exist. tdata: the data points. zro0: the estimated constant zero offset of the data points. hgt0: the array of N estimated heights of the Gaussians. cen0: the array of N estimated centers of the Gaussians. wid0: the array of N estimated halfwidths of the Gaussians. OUTPUTS: zro1: the array of N fitted heights. cen1: the array of N fitted centers. wid1: the array of N half-power widths; they are equal to wid0. tfit: the fitted values of the data at the points in xdata. sigma: the rms of the residuals. sigzro1: the 'error of the mean' of the fitted zero offset. sighgt1: the array of errors of the N fitted heights. sigcen1: the array of errors of the N fitted centers. sigwid1: the array of errors of the N fitted widths. cov: the normalized covariance matrix of the fitted coefficients. RESTRICTIONS: The data and x values should be in asympototic x order, either increasing or decreasing. Gaussians are not an orthogonal set of functions! This doesn't matter for many cases; convergence is unique UNLESS... Convergence is NOT unique when Gaussians are close together or when multiple Gaussians lie within a single peak. In these cases, you can get different outputs from different inputs. And sometimes in these cases the fits will not converge! This procedure uses the classical nonlinear least squares technique, which utilizes analytically-calculated derivatives, to iteratively solve for the least squares coefficients. Some criteria on the parameters used to update the iterated coefficients are used to make the fit more stable (and more time-consuming). The number of iterations is limited to 50; if you need more, enter the routing again, using the output parameters as input for the next attampt. EXAMPLE: You have two Gaussians that are well-separated. This counts as an easy case; for the estimated parameters, you need not be accurate at all. The heights are hgt0=[1.5, 2.5], the centers cen0=[12., 20.], and the widths are [5., 6.]. There are 100 data points (tdata) at 100 values of x (xdata). You don't wish to see plots of the iterations, you don't care about the uncertainties, but you want the fitted points and also the rms of the residuals. gfit, look, xdata, tdata, zro0, hgt0, cen0, wid0, tfit, sigma If you have two Gaussians that are mixed, you must be careful in your estimates! RELATED PROCEDURES: GCURV HISTORY: Written by Carl Heiles. 24 Mar 1998.
(See /dzd2/heiles/idl/gen/gaussians/gfitwzfix.pro)