Commit cdd2763e6a8ae46c523fb452928dc4188a5f65a9

Authored by Jean-Philippe Bernard
1 parent ce9a64c1
Exists in master

brought up to date with new fomr of dustem_data system variable

src/idl/dustem_compute_gb_sed.pro
@@ -57,11 +57,14 @@ ww=10.^ww @@ -57,11 +57,14 @@ ww=10.^ww
57 waves=ww 57 waves=ww
58 58
59 ;MAKE A COPY OF THE (EMPTY) OBSERVED VALUES 59 ;MAKE A COPY OF THE (EMPTY) OBSERVED VALUES
60 -obs_sed = (*!dustem_data.sed).values 60 +;stop
  61 +obs_sed = (*(*!dustem_data).sed).values
  62 +
  63 +;obs_sed = (*!dustem_data.sed).values
61 64
62 ;COMPUTE THE MODEL SED 65 ;COMPUTE THE MODEL SED
63 dustem_sed = obs_sed*0.D0 66 dustem_sed = obs_sed*0.D0
64 -ind_sed=where((*!dustem_data.sed).filt_names NE 'SPECTRUM',count_sed) 67 +ind_sed=where((*(*!dustem_data).sed).filt_names NE 'SPECTRUM',count_sed)
65 68
66 IF !dustem_do_cc NE 0 AND !dustem_never_do_cc EQ 0 THEN BEGIN 69 IF !dustem_do_cc NE 0 AND !dustem_never_do_cc EQ 0 THEN BEGIN
67 message,'DOING color correction calculations',/info 70 message,'DOING color correction calculations',/info
@@ -76,13 +79,13 @@ IF !dustem_do_cc NE 0 AND !dustem_never_do_cc EQ 0 THEN BEGIN @@ -76,13 +79,13 @@ IF !dustem_do_cc NE 0 AND !dustem_never_do_cc EQ 0 THEN BEGIN
76 spec=pp(0)*(ww)^(-1.*pp(2))*dustem_planck_function(pp(1),ww) 79 spec=pp(0)*(ww)^(-1.*pp(2))*dustem_planck_function(pp(1),ww)
77 ; filter_names=((*!dustem_data).filt_names)(ind_sed) 80 ; filter_names=((*!dustem_data).filt_names)(ind_sed)
78 ; FOR ii=0L,n_elements(filter_names)-1 DO BEGIN 81 ; FOR ii=0L,n_elements(filter_names)-1 DO BEGIN
79 - ssed=dustem_cc(ww,spec,((*!dustem_data.sed).filt_names)(ind_sed),cc=cc) 82 + ssed=dustem_cc(ww,spec,((*(*!dustem_data).sed).filt_names)(ind_sed),cc=cc)
80 ;print,cc 83 ;print,cc
81 ; ENDFOR 84 ; ENDFOR
82 dustem_sed[ind_sed]=ssed 85 dustem_sed[ind_sed]=ssed
83 ENDIF 86 ENDIF
84 ENDIF ELSE BEGIN 87 ENDIF ELSE BEGIN
85 - www=dustem_filter2wav(((*!dustem_data.sed).filt_names)[ind_sed]) 88 + www=dustem_filter2wav(((*(*!dustem_data).sed).filt_names)[ind_sed])
86 dustem_sed[ind_sed]=pp(0)*(www)^(-1.*pp(2))*dustem_planck_function(pp(1),www)*(*!dustem_previous_cc) 89 dustem_sed[ind_sed]=pp(0)*(www)^(-1.*pp(2))*dustem_planck_function(pp(1),www)*(*!dustem_previous_cc)
87 message,'SKIPPING color correction calculations',/info 90 message,'SKIPPING color correction calculations',/info
88 ; dustem_sed(ind_sed)=interpol(spec,ww,1.D0*(((*!dustem_data).wav)(ind_sed)))*(*!dustem_previous_cc) 91 ; dustem_sed(ind_sed)=interpol(spec,ww,1.D0*(((*!dustem_data).wav)(ind_sed)))*(*!dustem_previous_cc)
@@ -93,7 +96,7 @@ ENDELSE @@ -93,7 +96,7 @@ ENDELSE
93 ;For spectrum data points, interpolate in log-log 96 ;For spectrum data points, interpolate in log-log
94 ;Linear interpolation leads to wrong values, in particular where few 97 ;Linear interpolation leads to wrong values, in particular where few
95 ;wavelengths points exist in the model (long wavelengths). 98 ;wavelengths points exist in the model (long wavelengths).
96 -ind_spec=where((*!dustem_data.sed).filt_names EQ 'SPECTRUM',count_spec) 99 +ind_spec=where((*(*!dustem_data).sed).filt_names EQ 'SPECTRUM',count_spec)
97 IF count_spec NE 0 THEN BEGIN 100 IF count_spec NE 0 THEN BEGIN
98 dustem_sed[ind_spec]=interpol(spec,ww,(((*!dustem_data.sed).wav)[ind_spec])) 101 dustem_sed[ind_spec]=interpol(spec,ww,(((*!dustem_data.sed).wav)[ind_spec]))
99 ; dustem_sed(ind_spec)=10^interpol(alog10(spec),alog10(st.sed.wav),alog10((((*!dustem_data.sed).wav)(ind_spec)))) 102 ; dustem_sed(ind_spec)=10^interpol(alog10(spec),alog10(st.sed.wav),alog10((((*!dustem_data.sed).wav)(ind_spec))))
src/idl/dustem_compute_gb_sed_fast.pro
@@ -47,8 +47,10 @@ pp=double(p_dim) @@ -47,8 +47,10 @@ pp=double(p_dim)
47 w0=100. 47 w0=100.
48 48
49 ;GET THE OBSERVATIONS AND ERRORS 49 ;GET THE OBSERVATIONS AND ERRORS
50 -obs_sed = (*!dustem_data.sed).values  
51 -err_sed = (*!dustem_data.sed).sigma 50 +;obs_sed = (*!dustem_data.sed).values
  51 +;err_sed = (*!dustem_data.sed).sigma
  52 +obs_sed = (*(*!dustem_data).sed).values
  53 +err_sed = (*(*!dustem_data).sed).sigma
