diff --git a/src/idl/dustem_brute_force_fit.pro b/src/idl/dustem_brute_force_fit.pro index 2511bae..c85ba90 100644 --- a/src/idl/dustem_brute_force_fit.pro +++ b/src/idl/dustem_brute_force_fit.pro @@ -23,7 +23,8 @@ FUNCTION dustem_brute_force_fit,sed $ ,all_chi2s=all_chi2s $ ,weightning=weightning $ ,marginalize_method=marginalize_method $ - ,status=status + ,status=status $ + ,print_results=print_results ;+ ; NAME: @@ -188,17 +189,17 @@ ENDELSE all_chi2s=chi2s chi2=min(chi2s) -ind=where(chi2s EQ chi2,count) +ind_best=where(chi2s EQ chi2,count_best) ;this is the best SED in the grid ;stop -;print,facts[14406],facts[ind[0]] -;print,chi2s[14406],chi2s[ind[0]] +;print,facts[14406],facts[ind_best[0]] +;print,chi2s[14406],chi2s[ind_best[0]] -params=reform(grid_param_values[ind[0],*]) ;these are the best fit parameters -fact=facts[ind[0]] ; This is the corresponding scaling factor +params=reform(grid_param_values[ind_best[0],*]) ;these are the best fit parameters +fact=facts[ind_best[0]] ; This is the corresponding scaling factor Nfreedom=Nfilters-Nparams-1 ;This is the degree of freedom rchi2=chi2/Nfreedom ;This is the reduced chi2 -best_grid_sed=reform(grid_seds[ind[0],*]) ;This is the best SED fround in the grid. +best_grid_sed=reform(grid_seds[ind_best[0],*]) ;This is the best SED fround in the grid. best_sed=best_grid_sed*fact ;This is the best scaled grid SED matching the input SED. ;=== compute Likelyhood weighted params values @@ -273,7 +274,18 @@ IF keyword_set(show_sed) THEN BEGIN maxv=la_max([sed.stokesI,best_sed]) cgplot,sed.wave,sed.stokesI,psym='Filled Circle',color='blue',/ylog,/ysty,xtit=xtit,ytit=ytit,/xlog,yrange=[minv,maxv] cgoplot,sed.wave,best_sed,psym='Filled Square',color='red' - if not keyword_set(nostop) THEN stop + IF not keyword_set(nostop) THEN stop +ENDIF + +IF keyword_set(print_results) THEN BEGIN + message,'=============================================',/continue + message,'best fit parameters',/continue + print,params + message,'best fit reduced chi2 '+strtrim(rchi2,2),/continue + message,'best fit weighted parameters',/continue + print,weighted_params + message,'best fit weighted reduced chi2 '+strtrim(rweighted_chi2,2),/continue + ;stop ENDIF the_end: diff --git a/src/idl/dustem_marginalize_grid.pro b/src/idl/dustem_marginalize_grid.pro index 9db9a51..3fab34f 100644 --- a/src/idl/dustem_marginalize_grid.pro +++ b/src/idl/dustem_marginalize_grid.pro @@ -63,6 +63,7 @@ IF keyword_set(help) THEN BEGIN goto,the_end ENDIF +;stop N_fixed_params=n_elements(fixed_parameters_description) @@ -86,6 +87,7 @@ CASE use_method OF 'NEAREST': BEGIN FOR i=0L,N_fixed_params-1 DO BEGIN ind=where(table_params EQ fixed_parameters_description[i],count,complement=indc,ncomplement=nc) + stop IF count NE 0 THEN BEGIN ;fixed_parameter_value=fixed_parameters_values[ind[0]] fixed_parameter_value=fixed_parameters_values[i] -- libgit2 0.21.2