diff --git a/LabTools/IRAP/JPB/phangs_brute_force_fit_with_isrf_grid.pro b/LabTools/IRAP/JPB/phangs_brute_force_fit_with_isrf_grid.pro index 7c26d85..4e25b00 100644 --- a/LabTools/IRAP/JPB/phangs_brute_force_fit_with_isrf_grid.pro +++ b/LabTools/IRAP/JPB/phangs_brute_force_fit_with_isrf_grid.pro @@ -305,6 +305,8 @@ restore,file,/verb ;contains the Muse SEDs in voronoi bins ;% RESTORE: Restored variable: ALL_SEDS. muse_seds=all_seds muse_filters=(*muse_seds[0]).filter + +;=== read the astrosat SEDs file=data_dir+use_source_name+'_astrosat_seds_muse_pixels'+reso_str+'.sav' st_info=file_info(file) IF st_info.exists NE 1 THEN BEGIN @@ -316,6 +318,22 @@ restore,file,/verb astrosat_seds=all_seds astrosat_filters=(*astrosat_seds[0]).filter N_astrosat_filters=n_elements(astrosat_filters) + +;=== read the Swift SEDs +file=data_dir+use_source_name+'_swift_seds_muse_pixels'+reso_str+'.sav' +st_info=file_info(file) +IF st_info.exists NE 1 THEN BEGIN + message,'Could not find '+file,/continue + stop +ENDIF +restore,file,/verb +;% RESTORE: Restored variable: ALL_SEDS. +swift_seds=all_seds +swift_filters=(*astrosat_seds[0]).filter +N_swift_filters=n_elements(astrosat_filters) +;stop + +;=== read the Herschel SEDs file=data_dir+use_source_name+'_herschel_seds_muse_pixels'+reso_str+'.sav' st_info=file_info(file) IF st_info.exists NE 1 THEN BEGIN @@ -335,7 +353,7 @@ ENDIF restore,file,/verb ;% RESTORE: Restored variable: ALL_SEDS_INDICES. -help,astrosat_seds,muse_seds,jwst_seds,herschel_seds +help,astrosat_seds,swift_seds,muse_seds,jwst_seds,herschel_seds ;stop Nvor=long(max(voronoi_id))+1 ;because Voronoi bins starts from 0 @@ -364,7 +382,8 @@ ENDIF ;===== Compute seds pointer one_sed=(*jwst_seds[0]) -all_filters=[jwst_filters,astrosat_filters,muse_filters] +;all_filters=[jwst_filters,astrosat_filters,muse_filters] +all_filters=[jwst_filters,astrosat_filters,swift_filters,muse_filters] IF keyword_set(include_herschel) THEN BEGIN all_filters=[all_filters,herschel_filters] ENDIF @@ -375,16 +394,16 @@ nperc=5./100. empty_sed=dustem_initialize_sed(Nfilters) IF keyword_set(include_herschel) THEN BEGIN FOR ii=0L,Nvor-1 DO BEGIN - IF ptr_valid(astrosat_seds[ii]) AND ptr_valid(muse_seds[ii]) AND ptr_valid(jwst_seds[ii]) AND ptr_valid(herschel_seds[ii]) THEN BEGIN - seds_ptr[ii]=ptr_new([*astrosat_seds[ii],*muse_seds[ii],*jwst_seds[ii],*herschel_seds[ii]]) + IF ptr_valid(swift_seds[ii]) AND ptr_valid(astrosat_seds[ii]) AND ptr_valid(muse_seds[ii]) AND ptr_valid(jwst_seds[ii]) AND ptr_valid(herschel_seds[ii]) THEN BEGIN + seds_ptr[ii]=ptr_new([*swift_seds[ii],*astrosat_seds[ii],*muse_seds[ii],*jwst_seds[ii],*herschel_seds[ii]]) ENDIF ELSE BEGIN seds_ptr[ii]=ptr_new(empty_sed) ENDELSE ENDFOR ENDIF ELSE BEGIN FOR ii=0L,Nvor-1 DO BEGIN - IF ptr_valid(astrosat_seds[ii]) AND ptr_valid(muse_seds[ii]) AND ptr_valid(jwst_seds[ii]) THEN BEGIN - seds_ptr[ii]=ptr_new([*astrosat_seds[ii],*muse_seds[ii],*jwst_seds[ii]]) + IF ptr_valid(swift_seds[ii]) AND ptr_valid(astrosat_seds[ii]) AND ptr_valid(muse_seds[ii]) AND ptr_valid(jwst_seds[ii]) THEN BEGIN + seds_ptr[ii]=ptr_new([*swift_seds[ii],*astrosat_seds[ii],*muse_seds[ii],*jwst_seds[ii]]) ENDIF ELSE BEGIN seds_ptr[ii]=ptr_new(empty_sed) ENDELSE @@ -405,14 +424,14 @@ FOR ii=0L,Nvor-1 DO BEGIN ENDFOR ;==== Brute force fit using ISRF classes - +N_uv_filters=N_swift_filters+N_astrosat_filters ;Nvor=max(voronoi_id) F0s=fltarr(Nvor)+la_undef() G0s=fltarr(Nvor)+la_undef() EBVs=fltarr(Nvor)+la_undef() -EBVs_uv=fltarr(Nvor,N_astrosat_filters)+la_undef() +EBVs_uv=fltarr(Nvor,N_uv_filters)+la_undef() tausV=fltarr(Nvor)+la_undef() -taus_uv=fltarr(Nvor,N_astrosat_filters)+la_undef() +taus_uv=fltarr(Nvor,N_uv_filters)+la_undef() observed_seds=ptrarr(Nvor) ;All observed SEDs best_fit_seds=ptrarr(Nvor) ;All best fit SEDs Ygrain1=fltarr(Nvor)+la_undef() @@ -461,6 +480,9 @@ IF keyword_set(resolution_filter) OR keyword_set(resolution_value) THEN BEGIN ind=where(use_fit_instru EQ 'ASTROSAT',count) ;IF count NE 0 THEN use_fit_reso[ind]=4./60.^2 ;CAUTION: This is made up IF count NE 0 THEN use_fit_reso[ind]=1./60.^2 ;CAUTION: This is made up to keep astrosat all the way down to 1 arcsec + ind=where(use_fit_instru EQ 'SWIFT',count) + ;IF count NE 0 THEN use_fit_reso[ind]=4./60.^2 ;CAUTION: This is made up + IF count NE 0 THEN use_fit_reso[ind]=1./60.^2 ;CAUTION: This is made up to keep swift all the way down to 1 arcsec ind=where(use_fit_instru EQ 'SDSS',count) IF count NE 0 THEN use_fit_reso[ind]=1./60.^2 ind=where(use_fit_reso LE reso,count) @@ -536,8 +558,10 @@ wav_ebv_star=dustem_filter2wav(use_ebv_filters) ;use_ebv_uv_filters=dustem_filter_names2filters(starlight_ebv_uv_names) ;N_ebv_uv_filters=n_elements(starlight_ebv_uv_names) ;=== This is to use all astrosat filters for extinction analysis -use_ebv_uv_filters=astrosat_filters -N_ebv_uv_filters=N_astrosat_filters +;use_ebv_uv_filters=astrosat_filters +use_ebv_uv_filters=[swift_filters,astrosat_filters] +;N_ebv_uv_filters=N_astrosat_filters +N_ebv_uv_filters=n_elements(use_ebv_uv_filters) wav_ebv_uv_star=dustem_filter2wav(use_ebv_uv_filters) EBV_uv=fltarr(N_ebv_uv_filters) tau_uv=fltarr(N_ebv_uv_filters) @@ -921,9 +945,11 @@ FOR isrf_class=class_min,class_max DO BEGIN ;isrf_class runs from 1 ind=where(Ygrain3_hit[ind_class] EQ -1,count) hit_st[isrf_class].nhitYG3down=count hit_st_perc[isrf_class].nhitYG3down=(1.*count)/Nvor_class*100. - write_xcat,st,'/tmp/'+getenv('LOGNAME')+'/essai.xcat' + ddir='/tmp/'+getenv('LOGNAME') + force_mkdir,ddir + write_xcat,st,ddir+'/essai.xcat' ;write_xcat,hit_st,'/tmp/'+getenv('LOGNAME')+'/essai.xcat' - write_xcat,hit_st_perc,'/tmp/'+getenv('LOGNAME')+'/essai.xcat' + write_xcat,hit_st_perc,ddir+'/essai.xcat' ENDIF ELSE BEGIN message,'No Voronoi bins found with ISRF class '+strtrim(isrf_class,2),/continue ENDELSE diff --git a/LabTools/IRAP/JPB/phangs_extract_seds.pro b/LabTools/IRAP/JPB/phangs_extract_seds.pro index 09546ed..02279e2 100644 --- a/LabTools/IRAP/JPB/phangs_extract_seds.pro +++ b/LabTools/IRAP/JPB/phangs_extract_seds.pro @@ -125,6 +125,15 @@ restore,file,/verb ;changed to astrosat_images ;% RESTORE: Restored variable: ASTROSAT_FILTERS. ;% RESTORE: Restored variable: HREF. +;==== read the SWIFT data +file=data_dir+use_source_name+'_swift_images'+reso_str+'.sav' +st_info=file_info(file) +IF st_info.exists NE 1 THEN BEGIN + message,'Could not find '+file,/continue + stop +ENDIF +restore,file,/verb + ;==== read the MUSE filter data file=data_dir+use_source_name+'_muse_filters_images'+reso_str+'.sav' st_info=file_info(file) @@ -149,7 +158,7 @@ restore,file,/verb ;% RESTORE: Restored variable: HERSCHEL_FILTERS. ;% RESTORE: Restored variable: HREF. -help,jwst_images,astrosat_images,muse_images,herschel_images +help,jwst_images,astrosat_images,swift_images,muse_images,herschel_images ;=== Here should test that all images have the same size ;stop @@ -201,6 +210,18 @@ ENDIF ELSE BEGIN stop ENDELSE +;==== If the SWIFT SED file does not already exist, do it. Extract SWIFT SEDs, using previously computed all_seds_indices +file_save=data_dir+use_source_name+'_swift_seds_muse_pixels'+reso_str+'.sav' +res=file_info(file_save) +IF not res.exists THEN BEGIN + all_seds=extract_all_muse_phangs_seds(source_name,voronoi_id,swift_images,swift_filters,use_these_indices=all_seds_indices,counts=counts) + save,all_seds,file=file_save + message,'Saved '+file_save,/info +ENDIF ELSE BEGIN + message,'File '+file_save+' already exist',/continue + stop +ENDELSE + ;==== If the HERSCHEL SED file does not already exist, do it. Extract HERSCHEL SEDs, using previously computed all_seds_indices file_save=data_dir+use_source_name+'_herschel_seds_muse_pixels'+reso_str+'.sav' res=file_info(file_save) diff --git a/LabTools/IRAP/JPB/phangs_isrf_pipeline.pro b/LabTools/IRAP/JPB/phangs_isrf_pipeline.pro index fb1b479..ab1cfd2 100644 --- a/LabTools/IRAP/JPB/phangs_isrf_pipeline.pro +++ b/LabTools/IRAP/JPB/phangs_isrf_pipeline.pro @@ -141,6 +141,7 @@ phangs_make_co_images,source_name='ngc0628',/save,/show,/nostop,resolution_filte phangs_make_hi_images,source_name='ngc0628',/save,/show,/nostop,resolution_filter='PACS3' phangs_make_muse_filters_images,source_name='ngc0628',/save,/show,/nostop,resolution_filter='PACS3' phangs_make_astrosat_images,source_name='ngc0628',/save,/show,/nostop,resolution_filter='PACS3' +phangs_make_swift_images,source_name='ngc0628',/save,/show,/nostop,resolution_filter='PACS3' phangs_make_herschel_images,source_name='ngc0628',/save,/show,/nostop,resolution_filter='PACS3' phangs_make_muse_filters_data,source_name='ngc0628',/save,/show,/nostop,resolution_filter='PACS3' @@ -165,9 +166,10 @@ phangs_brute_force_fit_with_isrf_grid,model='DL07',source_name='ngc0628',/includ ;fit map using MUSE derived ISRF table_name_root='_logn_MuseISRF_JWST_adaptedG0_Ypah1added_Yvsgadded_4Phangs_noionis_F0upext' ;Uses extended F0 range .... class_min_max=0 -show_sed=0 +;show_sed=1 & nostop=0 +show_sed=0 & nostop=1 phangs_brute_force_fit_with_isrf_grid,model='DL07',source_name='ngc0628',/include_herschel,/normalize,/fit_G0,/save,resolution_filter='PACS3' $ - ,/subtract_star_light,show_sed=show_sed,/nostop,table_name_root=table_name_root,class_min_max=class_min_max + ,/subtract_star_light,show_sed=show_sed,nostop=nostop,table_name_root=table_name_root,class_min_max=class_min_max ;doing postscripts table_name_root='_logn_MuseISRF_JWST_adaptedG0_Ypah1added_Yvsgadded_4Phangs_noionis_F0upext' -- libgit2 0.21.2