From cdd2763e6a8ae46c523fb452928dc4188a5f65a9 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bernard Date: Thu, 13 Oct 2022 14:51:14 +0200 Subject: [PATCH] brought up to date with new fomr of dustem_data system variable --- src/idl/dustem_compute_gb_sed.pro | 13 ++++++++----- src/idl/dustem_compute_gb_sed_fast.pro | 12 +++++++----- src/idl/dustem_gb_plot_fit_sed.pro | 13 +++++++++---- src/idl/dustem_plot_data_sed.pro | 19 ++++++++++++------- 4 files changed, 36 insertions(+), 21 deletions(-) diff --git a/src/idl/dustem_compute_gb_sed.pro b/src/idl/dustem_compute_gb_sed.pro index d3faed5..8df9ffa 100755 --- a/src/idl/dustem_compute_gb_sed.pro +++ b/src/idl/dustem_compute_gb_sed.pro @@ -57,11 +57,14 @@ ww=10.^ww waves=ww ;MAKE A COPY OF THE (EMPTY) OBSERVED VALUES -obs_sed = (*!dustem_data.sed).values +;stop +obs_sed = (*(*!dustem_data).sed).values + +;obs_sed = (*!dustem_data.sed).values ;COMPUTE THE MODEL SED dustem_sed = obs_sed*0.D0 -ind_sed=where((*!dustem_data.sed).filt_names NE 'SPECTRUM',count_sed) +ind_sed=where((*(*!dustem_data).sed).filt_names NE 'SPECTRUM',count_sed) IF !dustem_do_cc NE 0 AND !dustem_never_do_cc EQ 0 THEN BEGIN 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 spec=pp(0)*(ww)^(-1.*pp(2))*dustem_planck_function(pp(1),ww) ; filter_names=((*!dustem_data).filt_names)(ind_sed) ; FOR ii=0L,n_elements(filter_names)-1 DO BEGIN - ssed=dustem_cc(ww,spec,((*!dustem_data.sed).filt_names)(ind_sed),cc=cc) + ssed=dustem_cc(ww,spec,((*(*!dustem_data).sed).filt_names)(ind_sed),cc=cc) ;print,cc ; ENDFOR dustem_sed[ind_sed]=ssed ENDIF ENDIF ELSE BEGIN - www=dustem_filter2wav(((*!dustem_data.sed).filt_names)[ind_sed]) + www=dustem_filter2wav(((*(*!dustem_data).sed).filt_names)[ind_sed]) dustem_sed[ind_sed]=pp(0)*(www)^(-1.*pp(2))*dustem_planck_function(pp(1),www)*(*!dustem_previous_cc) message,'SKIPPING color correction calculations',/info ; dustem_sed(ind_sed)=interpol(spec,ww,1.D0*(((*!dustem_data).wav)(ind_sed)))*(*!dustem_previous_cc) @@ -93,7 +96,7 @@ ENDELSE ;For spectrum data points, interpolate in log-log ;Linear interpolation leads to wrong values, in particular where few ;wavelengths points exist in the model (long wavelengths). -ind_spec=where((*!dustem_data.sed).filt_names EQ 'SPECTRUM',count_spec) +ind_spec=where((*(*!dustem_data).sed).filt_names EQ 'SPECTRUM',count_spec) IF count_spec NE 0 THEN BEGIN dustem_sed[ind_spec]=interpol(spec,ww,(((*!dustem_data.sed).wav)[ind_spec])) ; dustem_sed(ind_spec)=10^interpol(alog10(spec),alog10(st.sed.wav),alog10((((*!dustem_data.sed).wav)(ind_spec)))) diff --git a/src/idl/dustem_compute_gb_sed_fast.pro b/src/idl/dustem_compute_gb_sed_fast.pro index cc5ed50..c7e6068 100755 --- a/src/idl/dustem_compute_gb_sed_fast.pro +++ b/src/idl/dustem_compute_gb_sed_fast.pro @@ -47,8 +47,10 @@ pp=double(p_dim) w0=100. ;GET THE OBSERVATIONS AND ERRORS -obs_sed = (*!dustem_data.sed).values -err_sed = (*!dustem_data.sed).sigma +;obs_sed = (*!dustem_data.sed).values +;err_sed = (*!dustem_data.sed).sigma +obs_sed = (*(*!dustem_data).sed).values +err_sed = (*(*!dustem_data).sed).sigma ;COMPUTE THE MODEL SED ;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 ;waves=dindgen(NNw)/(1.*NNw-1)*(wwmax-wwmin)+wwmin spec=pp(0)*(waves/w0)^(-1.*pp(2))*dustem_planck_function(pp(1),waves) ; dustem_sed(ind_sed)=dustem_cc(waves,spec,((*!dustem_data).filt_names)(ind_sed),cc=cc) - dustem_sed=dustem_cc(waves,spec,((*!dustem_data.sed).filt_names),cc=cc) - spec0=interpol(spec,waves,dustem_filter2wav((*!dustem_data.sed).filt_names)) + dustem_sed=dustem_cc(waves,spec,(*(*!dustem_data).sed).filt_names,cc=cc) + spec0=interpol(spec,waves,dustem_filter2wav((*(*!dustem_data).sed).filt_names)) ;dustem_sed=spec0*cc print,dustem_sed,cc,pp,spec0 ;stop @@ -77,7 +79,7 @@ IF !dustem_do_cc NE 0 AND !dustem_never_do_cc EQ 0 THEN BEGIN ENDIF ELSE BEGIN ;(!dustem_do_cc EQ 0 OR !dustem_never_do_cc EQ 1) message,'NOT DOING color correction calculations',/info ; waves=1.d0*dustem_filter2wav(((*!dustem_data).filt_names)(ind_sed)) - waves=1.d0*dustem_filter2wav(((*!dustem_data.sed).filt_names)) + waves=1.d0*dustem_filter2wav((*(*!dustem_data).sed).filt_names) spec=pp(0)*(waves/w0)^(-1.*pp(2))*dustem_planck_function(pp(1),waves) dustem_sed=spec*(*!dustem_previous_cc) print,dustem_sed,*!dustem_previous_cc,pp,spec diff --git a/src/idl/dustem_gb_plot_fit_sed.pro b/src/idl/dustem_gb_plot_fit_sed.pro index 8244950..ba3cd25 100755 --- a/src/idl/dustem_gb_plot_fit_sed.pro +++ b/src/idl/dustem_gb_plot_fit_sed.pro @@ -59,16 +59,21 @@ use_model_line=3 ;linestyle used for the model ;=== plot the data SED dustem_plot_data_sed,_extra=extra +wav=(*(*!dustem_data).sed).wav +values=(*(*!dustem_data).sed).values +filt_names=(*(*!dustem_data).sed).filt_names +sigma=(*(*!dustem_data).sed).sigma + ;=== Over-Plot the computed SED -ind_filt=where((*!dustem_data.sed).filt_names NE 'SPECTRUM',count_filt) -ind_spec=where((*!dustem_data.sed).filt_names EQ 'SPECTRUM',count_spec) +ind_filt=where(filt_names NE 'SPECTRUM',count_filt) +ind_spec=where(filt_names EQ 'SPECTRUM',count_spec) IF count_filt NE 0 THEN BEGIN plotsym,8 - cgoplot,((*!dustem_data.sed).wav)(ind_filt),sed(ind_filt),color=use_col_sed_filt,psym=8,syms=2 + cgoplot,wav[ind_filt],sed[ind_filt],color=use_col_sed_filt,psym=8,syms=2 ENDIF IF count_spec NE 0 THEN BEGIN plotsym,0 - cgoplot,((*!dustem_data.sed).wav)(ind_spec),sed(ind_spec),color=use_col_sed_spec,psym=8,syms=0.5 + cgoplot,wav[ind_spec],sed[ind_spec],color=use_col_sed_spec,psym=8,syms=0.5 ENDIF ;stop diff --git a/src/idl/dustem_plot_data_sed.pro b/src/idl/dustem_plot_data_sed.pro index 6d79b0d..86b9756 100755 --- a/src/idl/dustem_plot_data_sed.pro +++ b/src/idl/dustem_plot_data_sed.pro @@ -43,21 +43,26 @@ ENDIF use_col_data_spec=255 ;color for spectral data use_col_data_filt=100 ;color for filter data -cgplot,(*!dustem_data.sed).wav,(*!dustem_data.sed).values,/nodata,_extra=extra,/xlog,/ylog -ind_filt=where((*!dustem_data.sed).filt_names NE 'SPECTRUM',count_filt) -ind_spec=where((*!dustem_data.sed).filt_names EQ 'SPECTRUM',count_spec) +wav=(*(*!dustem_data).sed).wav +values=(*(*!dustem_data).sed).values +filt_names=(*(*!dustem_data).sed).filt_names +sigma=(*(*!dustem_data).sed).sigma + +cgplot,wav,values,/nodata,_extra=extra,/xlog,/ylog +ind_filt=where(filt_names NE 'SPECTRUM',count_filt) +ind_spec=where(filt_names EQ 'SPECTRUM',count_spec) ;=== Plot the data IF count_spec NE 0 THEN BEGIN plotsym,0,/fill - 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 + cgoplot,wav[ind_spec],values[ind_spec],psym=8,_extra=extra,color=use_col_data_spec,syms=0.5 IF not keyword_set(no_spec_error) THEN BEGIN - 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 + err_bar,wav[ind_spec],values[ind_spec],yrms=3.*sigma[ind_spec]/2.,color=use_col_data_spec ENDIF ENDIF IF count_filt NE 0 THEN BEGIN plotsym,0,/fill - cgoplot,((*!dustem_data.sed).wav)(ind_filt),((*!dustem_data.sed).values)(ind_filt),psym=8,_extra=extra,color=use_col_data_filt - 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 + cgoplot,wav[ind_filt],values[ind_filt],psym=8,_extra=extra,color=use_col_data_filt + err_bar,wav[ind_filt],values[ind_filt],yrms=3.*sigma[ind_filt]/2.,color=use_col_data_filt ENDIF the_end: -- libgit2 0.21.2