The LAMP Application

Generated by IDLdoc

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

lamp_mac/

gfit.pro


A lamp interface to perform fits on plot. Fitit procedures were developped by Don Kearley Gfit was developped, improved and corrected by : Don Kearley Didier Richard Stephane Thiers Romuald Jouffrey During 1995-1996 This file contains both original fitit.pro and gfit.pro Version 1.14 Date: 6/10/96 Modification History: gjk 22/9/96: Common gc_width_factor added with gw_fac and lw_fac. These take account width as sigma or real width. gjk 22/9/96: If width or intensity set by cursor, g_resid=1.0e12 gjk 23/9/96: Modified routine adapte to: set symbol plotting if less than 200 points set symbol size according to number of points set error plotting if errors are present to include most of the actual plotting: plot_flag=0 no plot, =1 plot all =2 no overplot =3 plot,/nodata gjk 1/10/96: Change to middle mouse button for peak definition. Something odd about event 2 2 with left button? gjk 5/10/96: Derivatives for height corrected, and refienement altered, now: ncycles of dumb routine with initial step decreasing with ncycles. One cycle of derivative method, but 2 if ncycles > 1. gjk 6/10/96 Flag peaks with negative height or width with peak_neg equal to offending peak number (0 if ok) and ht_or_wdth = 1 for height and 2 for width. Set in sum_fit. gjk 10/10/96 Flat and sloping bg added when peak defined with mouse did 08/08/02 Detail balance added. did 09/08/02 scalling on X and Y is now possible. did 31/10/04 added pseudo-Voigt ***************************** Widgets Creating Procedure GFIT Create main GKFIT interface CREER_EXCL, id Create Excluding zone interface CREER_VIEW, id Create viewing zone interface ***************************** Event processing procedures GFIT_EVENT ,Event TRAITVIEW_EVENT ,Event TRAITEXCL_EVENT ,Event ***************************** functions of this files are : JFIT ,x,y,w,a,stp,siga,g_ncycles,npk,poids GENFIT ,X,Y,W,A,stp,npk,resid,poids CALCULATE_ERROR,modele BELONG_TO ,elem,inter GK_FIT ,workspace ***************************** Procedures of this files are : CREATE_COMMONS GAUSS ,x,a,f LORENTZ ,x,a,f PSEUDO ,x,a,f SUM_FIT_FCT ,x,a,f,g_npeaks,pder FITIT ,g_npeaks,w_in,w_out,... ADAPTE ,x_to_plot,w_to_plot AFF_EXCL ,excl_param DO_FIT ,option GET_PARAM ,g_parameters,idx,p1,p2,p3 GFIT_HELP , dummy, formu, formt GK_INITIALIZE GK_WARNING ,excl_param,viewarr PARAMETER_MENU,Ev PLOT_SUBF ,g_npeaks,g_parameters,x_ni,g_fct_type PUT_TIT ,x_dats,y_dats,f_tit,fx_tit,fy_tit PUT_VALS ,x_dats,y_dats,f_dats,plt_dev,poids,lamp_siz PRINT_VALS ,x_dats,y_dats,f_dats,plt_dev,poids READ_PAR_VALS SET_GFIT_PARAM,w,p,Fct_Type=ft WRITE_PAR_VALS WRITE_PAR_VALS_2 GFIT ,GROUP=Group ERROR_MSG ,Error_Number ***************************** Little explanation on variables - Local variables are normaly named (ex. idx) - Each gkfit shared variable begins with g_ (ex. g_parameters) - gw_ stands for gkfit Widgets identifier variables (ex. gw_base) Variables are ALWAYS lowercase, IDL Instructions are ALWAYS uppercase Keywords in IDL instructions are ALWAYS Capitalized. If you try this, you keep it ... very helpfull in reading ...

Routines

create_commons_gfit

Parameter_menu, Ev

result = jfit(x, y, w, a, stp, siga, ncycles, npk, poids)

result = genfit(X, Y, W, A, stp, npk, resid, poids)

Gauss, x_vector, p1, p2, p3, peak, partial_deriv

Lorentz, x_vector, p1, p2, p3, peak, partial_deriv

