Commit 2139d37cbc08e2f176f0c68b36746239fda2e77c

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

ddaed Swift images

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
305 305 ;% RESTORE: Restored variable: ALL_SEDS.
306 306 muse_seds=all_seds
307 307 muse_filters=(*muse_seds[0]).filter
  308 +
  309 +;=== read the astrosat SEDs
308 310 file=data_dir+use_source_name+'_astrosat_seds_muse_pixels'+reso_str+'.sav'
309 311 st_info=file_info(file)
310 312 IF st_info.exists NE 1 THEN BEGIN
... ... @@ -316,6 +318,22 @@ restore,file,/verb
316 318 astrosat_seds=all_seds
317 319 astrosat_filters=(*astrosat_seds[0]).filter
318 320 N_astrosat_filters=n_elements(astrosat_filters)
  321 +
  322 +;=== read the Swift SEDs
  323 +file=data_dir+use_source_name+'_swift_seds_muse_pixels'+reso_str+'.sav'
  324 +st_info=file_info(file)
  325 +IF st_info.exists NE 1 THEN BEGIN
  326 + message,'Could not find '+file,/continue
  327 + stop
  328 +ENDIF
  329 +restore,file,/verb
  330 +;% RESTORE: Restored variable: ALL_SEDS.
  331 +swift_seds=all_seds
  332 +swift_filters=(*astrosat_seds[0]).filter
  333 +N_swift_filters=n_elements(astrosat_filters)
  334 +;stop
  335 +
  336 +;=== read the Herschel SEDs
319 337 file=data_dir+use_source_name+'_herschel_seds_muse_pixels'+reso_str+'.sav'
320 338 st_info=file_info(file)
321 339 IF st_info.exists NE 1 THEN BEGIN
... ... @@ -335,7 +353,7 @@ ENDIF
335 353 restore,file,/verb
336 354 ;% RESTORE: Restored variable: ALL_SEDS_INDICES.
337 355  
338   -help,astrosat_seds,muse_seds,jwst_seds,herschel_seds
  356 +help,astrosat_seds,swift_seds,muse_seds,jwst_seds,herschel_seds
339 357 ;stop
340 358  
341 359 Nvor=long(max(voronoi_id))+1 ;because Voronoi bins starts from 0
... ... @@ -364,7 +382,8 @@ ENDIF
364 382  
365 383 ;===== Compute seds pointer
366 384 one_sed=(*jwst_seds[0])
367   -all_filters=[jwst_filters,astrosat_filters,muse_filters]
  385 +;all_filters=[jwst_filters,astrosat_filters,muse_filters]
  386 +all_filters=[jwst_filters,astrosat_filters,swift_filters,muse_filters]
368 387 IF keyword_set(include_herschel) THEN BEGIN
369 388 all_filters=[all_filters,herschel_filters]
370 389 ENDIF
... ... @@ -375,16 +394,16 @@ nperc=5./100.
375 394 empty_sed=dustem_initialize_sed(Nfilters)
376 395 IF keyword_set(include_herschel) THEN BEGIN
377 396 FOR ii=0L,Nvor-1 DO BEGIN
378   - 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
379   - seds_ptr[ii]=ptr_new([*astrosat_seds[ii],*muse_seds[ii],*jwst_seds[ii],*herschel_seds[ii]])
  397 + 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
  398 + seds_ptr[ii]=ptr_new([*swift_seds[ii],*astrosat_seds[ii],*muse_seds[ii],*jwst_seds[ii],*herschel_seds[ii]])
380 399 ENDIF ELSE BEGIN
381 400 seds_ptr[ii]=ptr_new(empty_sed)
382 401 ENDELSE
383 402 ENDFOR
384 403 ENDIF ELSE BEGIN
385 404 FOR ii=0L,Nvor-1 DO BEGIN
386   - IF ptr_valid(astrosat_seds[ii]) AND ptr_valid(muse_seds[ii]) AND ptr_valid(jwst_seds[ii]) THEN BEGIN
387   - seds_ptr[ii]=ptr_new([*astrosat_seds[ii],*muse_seds[ii],*jwst_seds[ii]])
  405 + 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
  406 + seds_ptr[ii]=ptr_new([*swift_seds[ii],*astrosat_seds[ii],*muse_seds[ii],*jwst_seds[ii]])
