;+ ; Fit and subtract a polynomial baseline from the contents of data container [0] ; (continuum or line, depending on the GUIDE mode at the time). ; ;

See the notes for bshape for more details ; since this procedure uses that one for much of its work. ; ;

Use bshape if you want to fit the ; baseline but do not want it subtracted from the data. ; ;

Use bsubtract to subtract a baseline ; using the baseline coeficients stored in the !g structure (e.g. from ; a use of bshape). ; ;

Use bmodel to generate a baseline model ; and store it in the DC specified in modelindex. ; ;

Use bshow to over plot a baseline model. ; ;

Use subtract to subtract one data ; container (which might contain a basline model) from another data container. ; ; @keyword nfit {in}{optional}{type=integer} The order of polynomial ; to fit. Defaults to !g.nfit. If set, then this also sets the value ; of !g.nfit. ; ; @keyword modelindex {in}{optional}{type=integer} The index number to ; hold the fit evaluated at all channels (the model). If not set ; then no index will hold the model after this procedure is used. ; ; @keyword ok {out}{optional}{type=boolean} 1 on success, 0 on failure. ; ; @examples ; Get some data, set some regions, fit a 2nd order polynomial, putting ; the model (fitted baseline) into !g.s[10]. ;

; get,index=20
; nregion,[100,500,700,1000,1600,2000]
; !g.nfit=2
; baseline,modelindex=10
; 
; The step involving !g.nfit can be omitted with the same result. ;
; baseline,nfit=2,modelindex=10
; 
; Same fit, but don't put the model into any of the data containers. ;
; baseline,nfit=2
; 
; ; @uses bshape ; @uses bsubtract ; ; @version $Id: baseline.pro,v 1.4 2005/04/26 19:12:27 bgarwood Exp $ ;- pro baseline, nfit=nfit, modelindex=modelindex, ok=ok compile_opt idl2 ; this does the actual fit bshape, nfit=nfit, modelindex=modelindex, /noshow, ok=ok if not ok then return ; bshape will emit any errors bsubtract, nfit=nfit ; bsubtract will show the result end