Commit 46d50ffd3e4c20a58e85bc917fdbfc8de312578a

Authored by Jean-Philippe Bernard
1 parent 98c873de
Exists in master

added print options

src/idl/dustem_brute_force_fit.pro
... ... @@ -23,7 +23,8 @@ FUNCTION dustem_brute_force_fit,sed $
23 23 ,all_chi2s=all_chi2s $
24 24 ,weightning=weightning $
25 25 ,marginalize_method=marginalize_method $
26   - ,status=status
  26 + ,status=status $
  27 + ,print_results=print_results
27 28  
28 29 ;+
29 30 ; NAME:
... ... @@ -188,17 +189,17 @@ ENDELSE
188 189  
189 190 all_chi2s=chi2s
190 191 chi2=min(chi2s)
191   -ind=where(chi2s EQ chi2,count)
  192 +ind_best=where(chi2s EQ chi2,count_best) ;this is the best SED in the grid
192 193  
193 194 ;stop
194   -;print,facts[14406],facts[ind[0]]
195   -;print,chi2s[14406],chi2s[ind[0]]
  195 +;print,facts[14406],facts[ind_best[0]]
  196 +;print,chi2s[14406],chi2s[ind_best[0]]
196 197  
197   -params=reform(grid_param_values[ind[0],*]) ;these are the best fit parameters
198   -fact=facts[ind[0]] ; This is the corresponding scaling factor
  198 +params=reform(grid_param_values[ind_best[0],*]) ;these are the best fit parameters
  199 +fact=facts[ind_best[0]] ; This is the corresponding scaling factor
199 200 Nfreedom=Nfilters-Nparams-1 ;This is the degree of freedom
200 201 rchi2=chi2/Nfreedom ;This is the reduced chi2
201   -best_grid_sed=reform(grid_seds[ind[0],*]) ;This is the best SED fround in the grid.
  202 +best_grid_sed=reform(grid_seds[ind_best[0],*]) ;This is the best SED fround in the grid.
202 203 best_sed=best_grid_sed*fact ;This is the best scaled grid SED matching the input SED.
203 204  
204 205 ;=== compute Likelyhood weighted params values
... ... @@ -273,7 +274,18 @@ IF keyword_set(show_sed) THEN BEGIN
273 274 maxv=la_max([sed.stokesI,best_sed])
274 275 cgplot,sed.wave,sed.stokesI,psym='Filled Circle',color='blue',/ylog,/ysty,xtit=xtit,ytit=ytit,/xlog,yrange=[minv,maxv]
275 276 cgoplot,sed.wave,best_sed,psym='Filled Square',color='red'
276   - if not keyword_set(nostop) THEN stop
  277 + IF not keyword_set(nostop) THEN stop
  278 +ENDIF
  279 +
  280 +IF keyword_set(print_results) THEN BEGIN
  281 + message,'=============================================',/continue
  282 + message,'best fit parameters',/continue
  283 + print,params
  284 + message,'best fit reduced chi2 '+strtrim(rchi2,2),/continue
  285 + message,'best fit weighted parameters',/continue
  286 + print,weighted_params
  287 + message,'best fit weighted reduced chi2 '+strtrim(rweighted_chi2,2),/continue
  288 + ;stop
277 289 ENDIF
278 290  
279 291 the_end:
... ...
src/idl/dustem_marginalize_grid.pro
... ... @@ -63,6 +63,7 @@ IF keyword_set(help) THEN BEGIN
63 63 goto,the_end
64 64 ENDIF
65 65  
  66 +;stop
66 67  
67 68 N_fixed_params=n_elements(fixed_parameters_description)
68 69  
... ... @@ -86,6 +87,7 @@ CASE use_method OF
86 87 'NEAREST': BEGIN
87 88 FOR i=0L,N_fixed_params-1 DO BEGIN
88 89 ind=where(table_params EQ fixed_parameters_description[i],count,complement=indc,ncomplement=nc)
  90 + stop
89 91 IF count NE 0 THEN BEGIN
90 92 ;fixed_parameter_value=fixed_parameters_values[ind[0]]
91 93 fixed_parameter_value=fixed_parameters_values[i]
... ...