52 54
53 ;COMPUTE THE MODEL SED 55 ;COMPUTE THE MODEL SED
54 ;dustem_sed = obs_sed*0.D0 56 ;dustem_sed = obs_sed*0.D0
@@ -68,8 +70,8 @@ IF !dustem_do_cc NE 0 AND !dustem_never_do_cc EQ 0 THEN BEGIN @@ -68,8 +70,8 @@ IF !dustem_do_cc NE 0 AND !dustem_never_do_cc EQ 0 THEN BEGIN
68 ;waves=dindgen(NNw)/(1.*NNw-1)*(wwmax-wwmin)+wwmin 70 ;waves=dindgen(NNw)/(1.*NNw-1)*(wwmax-wwmin)+wwmin
69 spec=pp(0)*(waves/w0)^(-1.*pp(2))*dustem_planck_function(pp(1),waves) 71 spec=pp(0)*(waves/w0)^(-1.*pp(2))*dustem_planck_function(pp(1),waves)
70 ; dustem_sed(ind_sed)=dustem_cc(waves,spec,((*!dustem_data).filt_names)(ind_sed),cc=cc) 72 ; dustem_sed(ind_sed)=dustem_cc(waves,spec,((*!dustem_data).filt_names)(ind_sed),cc=cc)
71 - dustem_sed=dustem_cc(waves,spec,((*!dustem_data.sed).filt_names),cc=cc)  
72 - spec0=interpol(spec,waves,dustem_filter2wav((*!dustem_data.sed).filt_names)) 73 + dustem_sed=dustem_cc(waves,spec,(*(*!dustem_data).sed).filt_names,cc=cc)
  74 + spec0=interpol(spec,waves,dustem_filter2wav((*(*!dustem_data).sed).filt_names))
73 ;dustem_sed=spec0*cc 75 ;dustem_sed=spec0*cc
74 print,dustem_sed,cc,pp,spec0 76 print,dustem_sed,cc,pp,spec0
75 ;stop 77 ;stop
@@ -77,7 +79,7 @@ IF !dustem_do_cc NE 0 AND !dustem_never_do_cc EQ 0 THEN BEGIN @@ -77,7 +79,7 @@ IF !dustem_do_cc NE 0 AND !dustem_never_do_cc EQ 0 THEN BEGIN
77 ENDIF ELSE BEGIN ;(!dustem_do_cc EQ 0 OR !dustem_never_do_cc EQ 1) 79 ENDIF ELSE BEGIN ;(!dustem_do_cc EQ 0 OR !dustem_never_do_cc EQ 1)
78 message,'NOT DOING color correction calculations',/info 80 message,'NOT DOING color correction calculations',/info
79 ; waves=1.d0*dustem_filter2wav(((*!dustem_data).filt_names)(ind_sed)) 81 ; waves=1.d0*dustem_filter2wav(((*!dustem_data).filt_names)(ind_sed))
80 - waves=1.d0*dustem_filter2wav(((*!dustem_data.sed).filt_names)) 82 + waves=1.d0*dustem_filter2wav((*(*!dustem_data).sed).filt_names)
81 spec=pp(0)*(waves/w0)^(-1.*pp(2))*dustem_planck_function(pp(1),waves) 83 spec=pp(0)*(waves/w0)^(-1.*pp(2))*dustem_planck_function(pp(1),waves)
82 dustem_sed=spec*(*!dustem_previous_cc) 84 dustem_sed=spec*(*!dustem_previous_cc)
83 print,dustem_sed,*!dustem_previous_cc,pp,spec 85 print,dustem_sed,*!dustem_previous_cc,pp,spec
src/idl/dustem_gb_plot_fit_sed.pro
@@ -59,16 +59,21 @@ use_model_line=3 ;linestyle used for the model @@ -59,16 +59,21 @@ use_model_line=3 ;linestyle used for the model
59 ;=== plot the data SED 59 ;=== plot the data SED
60 dustem_plot_data_sed,_extra=extra 60 dustem_plot_data_sed,_extra=extra
61 61
  62 +wav=(*(*!dustem_data).sed).wav
  63 +values=(*(*!dustem_data).sed).values
  64 +filt_names=(*(*!dustem_data).sed).filt_names
  65 +sigma=(*(*!dustem_data).sed).sigma
  66 +