388 407 ENDIF ELSE BEGIN
389 408 seds_ptr[ii]=ptr_new(empty_sed)
390 409 ENDELSE
... ... @@ -405,14 +424,14 @@ FOR ii=0L,Nvor-1 DO BEGIN
405 424 ENDFOR
406 425  
407 426 ;==== Brute force fit using ISRF classes
408   -
  427 +N_uv_filters=N_swift_filters+N_astrosat_filters
409 428 ;Nvor=max(voronoi_id)
410 429 F0s=fltarr(Nvor)+la_undef()
411 430 G0s=fltarr(Nvor)+la_undef()
412 431 EBVs=fltarr(Nvor)+la_undef()
413   -EBVs_uv=fltarr(Nvor,N_astrosat_filters)+la_undef()
  432 +EBVs_uv=fltarr(Nvor,N_uv_filters)+la_undef()
414 433 tausV=fltarr(Nvor)+la_undef()
415   -taus_uv=fltarr(Nvor,N_astrosat_filters)+la_undef()
  434 +taus_uv=fltarr(Nvor,N_uv_filters)+la_undef()
416 435 observed_seds=ptrarr(Nvor) ;All observed SEDs
417 436 best_fit_seds=ptrarr(Nvor) ;All best fit SEDs
418 437 Ygrain1=fltarr(Nvor)+la_undef()
... ... @@ -461,6 +480,9 @@ IF keyword_set(resolution_filter) OR keyword_set(resolution_value) THEN BEGIN
461 480 ind=where(use_fit_instru EQ 'ASTROSAT',count)
462 481 ;IF count NE 0 THEN use_fit_reso[ind]=4./60.^2 ;CAUTION: This is made up
463 482 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
  483 + ind=where(use_fit_instru EQ 'SWIFT',count)
  484 + ;IF count NE 0 THEN use_fit_reso[ind]=4./60.^2 ;CAUTION: This is made up
  485 + 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
464 486 ind=where(use_fit_instru EQ 'SDSS',count)
465 487 IF count NE 0 THEN use_fit_reso[ind]=1./60.^2
466 488 ind=where(use_fit_reso LE reso,count)
... ... @@ -536,8 +558,10 @@ wav_ebv_star=dustem_filter2wav(use_ebv_filters)
536 558 ;use_ebv_uv_filters=dustem_filter_names2filters(starlight_ebv_uv_names)
537 559 ;N_ebv_uv_filters=n_elements(starlight_ebv_uv_names)
538 560 ;=== This is to use all astrosat filters for extinction analysis
539   -use_ebv_uv_filters=astrosat_filters
540   -N_ebv_uv_filters=N_astrosat_filters
  561 +;use_ebv_uv_filters=astrosat_filters
  562 +use_ebv_uv_filters=[swift_filters,astrosat_filters]
  563 +;N_ebv_uv_filters=N_astrosat_filters
  564 +N_ebv_uv_filters=n_elements(use_ebv_uv_filters)
541 565 wav_ebv_uv_star=dustem_filter2wav(use_ebv_uv_filters)
542 566 EBV_uv=fltarr(N_ebv_uv_filters)
543 567 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
921 945 ind=where(Ygrain3_hit[ind_class] EQ -1,count)
922 946 hit_st[isrf_class].nhitYG3down=count
923 947 hit_st_perc[isrf_class].nhitYG3down=(1.*count)/Nvor_class*100.
924   - write_xcat,st,'/tmp/'+getenv('LOGNAME')+'/essai.xcat'
  948 + ddir='/tmp/'+getenv('LOGNAME')
  949 + force_mkdir,ddir
  950 + write_xcat,st,ddir+'/essai.xcat'
925 951 ;write_xcat,hit_st,'/tmp/'+getenv('LOGNAME')+'/essai.xcat'
926   - write_xcat,hit_st_perc,'/tmp/'+getenv('LOGNAME')+'/essai.xcat'
  952 + write_xcat,hit_st_perc,ddir+'/essai.xcat'
