PRO phangs_make_isrf_product,source_name,voronoi_id,ISRFS,G0s,object_distance,object_thickness,help=help ;+ ; NAME: ; phangs_make_isrf_product ; CALLING SEQUENCE: ; phangs_make_isrf_product,source_name,voronoi_id,ISRFS,G0s,object_distance,object_thickness,help=help ; PURPOSE: ; make and saves an ISRF product fits file ; INPUTS: ; source_name,voronoi_id,ISRFS,G0s,object_distance,object_thickness,help=help ; OPTIONAL KEYWORDS: ; save = if set, save the classes ; help = if set, print this help ; OUTPUTS: ; None ; OPTIONAL INPUT: ; ; OPTIONAL OUTPUT: ; None ; PROCEDURE AND SUBROUTINE USED ; ISRF saved is the one predicted by dustem_plugin_phangs_stellar_isrf for each Muse Voronoi bin, ; scaled in amplitude to match the Muse filter data for that Voronoi bin. ; The G0 value computed is wrt the Mathis field at 1 mic. ; SIDE EFFECTS: ; produces file _isrf_min_prediction.fits ; EXAMPLE: ; phangs_make_isrf_product,'ngc0628' ; MODIFICATION HISTORY: ; written by Jean-Philippe Bernard ;- IF keyword_set(help) THEN BEGIN doc_library,'phangs_make_isrf_product' goto,the_end ENDIF dustem_init data_dir=!phangs_data_dir+'/ISRF/WORK/' file=data_dir+source_name+'_isrf_min_prediction.sav' restore,file,/verb ;% RESTORE: Restored variable: ISRFS. ;% RESTORE: Restored variable: G0S. ;% RESTORE: Restored variable: OBJECT_DISTANCE. ;% RESTORE: Restored variable: OBJECT_THICKNESS. ;% RESTORE: Restored variable: SOURCE_NAME. data_dir=!phangs_data_dir+'/ISRF/PRODUCTS/' file_save=data_dir+source_name+'_isrf_min_prediction.fits' lambir=dustem_get_wavelengths(isrf_wavelengths=isrf_wavelengths) Nvor=(size(ISRFS))[2] one_st={vid:0L,ISRF:ISRFS[*,0]} st_isrf=replicate(one_st,Nvor) st_wave={wavelength:isrf_wavelengths} FOR i=0L,Nvor-1 DO BEGIN st_isrf[i].vid=i st_isrf[i].ISRF=ISRFS[*,i] ENDFOR mwrfits,st_wave,file_save,/create dd0=mrdfits(file_save,0,h0) mwrfits,st_isrf,file_save ;==== check reading the file dd1=mrdfits(file_save,1,h1) dd2=mrdfits(file_save,2,h2) ;==== add info to the headers sxaddpar,h1,'PRODUCT','PHANGS ISRF' sxaddpar,h1,'OBJECT',source_name sxaddpar,h2,'PRODUCT','PHANGS ISRF' sxaddpar,h2,'OBJECT',source_name ;==== rewrite file (with modified headers) mwrfits,st_wave,file_save,h1,/create mwrfits,st_isrf,file_save,h2 message,'Saved '+file_save,/continue ;stop the_end: END