The LAMP Application

Generated by IDLdoc

single page | use frames     summary     class     fields     routine details     file attributes

lamp_mac/DIF/

newfit.pro


top newfit

result = newfit(ww, a, PRINT=PRINT, PLOT=PLOT, file=file, nowindow=nowindow, xx=xx, ee=ee, yy=yy, datpp=datpp, xmin=xmin, xmax=xmax, nbgterms=nbgterms, npeaks=npeaks, amplitude=amplitude, bg=bg, position=position, width=width, intensity=intensity, eta=eta, H=H, S=S, L=L, sig_H=sig_H, sig_S=sig_S, sig_L=sig_L, sig_amplitude=sig_amplitude, sig_bg=sig_bg, sig_position=sig_position, sig_width=sig_width, sig_intensity=sig_intensity, sig_eta=sig_eta, TOL=TOL, ITMAX=ITMAX, UVW=UVW, pVoigt=pVoigt, click=click, guess=guess, search=search, inputfile=inputfile, outputfile=outputfile, maxwidth=maxwidth, maxsearchwidth=maxsearchwidth, minwidth=minwidth, damping=damping, iterations=iterations, bragg=bragg, rectangle=rectangle, HR=HR, sig_HR=sig_HR, GUI=GUI, backwards=backwards, initialiterations=initialiterations, widget=widget, noderivative=noderivative, func=func)