Pseudo, x_vector, p1, p2, p3, peak, partial_deriv

Sum_fit_fct, x, a, f, npk, pder

fitit, npeaks, w_in, w_out, g_parameters, x_ci, ncycles, resid, g_step, gw_resid_lab, excl_param, poids

result = calculate_error(modele)

adapte, x_to_plot, w_to_plot, w_out, plot_flag, e_to_plot

result = belong_to(elem, inter)

aff_excl, excl_param

result = gfit_event_func(event)

gfit_ctrl_panel, id

do_fit, option

get_param, g_parameters, idx, p1, p2, p3

get_bckg, g_npeaks, g_parameters, bbb, sss

gfit_help, dummy, formu, formt

gk_initialize, excl=excl

gfit_Event, Event

gk_warning, excl_param, viewarr

plot_subf, g_npeaks, g_parameters, x_ni, g_fct_type

put_tit, x_dats, y_dats, f_tit, fx_tit, fy_tit

put_vals, x_dats, y_dats, f_dats, plt_dev, poids, lamp_siz

print_vals, x_dats, y_dats, f_dats, plt_dev, poids

result = gk_fit(workspace)

read_par_vals

write_par_vals_2, wid, g_step, idx, j

set_gfit_param, w, p, Fct_Type=Fct_Type

write_par_vals, No_Update=No_Update

error_msg, error_number, str1

traitview_event, event

traitexcl_event, event

creer_excl, id

creer_view, id

gfit, tx_param, Just=Just, Group=Group, Tripx=Tripx

Routine details

top create_commons_gfit

create_commons_gfit

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

top Parameter_menu

Parameter_menu, Ev

** ************** ** gfit stuff

Parameters

Ev

top jfit

result = jfit(x, y, w, a, stp, siga, ncycles, npk, poids)

******* **** ** Free fall minimisation routine gjk March 1994 ** Treats one parameter at a time: shifts value, if better then shifts ** twice as much, if worse shifts back half as much. Halts for each ** parameter when change in residual is less than "tiny". ** When all parameters are done this is one cycle. Repeated for ncycles.

Parameters

x
y
w
a
stp
siga
ncycles
npk
poids

top genfit

result = genfit(X, Y, W, A, stp, npk, resid, poids)

******* ****** ** Doctored version of curvefit gjk March 95

Parameters

X
Y
W
A
stp
npk
resid
poids

top Gauss

Gauss, x_vector, p1, p2, p3, peak, partial_deriv

** ***** ** Define in peak a Gaussian on parameters p1 (pos),p2 (ht), p3 (wdth) into ** array peak. If partial_deriv parameters is done, partial_deriv contains ** partial_deriv for each parameters.

Parameters

x_vector
p1
p2
p3
peak
partial_deriv

top Lorentz

Lorentz, x_vector, p1, p2, p3, peak, partial_deriv

** ******* ** Define in peak a Lorentzian on parameters p1 (pos),p2 (ht), p3 (wdth) into ** array peak. If partial_deriv parameters is done, partial_deriv contains ** partial_deriv for each parameters.

Parameters

x_vector
p1
p2
p3
peak
partial_deriv

top Pseudo

Pseudo, x_vector, p1, p2, p3, peak, partial_deriv

** ****** ** Define in peak a Pseudo-voigt (.5) on parameters p1 (pos),p2 (ht), p3 (wdth) into ** array peak. If partial_deriv parameters is done, partial_deriv contains ** partial_deriv for each parameters.

Parameters

x_vector
p1
p2
p3
peak
partial_deriv

top Sum_fit_fct

Sum_fit_fct, x, a, f, npk, pder

** *********** ** defines npk 'fct type' plus flat and sloping background ** parameters go pos,ht,wdth in array a

Parameters

x
a
f
npk
pder

top fitit

fitit, npeaks, w_in, w_out, g_parameters, x_ci, ncycles, resid, g_step, gw_resid_lab, excl_param, poids

** ***** ** Fit it ** gjk April 1995

Parameters

npeaks
w_in
w_out
g_parameters
x_ci
ncycles
resid
g_step
gw_resid_lab
excl_param
poids

top calculate_error

result = calculate_error(modele)

