The LAMP Application

Generated by IDLdoc

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

lamp_mac/STEF/

qens_fit.pro


** *************************************************************************************** ** ** Program qens_fit ** ** This module permits to fit Quasi-elastic data to a set of ** different models (translations, rotations, jumps ...) ** S. Rols 09/01 srols@anl.gov, now rols@lcvn.univ-montp2.fr, now rols@ill.eu ** Last modification: 02/04/02 ** Last modification: 15/05/02 - correction of several buggs when fitting all spectra ** - modification of the output files format ** Last modification: 21/05/02 - modification of the convolution routine ... use of convol ** Last modification: 28/05/02 - modification of the convolution routine ... use of convol ** Last modification: 07/07/02 - symetrization of the slopping backg or constant backg ** Last modification: 27/11/02 - change of the resolution function color ** - put the Reduced Chi square instead of the Chi square ** Last modification: 14/03/03 - fix of a problem on the convolution part ... still unresolved ** Last modification: 01/07/03 - Do the convolution again without the /CENTER keywords. ** - Tests are under process ... ** Last modification: 02/07/03 - Fix a problem when saving curves. ** - Put the plot dimensions larger ** Last modification: 07/07/03 - Restructuration of the file backbone. ** - file fit_basegl.pro contains the fit_basegl,fit_basegl2 ** and funlg_to_fit subroutines and functions ** Last modification: 08/07/03 - Put a lot of message .... trapping of the errors. ** Last modification: 15/07/03 - Correction of several buggs. ** Last modification: 16/07/03 - Dealing with res func energy range. Now fixed ... ** - Addition of the saving param. in Q P1 P2 P3 ... format ** Last modification: 17/07/03 - Corrrection of a bug on the center of the RF ** - No more intensity but amplitudes for Lorentzian and Gaussian ** - Try to put constraints on the parameters ** Last modification: 22/07/03 - Constraints on the parameters are set ** Last modification: 25/07/03 - Put a short help ** Last modification: 04/08/03 - Correct from several buggs that happened when pushing on "enter" ** Last modification: 13/01/04 - Correct from several buggs that happened when saving parameters ** Last modification: 07/07/04 - Put the possibility of 2D fitting (Q,w) ** Last modification: 10/09/04 - Put the possibility of fitting with a Gumbel function ** Last modification: 22/06/05 - Put the possibility of building user defined models ** - Correct from some buggs ... ** Last modification: 27/06/05 - Add a choice for the COOLFIT engine ** - Add a STOP button which produces an interrupt event ** - Split common variables in SC_NEW for Lamp-runtime compatibility ** - Access to the CLIP-BOARD and E_LogBook (right click on drawable) ** Last modification: 07/07/05 - reverse the resolution function before convolution ** - bad error bars correctly managed and plotted ** Last modification: 12/07/05 - correct from buggs in the streched exponentials function ** Last modification: 03/10/06 - The write button loads the parameter in the workspace chosen by user ** Last modification: 27/10/06 - Put Title to the graph with current spectrum value ** Last modification: 07/11/06 - Put the abs(data-fit) and abs((data-fit)/data) graph + print the Re-Chisqr ** - Also modified the error bars to PERR*SQRT(Re-Chisqr) see mpfit.pro documentation ** Last modification: 04/05/07 - Modify some of the verifications of the input data (ex: binning...) ** Last modification: 20/05/07 - Correct from an error in the Gaussian function definition ** Last modification: 30/06/07 - Change of some windows design and functionalites ** Last modification: 24/08/07 - Correction of an error in the spherical bessel function definition ** Last modification: 08/11/07 - Solved the +/- infinity problem from spline when sx_res and sx_in not the ** same dimension (from IN13 LVE) ** Last modification: 16/11/07 - Solve the problem of the central 0.meV peak ** Last modification: 27/08/08 - Plot the subfunctions multiplied by the detailed balance factor if checked ** Last modification: 28/05/10 - Replace 'P()' by 'P[]' ** Last modification: 11/01/11 - Change the load and save buttons in the interface to allow using the 60 lamp workspaces (by SR) ** Last modification: 18/01/11 - Gaussian Res Function Input (SR) ** Last modification: 07/11/11 - Adds the possibility to choose which parameters to propagate to every spectra ** - Adds the possibility to import saved parameters (CB). Checks for dimension errors ** ** ****************************************************************************************

Routines

create_commons_qens

result = sph_beselj(xinput, n)

result = bose_qens(xinput)

result = n_lorentz(xinput, p1, p2)

result = dho(xinput, p1, p2, p3)