Started: 04-Nov-96 by Th.Hansen, ILL-Grenoble Gaussian fit for sequential diagrams and multiple peaks - now also Convolution with Bragg, Lorentz (pseudo-Voigt) and asymmetry (Finger-Cox-Jephcoat) w is a LAMP workspace, it might be three-dimensional - in that case sequential fits will be performed a is a vector new: the vector a contains npeaks * peakpars (amplitude, position and FWHM, evtl. eta) + nbg numbers, with nbg = 1 (constant bg), 2 (linear bg.) or 3 (square bg.), etc. 'a' can be given as a vector, read from a file ('inputfile'), made graphically interactively ('click') or created automatically if not given, or set to zero The number of peaks to be found automatically has to be given ('npeaks'), except for graphical search ('click') The number of background polynom terms ('nbgterms') has to be given, also with keyword 'click' The refined values and sigmas can be overtaken with keyword parameters such as 'intensity', 'amplitude','bg', 'sig_intensity', 'sig_amplitude', or 'sig_bg', etc. These parameters will be two-dimensional (number of diagrams * number of peaks/background polynom terms) IF FWHM have to be determined from automatic peak-search, then they can be taken optionally from a Cagliotti function, 'UVW' then has to be given as a vector With the keyword 'pVoigt' set, peaks will be fitted as pseudo-Voigt function instead of pure Gauss The initial guess can be written out to a file ('outputfile') or a variable ('guess') Some output can be written to screen ('print') and/or to a file ('file') Graphical output will be created when 'plot' is set, 'nowindow' will force this output to the last used window and open no new one If not working in a LAMP environment, the necessary additional workspace data X (x-axis) and E (errors) can (must?) be given via the keywords 'xx' and 'ee', or - if inside a structure datp containing datp.x and datp.e - as a structure via the keyword 'datpp' The default damping factor of 0.5 and number of iterative (10) least square curve fits can be changed ('damping', 'iterations') If taken from a inputfile, each parameter has an individual damping factor, found in every second line, as written to the file with 'outputfile' 'backwards' starts from the last diagram of a fiven workspace instead the first one Well, all that widget stuff (keyword 'click' or 'GUI') has not yet been documented, well, as it SHOULD be self-explaining ;-) You can until the clicking on background points (which you can undo as well now) change the order of the polynom As long as you have not stopped the background determination (by clicking on the corresponding button), you can change some settings of the peakshape function (asymmetry after Finger-Cox-Jephcoat, pseudo-Voig or simple Gauss, Rectangle convolution, Bragg-formula convolution), later I shall try to allow for those changes at a later state as well (which is difficult however, as it might change the number of parameters on the road). If you work with an inputfile, you may define peaks as well which will emerge only later, giving an amplitude of zero These peaks won`t be taken into account during the refinement of the first pattern, from than on, before each run of the least squares routine (iterations+1 times for each pattern, containing itmax proper least sqare iterations each - or less, damping applied inside), the peaks are checked: if they are non-zero and their presence improves the fit, then they are taken as they are as inital guess, if not, then the maximum difference count rate at the presumed peak position plus minus three sigma is taken, if this (minus the background and the other peaks) is less than the counting error, the peak is not taken, otherwise, it is checked, if the peak with this counting improves chi2 more than 10% only, only then, the peak is taken into account. Modification 22-May-97 by Th. HANSEN:; fit.pro - sequential fit of multiple Gauss peaks (wrongly successively treated!) Modification 08-Sep-97 by Th. HANSEN:; several bugs fixed (array-indexing for a and x, etc.) Modification 04-Nov-97 by Th. HANSEN:; Voigt function and asymmetry correction ... ? Not really a success ... Modification 17-Nov-00 by Th. HANSEN:; new gaussfunc: gauss_square/poly.pro - new name: 'newfit' replaces 'fit' Modification 20-Nov-00 by Th. HANSEN:; everything changes ... (experiment M. Huber, E. Peters, B. Walk, T. Fehr, S. Zuern) Modification 05-Dec-00 by Th. HANSEN:; GUI replaces click, XREGISTERED, workspace numbers for output parameter keywords, y-axis ... Modification 06-Dec-00 by Th. HANSEN:; y values in file (W. Kuhs), OPLOTERR for error bars Modification 08-Dec-00 by Th. HANSEN:; call_procedure, noderivative - preparing Finger, Cox, Jephcoat: fcj.pro Modification 12-Dec-00 by Th. HANSEN:; use of an own lsfit.pro instead of IDL`s curvefit.pro for the least squares algorithm Modification 13-Dec-00 by Th. HANSEN:; Rectangle convolution and Bragg formula in gauss-poly.pro, tried to implement derivatives without success Modification 14-Dec-00 by Th. HANSEN:; Emerging peaks, keep them at zero as long as necessary ... Modification 15-Dec-00 by Th. HANSEN:; Emerging and disapearing peaks: performing limited peaksearches before each least-squares run, some documentation Modification 17-Dec-00 by Th. HANSEN:; Don`t consider emerging just beside existing peaks ... Modification 19-Dec-00 by Th. HANSEN:; Tune recognition of emerging and of disappearing peaks: some tests are done AFTER least-squares to throw away badly refined peaks again Modification 23-Dec-00 by Th. HANSEN:; emerging and of disappearing peaks: debugging ... Modification 24-Dec-00 by Th. HANSEN:; Differential Peaksearch, first tries Modification 26-Dec-00 by Th. HANSEN:; Differential Peaksearch, as a new option ('search'), instead of taking last fit as initial guess to be done: constraints (UVW) on peak widths crystallographical constraints on peak positions? (this would appproach a Rietveld style full profile fit) zooming, and fixing xmin/max interactively Gauss-Legendre integration over cellwidth exponential 'wing'-effect of Pierre Convert emergency exit if least squares block handle new, emerging peaks - this is not so easy - same applies for disappearing peaks, of course: one 'solution' consists in looking at the peak`s contribution to the goodness of fit before each least-squares call the peak`s intensity is guessed at it`s position, if it is negative, or the peak does not improve chi2, then set it to zero intensity and exclude it from fitting this round Up to now, emerging peaks must already exist somehow in the list of peaks, an automatic peak-search for supplementary peaks could be a nice option Also could we try to avoid the polynominal background becoming negative An additional criterion on width could be applied to declare peaks 'broadened' out GUI-widget: newfit should be called (but then as a procedure ?!) with a simple button click, so without any parameter or keyword This would mean the possibility of specifying an input-workspace, an output workspace, the x-range and optional additional outputs in workspaces, using the widget. Consequently some parameters (xmin, xmax, peakpars, etc.) should kept changeable for longer than it is now

Parameters

ww
a

Keywords

PRINT
PLOT
file
nowindow
xx
ee
yy
datpp
xmin
xmax
nbgterms
npeaks
amplitude
bg
position
width
intensity
eta
H
S
L
sig_H
sig_S
sig_L
sig_amplitude
sig_bg
sig_position
sig_width
sig_intensity
sig_eta
TOL
ITMAX
UVW
pVoigt
click
guess
search
inputfile
outputfile
maxwidth
maxsearchwidth
minwidth
damping
iterations
bragg
rectangle
HR
sig_HR
GUI
backwards
initialiterations
widget
noderivative
func

File attributes

Modification date: Tue Oct 1 14:42:22 2013
Lines: 1,468