******* *************** ** retourne un vecteur contenant les erreurs faites sur les parametres ** de la fonction approximante.(cf. "variance-covariance matrix ** determination in non-linear least squares fitting" by R.F. Pettifer)

Parameters

modele

top adapte

adapte, x_to_plot, w_to_plot, w_out, plot_flag, e_to_plot

** ****** ** Adapt vector to current view zone

Parameters

x_to_plot
w_to_plot
w_out
plot_flag
e_to_plot

top belong_to

result = belong_to(elem, inter)

******* ********* ** retourne un booleen indiquant si l'element elem est dans l'un des intervalles ** de inter ( sert a la procedure aff_excl)

Parameters

elem
inter

top aff_excl

aff_excl, excl_param

** ******** ** affichage des zones exclues du fit

Parameters

excl_param

top gfit_event_func

result = gfit_event_func(event)

******* *************** ** just call gfit_event procedure

Parameters

event

top gfit_ctrl_panel

gfit_ctrl_panel, id

** *************** ** if id is defined, then gfit_ctrl_panel has been destroyed, build it again

Parameters

id

top do_fit

do_fit, option

** ****** ** do the fit, call fitit

Parameters

option

top get_param

get_param, g_parameters, idx, p1, p2, p3

** ********* ** gfit stuff

Parameters

g_parameters
idx
p1
p2
p3

top get_bckg

get_bckg, g_npeaks, g_parameters, bbb, sss

** ******** ** gfit stuff

Parameters

g_npeaks
g_parameters
bbb
sss

top gfit_help

gfit_help, dummy, formu, formt

** ********* ** gfit help

Parameters

dummy
formu
formt

top gk_initialize

gk_initialize, excl=excl

** ************* ** initialize variables

Keywords

excl

top gfit_Event

gfit_Event, Event

** ********** ** Called when a gfit event is generated

Parameters

Event

top gk_warning

gk_warning, excl_param, viewarr

** ********** ** Warning if points of fitting zone are not in viewing zone

Parameters

excl_param
viewarr

top plot_subf

plot_subf, g_npeaks, g_parameters, x_ni, g_fct_type

** ********* Puts titles on plot

Parameters

g_npeaks
g_parameters
x_ni
g_fct_type

top put_tit

put_tit, x_dats, y_dats, f_tit, fx_tit, fy_tit

** ******* ** Puts titles on plot **

Parameters

x_dats
y_dats
f_tit
fx_tit
fy_tit

top put_vals

put_vals, x_dats, y_dats, f_dats, plt_dev, poids, lamp_siz

** ******** ** Puts result on plot **

Parameters

x_dats
y_dats
f_dats
plt_dev
poids
lamp_siz

top gk_fit

result = gk_fit(workspace)

******* ****** ** handle workspace output fit and parameters result

Parameters

workspace

top read_par_vals

read_par_vals

** ************* ** Get parameters value from fields **

top write_par_vals_2

write_par_vals_2, wid, g_step, idx, j

** **************** ** Update interface parameters ** wid

Parameters

wid
g_step
idx
j

top set_gfit_param

set_gfit_param, w, p, Fct_Type=Fct_Type

** ************** ** gfit stuff

Parameters

w
p

Keywords

Fct_Type

top write_par_vals

write_par_vals, No_Update=No_Update

** ************** ** Display errors values in widget labels

Keywords

No_Update

top error_msg

error_msg, error_number, str1

** ********* ** Display error message identified by error_number

Parameters

error_number
str1

top traitview_event

traitview_event, event

** *************** ** event handler for creer_view

Parameters

event

top traitexcl_event

traitexcl_event, event

** *************** ** event handler for creer_excl

Parameters

event

top creer_excl

creer_excl, id

** ********** ** Create widget window to define determinant fitting zone

Parameters

id

top creer_view

creer_view, id

** ********** ** plot range gui

Parameters

id

top gfit

gfit, tx_param, Just=Just, Group=Group, Tripx=Tripx

** **** ** gfit GUI creation

Parameters

tx_param

Keywords

Just
Group
Tripx

File attributes

Modification date: Tue Oct 1 14:36:01 2013
Lines: 2,869