927 953 ENDIF ELSE BEGIN
928 954 message,'No Voronoi bins found with ISRF class '+strtrim(isrf_class,2),/continue
929 955 ENDELSE
... ...
LabTools/IRAP/JPB/phangs_extract_seds.pro
... ... @@ -125,6 +125,15 @@ restore,file,/verb ;changed to astrosat_images
125 125 ;% RESTORE: Restored variable: ASTROSAT_FILTERS.
126 126 ;% RESTORE: Restored variable: HREF.
127 127  
  128 +;==== read the SWIFT data
  129 +file=data_dir+use_source_name+'_swift_images'+reso_str+'.sav'
  130 +st_info=file_info(file)
  131 +IF st_info.exists NE 1 THEN BEGIN
  132 + message,'Could not find '+file,/continue
  133 + stop
  134 +ENDIF
  135 +restore,file,/verb
  136 +
128 137 ;==== read the MUSE filter data
129 138 file=data_dir+use_source_name+'_muse_filters_images'+reso_str+'.sav'
130 139 st_info=file_info(file)
... ... @@ -149,7 +158,7 @@ restore,file,/verb
149 158 ;% RESTORE: Restored variable: HERSCHEL_FILTERS.
150 159 ;% RESTORE: Restored variable: HREF.
151 160  
152   -help,jwst_images,astrosat_images,muse_images,herschel_images
  161 +help,jwst_images,astrosat_images,swift_images,muse_images,herschel_images
153 162 ;=== Here should test that all images have the same size
154 163 ;stop
155 164  
... ... @@ -201,6 +210,18 @@ ENDIF ELSE BEGIN
201 210 stop
202 211 ENDELSE
203 212  
  213 +;==== If the SWIFT SED file does not already exist, do it. Extract SWIFT SEDs, using previously computed all_seds_indices
  214 +file_save=data_dir+use_source_name+'_swift_seds_muse_pixels'+reso_str+'.sav'
  215 +res=file_info(file_save)
  216 +IF not res.exists THEN BEGIN
  217 + all_seds=extract_all_muse_phangs_seds(source_name,voronoi_id,swift_images,swift_filters,use_these_indices=all_seds_indices,counts=counts)
  218 + save,all_seds,file=file_save
  219 + message,'Saved '+file_save,/info
  220 +ENDIF ELSE BEGIN
  221 + message,'File '+file_save+' already exist',/continue
  222 + stop
  223 +ENDELSE
  224 +
204 225 ;==== If the HERSCHEL SED file does not already exist, do it. Extract HERSCHEL SEDs, using previously computed all_seds_indices
205 226 file_save=data_dir+use_source_name+'_herschel_seds_muse_pixels'+reso_str+'.sav'
206 227 res=file_info(file_save)
... ...
LabTools/IRAP/JPB/phangs_isrf_pipeline.pro
... ... @@ -141,6 +141,7 @@ phangs_make_co_images,source_name='ngc0628',/save,/show,/nostop,resolution_filte
141 141 phangs_make_hi_images,source_name='ngc0628',/save,/show,/nostop,resolution_filter='PACS3'
142 142 phangs_make_muse_filters_images,source_name='ngc0628',/save,/show,/nostop,resolution_filter='PACS3'
143 143 phangs_make_astrosat_images,source_name='ngc0628',/save,/show,/nostop,resolution_filter='PACS3'
  144 +phangs_make_swift_images,source_name='ngc0628',/save,/show,/nostop,resolution_filter='PACS3'
144 145 phangs_make_herschel_images,source_name='ngc0628',/save,/show,/nostop,resolution_filter='PACS3'
145 146  
146 147 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
165 166 ;fit map using MUSE derived ISRF
166 167 table_name_root='_logn_MuseISRF_JWST_adaptedG0_Ypah1added_Yvsgadded_4Phangs_noionis_F0upext' ;Uses extended F0 range ....
167 168 class_min_max=0
168   -show_sed=0
  169 +;show_sed=1 & nostop=0
  170 +show_sed=0 & nostop=1
169 171 phangs_brute_force_fit_with_isrf_grid,model='DL07',source_name='ngc0628',/include_herschel,/normalize,/fit_G0,/save,resolution_filter='PACS3' $
170   - ,/subtract_star_light,show_sed=show_sed,/nostop,table_name_root=table_name_root,class_min_max=class_min_max
  172 + ,/subtract_star_light,show_sed=show_sed,nostop=nostop,table_name_root=table_name_root,class_min_max=class_min_max
171 173  
172 174 ;doing postscripts
173 175 table_name_root='_logn_MuseISRF_JWST_adaptedG0_Ypah1added_Yvsgadded_4Phangs_noionis_F0upext'
... ...