62 ;=== Over-Plot the computed SED 67 ;=== Over-Plot the computed SED
63 -ind_filt=where((*!dustem_data.sed).filt_names NE 'SPECTRUM',count_filt)  
64 -ind_spec=where((*!dustem_data.sed).filt_names EQ 'SPECTRUM',count_spec) 68 +ind_filt=where(filt_names NE 'SPECTRUM',count_filt)
  69 +ind_spec=where(filt_names EQ 'SPECTRUM',count_spec)
65 IF count_filt NE 0 THEN BEGIN 70 IF count_filt NE 0 THEN BEGIN
66 plotsym,8 71 plotsym,8
67 - cgoplot,((*!dustem_data.sed).wav)(ind_filt),sed(ind_filt),color=use_col_sed_filt,psym=8,syms=2 72 + cgoplot,wav[ind_filt],sed[ind_filt],color=use_col_sed_filt,psym=8,syms=2
68 ENDIF 73 ENDIF
69 IF count_spec NE 0 THEN BEGIN 74 IF count_spec NE 0 THEN BEGIN
70 plotsym,0 75 plotsym,0
71 - cgoplot,((*!dustem_data.sed).wav)(ind_spec),sed(ind_spec),color=use_col_sed_spec,psym=8,syms=0.5 76 + cgoplot,wav[ind_spec],sed[ind_spec],color=use_col_sed_spec,psym=8,syms=0.5
72 ENDIF 77 ENDIF
73 ;stop 78 ;stop
74 79
src/idl/dustem_plot_data_sed.pro
@@ -43,21 +43,26 @@ ENDIF @@ -43,21 +43,26 @@ ENDIF
43 use_col_data_spec=255 ;color for spectral data 43 use_col_data_spec=255 ;color for spectral data
44 use_col_data_filt=100 ;color for filter data 44 use_col_data_filt=100 ;color for filter data
45 45
46 -cgplot,(*!dustem_data.sed).wav,(*!dustem_data.sed).values,/nodata,_extra=extra,/xlog,/ylog  
47 -ind_filt=where((*!dustem_data.sed).filt_names NE 'SPECTRUM',count_filt)  
48 -ind_spec=where((*!dustem_data.sed).filt_names EQ 'SPECTRUM',count_spec) 46 +wav=(*(*!dustem_data).sed).wav
  47 +values=(*(*!dustem_data).sed).values
  48 +filt_names=(*(*!dustem_data).sed).filt_names
  49 +sigma=(*(*!dustem_data).sed).sigma
  50 +
  51 +cgplot,wav,values,/nodata,_extra=extra,/xlog,/ylog
  52 +ind_filt=where(filt_names NE 'SPECTRUM',count_filt)
  53 +ind_spec=where(filt_names EQ 'SPECTRUM',count_spec)
49 ;=== Plot the data 54 ;=== Plot the data
50 IF count_spec NE 0 THEN BEGIN 55 IF count_spec NE 0 THEN BEGIN
51 plotsym,0,/fill 56 plotsym,0,/fill
52 - cgoplot,((*!dustem_data.sed).wav)(ind_spec),((*!dustem_data.sed).values)(ind_spec),psym=8,_extra=extra,color=use_col_data_spec,syms=0.5 57 + cgoplot,wav[ind_spec],values[ind_spec],psym=8,_extra=extra,color=use_col_data_spec,syms=0.5
53 IF not keyword_set(no_spec_error) THEN BEGIN 58 IF not keyword_set(no_spec_error) THEN BEGIN
54 - err_bar,((*!dustem_data.sed).wav)(ind_spec),((*!dustem_data.sed).values)(ind_spec),yrms=3.*((*!dustem_data.sed).sigma)(ind_spec)/2.,color=use_col_data_spec 59 + err_bar,wav[ind_spec],values[ind_spec],yrms=3.*sigma[ind_spec]/2.,color=use_col_data_spec
55 ENDIF 60 ENDIF
56 ENDIF 61 ENDIF
57 IF count_filt NE 0 THEN BEGIN 62 IF count_filt NE 0 THEN BEGIN
58 plotsym,0,/fill 63 plotsym,0,/fill
59 - cgoplot,((*!dustem_data.sed).wav)(ind_filt),((*!dustem_data.sed).values)(ind_filt),psym=8,_extra=extra,color=use_col_data_filt  
60 - err_bar,((*!dustem_data.sed).wav)(ind_filt),((*!dustem_data.sed).values)(ind_filt),yrms=3.*((*!dustem_data.sed).sigma)(ind_filt)/2.,color=use_col_data_filt 64 + cgoplot,wav[ind_filt],values[ind_filt],psym=8,_extra=extra,color=use_col_data_filt
  65 + err_bar,wav[ind_filt],values[ind_filt],yrms=3.*sigma[ind_filt]/2.,color=use_col_data_filt
61 ENDIF 66 ENDIF
62 67
63 the_end: 68 the_end: