phangs_extract_seds.pro 2.74 KB
PRO phangs_extract_seds,source_name=source_name,save=save,show_images=show_images,nostop=nostop

;phangs_extract_seds,source_name='ngc0628',show_images=show_images,nostop=nostop

use_source_name='ngc0628'
IF keyword_set(source_name) THEN use_source_name=source_name

data_dir=!phangs_data_dir+'/ISRF/WORK/'

extract_seds:

restore,data_dir+use_source_name+'_jwst_images.sav',/verb
;% RESTORE: Restored variable: JWST_IMAGES.
;% RESTORE: Restored variable: FILTERS.
;% RESTORE: Restored variable: HREF.
;% RESTORE: Restored variable: NHCO.
restore,data_dir+use_source_name+'_muse_images.sav',/verb
;% RESTORE: Restored variable: ST_TEMPLATES.
;% RESTORE: Restored variable: ST_MUSE_WEIGHTS.
;% RESTORE: Restored variable: VORONOI_ID.
;% RESTORE: Restored variable: AGE_VALUES.
;% RESTORE: Restored variable: METALICITY_VALUES.
;% RESTORE: Restored variable: BINS.
;% RESTORE: Restored variable: HREF.
restore,data_dir+use_source_name+'_astrosat_data.sav',/verb
;% RESTORE: Restored variable: ASTROSAT_IMAGES.
;% RESTORE: Restored variable: ASTROSAT_FILTERS.
;% RESTORE: Restored variable: HREF.
restore,data_dir+use_source_name+'_muse_filters_data.sav',/verb

;stop

;=== extract and save observed seds in Muse Voronoi bins
file_save=data_dir+use_source_name+'_jwst_seds_muse_pixels.sav'
extract_all_muse_phangs_seds,source_name,voronoi_id,jwst_images,filters,indices=all_seds_indices,file=file_save,counts=counts
restore,data_dir+'ngc0628_jwst_seds_muse_pixels.sav',/verb  ;just to get the all_seds_indices variable
file_save=data_dir+use_source_name+'_muse_seds_muse_pixels.sav'
extract_all_muse_phangs_seds,source_name,voronoi_id,muse_images,muse_filters,use_these_indices=all_seds_indices,file=file_save,counts=counts
file_save=data_dir+use_source_name+'_astrosat_seds_muse_pixels.sav'
extract_all_muse_phangs_seds,source_name,voronoi_id,astrosat_images,astrosat_filters,use_these_indices=all_seds_indices,file=file_save,counts=counts

;==== The following is not really useful, can be done through SED aggregation later
;==== However, not equivalent to the above, because of undefined pixels in some of the images, and the way this is handled by sed extractor
stop
use_filters=[astrosat_filters,muse_filters,filters]
use_Nfilters=n_elements(use_filters)
use_images=fltarr([sxpar(href,'NAXIS1'),sxpar(href,'NAXIS2'),2,use_Nfilters])
use_images[*,*,*,0:n_elements(filters)-1]=jwst_images
use_images[*,*,*,n_elements(filters):n_elements(filters)+n_elements(muse_filters)-1]=muse_images
use_images[*,*,*,n_elements(filters)+n_elements(muse_filters):n_elements(filters)+n_elements(muse_filters)+n_elements(astrosat_filters)-1]=astrosat_images

extract_all_muse_phangs_seds,source_name,voronoi_id,use_images,use_filters,indices=all_seds_indices,file=data_dir+'ngc0628_all_seds_muse_pixels.sav',counts=counts

END