;+ ; Fill in the indicated data container at modelindex using the primary data ; container and the most recently fit parameters in !g.polyfit ; and and !g.nfit. Optionally use a smaller nfit than !g.nfit. ; ; @keyword modelindex {in}{optional}{type=integer}{default=1} The index of the ; data container to use to hold the model. Defaults to 1 if not ; supplied. ; ; @keyword nfit {in}{optional}{type=integer} Only use at most nfit ; parameters. If !g.nfit is < nfit, then only !g.nfit parameters will ; be used and a warning will be issued. ; ; @keyword ok {out}{optional}{type=boolean} 1 on success, 0 on failure. ; ; @uses data_valid ; @uses getbasemodel ; ; @examples ;
; ; put the model in !g.s[1]
; bmodel
; ; put the model in !g.s[10], using nfit=2
; boodel, modelindex=10, nfit=2
; 
; ; @version $Id: bmodel.pro,v 1.3 2005/04/26 19:12:27 bgarwood Exp $ ;- pro bmodel, modelindex=modelindex, nfit=nfit, ok=ok compile_opt idl2 if (n_elements(modelindex) eq 0) then modelindex = 1 maxindex = !g.line ? n_elements(!g.s) : n_elements(!g.c) if (modelindex lt 0 or modelindex gt maxindex) then begin message, 'requested modelindex does not exist',/info return endif model_data = getbasemodel(nfit=nfit,ok=ok) if ok then begin copy,0,modelindex if (!g.line) then begin *!g.s[modelindex].data_ptr = model_data endif else begin *!g.c[modelindex].data_ptr = model_data endelse endif end