result = sexp(xinput, p1, p2, p3, p4)

result = qlorentz(xinput, p1, p2, p3)

result = qgauss(xinput, p1, p2, p3)

result = myfunc(P, XVAL=XVAL, YVAL=YVAL, ERRVAL=ERRVAL)

prepare_2_fit, X, Y, E, parinfo, sstat

change_spectrum

qens_fit_event, Event

plot_it

inputfwhm

treat_resf, sstat

qens_fit, tx_param, Just=Just, Group=Group, Tripx=Tripx

Routine details

top create_commons_qens

create_commons_qens

** ************************************************************** ** Just to create correct commons while compiling. ** Explains also variables

top sph_beselj

result = sph_beselj(xinput, n)

** ************************************************************** ** Calculate the spherical bessel functions jl

Parameters

xinput
n

top bose_qens

result = bose_qens(xinput)

** ************************************************************** ** Calculate the bose factor

Parameters

xinput

top n_lorentz

result = n_lorentz(xinput, p1, p2)

** ************************************************************** ** p1=position p2=FWHM p3=amplitude (intensity is !PI*P2*P3/2) ** lorentz(x)=P3*P2^2/(4*(x-P1)^2+P2^2)

Parameters

xinput
p1
p2

top dho

result = dho(xinput, p1, p2, p3)

** ************************************************************** ** p1=position p2=FWHM p3=amplitude ** dho(x)=P3*P2*x/((x^2-P1^2)^2+P2^2)

Parameters

xinput
p1
p2
p3

top sexp

result = sexp(xinput, p1, p2, p3, p4)

** ************************************************************** ** p1=position p2=beta p3=tau p4=amplitude ** dho(x)=P4*FT(exp(-(x/P3)^p2)) centered at p1

Parameters

xinput
p1
p2
p3
p4

top qlorentz

result = qlorentz(xinput, p1, p2, p3)

** ************************************************************** ** p1=position p2=FWHM p3=amplitude (intensity is !PI*P2*P3/2) ** lorentz(x)=P3*P2^2/(4*(x-P1)^2+P2^2)

Parameters

xinput
p1
p2
p3

top qgauss

result = qgauss(xinput, p1, p2, p3)

** ************************************************************** ** p1=position p2=FWHM p3=amplitude (intensity is P3*P2P*SQRT(!PI)) ** gauss(x)=(P3/(p2'*sqrt(PI))*EXP(-(x-P1)^2/(P2')^2) ** in that case, P2'=P2/(2sqrt(Ln(2))) is not the FWHM

Parameters

xinput
p1
p2
p3

top myfunc

result = myfunc(P, XVAL=XVAL, YVAL=YVAL, ERRVAL=ERRVAL)

** ************************************************************** ** P=sf_new_values : values of the fit parameters ** X=x values constrainted by the fit range ... Y=corresponding Y values ** and E=corresponding errors ** model=returned array containing the model values

Parameters

P

Keywords

XVAL
YVAL
ERRVAL

top prepare_2_fit

prepare_2_fit, X, Y, E, parinfo, sstat

** ************************************************************** ** Called when the FIT button is pressed ** Call back the new values of the fit parameters as well as ** other necessary features

Parameters

X
Y
E
parinfo
sstat

top change_spectrum

change_spectrum

** ************************************************************** ** qens_fit stuff

top qens_fit_event

qens_fit_event, Event

** ************************************************************** ** Called when a qens_fit event is generated

Parameters

Event

top plot_it

plot_it

** ************************************************************** ** This routine defines the plot-limits required

top inputfwhm

inputfwhm

** ************************************************************** ** create the base of the fitting routine

top treat_resf

treat_resf, sstat

** ************************************************************************** ** This program gives several treatment to the resolution function spectrum ** Basically, il substracts a flat background, performs the normalization to 1 ** and deal with the range under consideration (e.g w where res(w) ne 0) ** sw_res=vector containing the exp. res. function ** w_resc=vector containing the treated res function ** rfmin and rfmax define the range of res. fun. to consider [rfmin,rfmax] ** treatment for spectrum ispmin to ispmax but for the moment, full treatment e.g ** ispmin and ispmax=(size(w_res))(2) (nspectra)

Parameters

sstat

top qens_fit

qens_fit, tx_param, Just=Just, Group=Group, Tripx=Tripx

** ************************************************************** ** Main body of this complete routine ... the first to be called

Parameters

tx_param

Keywords

Just
Group
Tripx

File attributes

Modification date: Tue Oct 1 14:40:15 2013
Lines: 2,470