Commit 2c22f184c8a540826b73857929d2a743f7dff631
1 parent
ac66fc15
Exists in
master
fixed bug when some fixed parameters existed
Showing
3 changed files
with
16 additions
and
3 deletions
Show diff stats
src/idl/Markwardt_for_Dustemwrap/dustem_mpfit.pro
... | ... | @@ -3571,7 +3571,16 @@ function dustem_mpfit, fcn, xall, FUNCTARGS=fcnargs, SCALE_FCN=scalfcn, $ |
3571 | 3571 | ;#iterations |
3572 | 3572 | !dustem_iter.act=iter |
3573 | 3573 | ;#current parameter values |
3574 | - (*!dustem_fit).current_param_values=ptr_new(x*(*(*!dustem_fit).param_init_values));So that parameters aren't just passed directly from MPFIT. ALSO allows to test with !dustem_current | |
3574 | + IF keyword_set(parinfo) THEN BEGIN | |
3575 | + xx=dblarr(n_elements(parinfo)) | |
3576 | + ind1=where(parinfo.fixed EQ 0,count1,complement=ind2,Ncomplement=count2) | |
3577 | + IF count1 NE 0 THEN xx[ind1]=x | |
3578 | + IF count2 NE 0 THEN xx[ind2]=parinfo[ind2].value | |
3579 | + ENDIF ELSE BEGIN | |
3580 | + xx=x | |
3581 | + ENDELSE | |
3582 | + ;stop | |
3583 | + (*!dustem_fit).current_param_values=ptr_new(xx*(*(*!dustem_fit).param_init_values));So that parameters aren't just passed directly from MPFIT. ALSO allows to test with !dustem_current | |
3575 | 3584 | ; ;#Current parameter errors |
3576 | 3585 | |
3577 | 3586 | if n_elements(fnorm) GT 0 AND n_elements(fnorm1) GT 0 then begin | ... | ... |
src/idl/dustem_mpfit_data.pro
... | ... | @@ -132,6 +132,8 @@ p_min = dustem_mpfitfun(func_name,wav,values,sigma, $ |
132 | 132 | maxiter=use_Nitermax,gtol=gtol,errmsg=errmsg,functargs=_extra,nocatch=nocatch) |
133 | 133 | |
134 | 134 | ;stop |
135 | +;!dustem_iter.act=niter_completed | |
136 | + | |
135 | 137 | message,errmsg,/info |
136 | 138 | message,'mpfitfun Status='+strtrim(status,2),/info |
137 | 139 | p_dim=p_min*(*(*!dustem_fit).param_init_values) |
... | ... | @@ -151,7 +153,7 @@ IF !dustem_noobj THEN BEGIN |
151 | 153 | dustemwrap_plot,p_dim,stp,_extra=_extra |
152 | 154 | ENDELSE |
153 | 155 | |
154 | - the_end: | |
156 | +the_end: | |
155 | 157 | RETURN, p_dim |
156 | 158 | |
157 | 159 | END | ... | ... |
src/idl/dustem_mpfit_run.pro
... | ... | @@ -111,8 +111,10 @@ FOR i_tag=0,count_data_tag-1 DO BEGIN |
111 | 111 | |
112 | 112 | 'SED' : BEGIN |
113 | 113 | dustem_sed = dustem_compute_sed(p_dim,st=st,SED_spec=SED_spec) |
114 | + ;help,*(*!dustem_fit).CURRENT_PARAM_VALUES | |
115 | + ;stop | |
114 | 116 | chi2_sed = total(((*(*!dustem_data).sed).values-dustem_sed)^2/(*(*!dustem_data).sed).sigma^2) |
115 | - n_sed = n_elements((*(*!dustem_data).sed).values) | |
117 | + n_sed = n_elements((*(*!dustem_data).sed).values) | |
116 | 118 | rchi2_sed = chi2_sed / n_sed |
117 | 119 | wrchi2_sed = rchi2_sed * (*!fit_rchi2_weight).sed |
118 | 120 | message,"chi2 SED = "+strtrim(chi2_sed,2)+" rchi2 SED = "+strtrim(rchi2_sed,2),/continue;," weighted rchi2 SED=",wrchi2_sed | ... | ... |