diff --git a/LabTools/IRAP/JPB/phangs_make_astrosat_images.pro b/LabTools/IRAP/JPB/phangs_make_astrosat_images.pro new file mode 100644 index 0000000..8a7d617 --- /dev/null +++ b/LabTools/IRAP/JPB/phangs_make_astrosat_images.pro @@ -0,0 +1,116 @@ +PRO phangs_make_astrosat_images,source_name=source_name,save=save,show_images=show_images,nostop=nostop,help=help + +;+ +; NAME: +; phangs_make_astrosat_images +; PURPOSE: +; makes astrosat images usable by the Phangs ISRF project +; CATEGORY: +; Dustem Phangs +; CALLING SEQUENCE: +; phangs_make_astrosat_images[,source_name=][,/save][,/show_images][,/nostop] +; INPUTS: +; None +; OPTIONAL INPUT PARAMETERS: +; source_name : source name (default = 'ngc0628') +; OUTPUTS: +; None +; OPTIONAL OUTPUT PARAMETERS: +; None +; ACCEPTED KEY-WORDS: +; help = If set, print this help +; save = If set, save result +; show_images= if set, show images +; nostop = if set, does not stop +; COMMON BLOCKS: +; None +; SIDE EFFECTS: +; A file is written +; RESTRICTIONS: +; None +; PROCEDURE: +; input astrosat images are asumed to be in Angstrom-1 cm-2 erg s-1 PER PIXEL (even though BUNIT = 'Angstrom-1 cm-2 erg s-1' in header) +; +; EXAMPLES +; phangs_make_astrosat_images,source_name='ngc0628',/show,/nostop +; phangs_make_astrosat_images,source_name='ngc0628',/save,/show,/nostop +; MODIFICATION HISTORY: +; Written by J.-Ph. Bernard (2023) +; Evolution details on the DustEMWrap gitlab. +; See http://dustemwrap.irap.omp.eu/ for FAQ and help. +;- + +IF keyword_set(help) THEN BEGIN + doc_library,'phangs_make_astrosat_images' + goto,the_end +ENDIF + +use_source_name='ngc0628' +IF keyword_set(source_name) THEN use_source_name=source_name + +pdp_define_la_common +;window,0 +obp=[1.1,0,1.15,1] +win=0L + +data_dir=!phangs_data_dir+'/phangs_drive/PHANGS_ASTROSAT/v1p0/release/' +save_data_dir=!phangs_data_dir+'/ISRF/WORK/' + +astrosat_data: +;BUNIT = 'Angstrom-1 cm-2 erg s-1' +;in fact Angstrom-1 cm-2 erg s-1 PER PIXEL ?! + +;This is to get the reference header +restore,save_data_dir+'ngc0628_jwst_images.sav',/verb +;% RESTORE: Restored variable: JWST_IMAGES. +;% RESTORE: Restored variable: FILTERS. +;% RESTORE: Restored variable: HREF. +;% RESTORE: Restored variable: NHCO. + +astrosat_filters=dustem_filter_names2filters(['F148W','F154W','F169M','F172M','N219M']) +Nastrosat_filter=n_elements(astrosat_filters) +astrosat_images=fltarr(sxpar(href,'NAXIS1'),sxpar(href,'NAXIS2'),2,Nastrosat_filter) +files=data_dir+strupcase(use_source_name)+'_'+['F148','F154','F169','F172','N219']+'_bkg_subtracted_mw_corrected.fits' +;NGC0628_F148_bkg_subtracted_mw_corrected.fits NGC0628_F169_bkg_subtracted_mw_corrected.fits NGC0628_N219_bkg_subtracted_mw_corrected.fits +;NGC0628_F154_bkg_subtracted_mw_corrected.fits NGC0628_F172_bkg_subtracted_mw_corrected.fits +wavs_mic=dustem_filter2wav(astrosat_filters) +cmic=3.e14 ;mic/sec +facts=wavs_mic/cmic*(wavs_mic*1.e4)/4./!pi*1.e-7*1.e4*1.e20 ;from Flambda in ergs/cm2/s/AA to MJy/sr (note: was divided by 4*pi) +imrange=[-0.5,2]*1e-17 ;erg/s/cm2/AA +imrange=[-0.5,1] ;MJy/sr + +FOR i=0L,Nastrosat_filter-1 DO BEGIN + file=files[i] + d=mrdfits(file,0,h) + steradians=(sxpar(h,'CDELT2')/!radeg)^2 ;pixel in sr + fact=facts[i]*4.*!pi/steradians ;This is to rescale from /pixel to /sr + ind=where(finite(d) NE 1,count) + IF count NE 0 THEN d[ind]=la_undef() + d=la_mul(d,fact) + image_cont20,d,h,/square,imrange=imrange,image_color_table='jpbloadct',/silent,tit=tit + IF sxpar(h,'NAXIS1') NE sxpar(href,'NAXIS1') OR sxpar(h,'NAXIS2') NE sxpar(href,'NAXIS2') THEN d=project2(h,d,href,/silent) + tit=source_name+' '+astrosat_filters[i] + image_cont20,d,href,/square,imrange=imrange,image_color_table='jpbloadct',/silent,tit=tit + astrosat_images[*,*,0,i]=d + stop +ENDFOR + +;Invent variances (will have to do better) +perc_error=5./100. +astrosat_images[*,*,1,*]=la_power(la_mul(astrosat_images[*,*,0,*],perc_error),2) ;assumed intensity variance +;=== check for null variances +ind=where(astrosat_images[*,*,1,*] EQ 0.,count) +IF count NE 0 THEN BEGIN + message,'There are null variances ...',/continue + stop +ENDIF + +IF keyword_set(save) THEN BEGIN + file_save=save_data_dir+use_source_name+'_astrosat_data.sav' + save,astrosat_images,astrosat_filters,href,file=file_save + message,'Saved '+file_save,/info +ENDIF + +the_end: + +END \ No newline at end of file diff --git a/LabTools/IRAP/JPB/phangs_make_jwst_images.pro b/LabTools/IRAP/JPB/phangs_make_jwst_images.pro new file mode 100644 index 0000000..fe5a931 --- /dev/null +++ b/LabTools/IRAP/JPB/phangs_make_jwst_images.pro @@ -0,0 +1,232 @@ +PRO phangs_make_jwst_images,source_name=source_name,save=save,show_images=show_images,nostop=nostop + +;phangs_make_jwst_images,source_name='ngc0628',/save,/show,/nostop + +use_source_name='ngc0628' +IF keyword_set(source_name) THEN use_source_name=source_name + +pdp_define_la_common +;window,0 +obp=[1.1,0,1.15,1] +win=0L + +;data_dir='/Volumes/PILOT_FLIGHT1/PHANGS-JWST/DR1/' +NH_data_dir=!phangs_data_dir+'/phangs_drive/PHANGS-JWST/DR1/' +data_dir=!phangs_data_dir+'/phangs_drive/PHANGS-JWST/DR1/' +save_data_dir=!phangs_data_dir+'/ISRF/WORK/' + +;========== get JWST reference header +file=data_dir+use_source_name+'_nircam_lv3_f300m_i2d_anchor_atgauss1.fits' +d=mrdfits(file,1,h) +ind=where(finite(d) NE 1,count) +IF count NE 0 THEN d[ind]=la_undef() +print,sxpar(h,'CDELT1') +href=cd2astro_header(h) +sxaddpar,href,'EQUINOX',2000. +IF keyword_set(show_images) THEN BEGIN + window,win & win=win+1 + image_cont20,d,href,/square,imrange=[-0.1,5],image_color_table='jpbloadct',/silent,tit=tit +ENDIF +;stop +Nx=sxpar(href,'NAXIS1') +Ny=sxpar(href,'NAXIS2') + +filters_names=['F200W','F300M','F335M','F360M','F0770W','F1000W','F1130W','F2100W'] +filters=dustem_filter_names2filters(filters_names) +Nfilters=n_elements(filters) +jwst_images=fltarr(Nx,Ny,2,Nfilters) + +IF not keyword_set(nostop) THEN stop + +;========== JWST stuff +i=0L +file=data_dir+use_source_name+'_nircam_lv3_f200w_i2d_anchor_atgauss1.fits' +d=mrdfits(file,0,h0) +d=mrdfits(file,1,h) +sxaddpar,h,'EQUINOX',2000. +ind=where(finite(d) NE 1,count) +IF count NE 0 THEN d[ind]=la_undef() +IF sxpar(h,'NAXIS1') NE Nx OR sxpar(h,'NAXIS2') NE Ny THEN d=project2(h,d,href,/silent) +jwst_images[*,*,0,i]=d & i=i+1 +help,d +;D DOUBLE = Array[7289, 9476] +print,sxpar(h,'EXTNAME') +filter_name=sxpar(h0,'FILTER') +print,filter_name +tit=source_name+' '+filter_name +IF keyword_set(show_images) THEN BEGIN + window,win & win=win+1 + image_cont20,d,href,/square,imrange=[-0.1,5],image_color_table='jpbloadct',/silent,tit=tit + IF not keyword_set(nostop) THEN stop +ENDIF + +;stop + +file=data_dir+use_source_name+'_nircam_lv3_f300m_i2d_anchor_atgauss1.fits' +d=mrdfits(file,0,h0) +d=mrdfits(file,1,h) +sxaddpar,h,'EQUINOX',2000. +ind=where(finite(d) NE 1,count) +IF count NE 0 THEN d[ind]=la_undef() +IF sxpar(h,'NAXIS1') NE Nx OR sxpar(h,'NAXIS2') NE Ny THEN d=project2(h,d,href,/silent) +jwst_images[*,*,0,i]=d & i=i+1 +help,d +;D DOUBLE = Array[3515, 4576] +print,sxpar(h,'EXTNAME') +filter_name=sxpar(h0,'FILTER') +print,filter_name +tit=source_name+' '+filter_name +IF keyword_set(show_images) THEN BEGIN + window,win & win=win+1 + image_cont20,d,href,/square,imrange=[-0.1,5],image_color_table='jpbloadct',/silent,tit=tit + IF not keyword_set(nostop) THEN stop +ENDIF + +file=data_dir+use_source_name+'_nircam_lv3_f335m_i2d_anchor_atgauss1.fits' +d=mrdfits(file,0,h0) +d=mrdfits(file,1,h) +sxaddpar,h,'EQUINOX',2000. +ind=where(finite(d) NE 1,count) +IF count NE 0 THEN d[ind]=la_undef() +IF sxpar(h,'NAXIS1') NE Nx OR sxpar(h,'NAXIS2') NE Ny THEN d=project2(h,d,href,/silent) +jwst_images[*,*,0,i]=d & i=i+1 +print,sxpar(h,'EXTNAME') +filter_name=sxpar(h0,'FILTER') +print,filter_name +tit=source_name+' '+filter_name +IF keyword_set(show_images) THEN BEGIN + window,win & win=win+1 + image_cont20,d,href,/square,imrange=[-0.1,5],image_color_table='jpbloadct',/silent,tit=tit + IF not keyword_set(nostop) THEN stop +ENDIF + +file=data_dir+use_source_name+'_nircam_lv3_f360m_i2d_anchor_atgauss1.fits' +d=mrdfits(file,0,h0) +d=mrdfits(file,1,h) +sxaddpar,h,'EQUINOX',2000. +ind=where(finite(d) NE 1,count) +IF count NE 0 THEN d[ind]=la_undef() +IF sxpar(h,'NAXIS1') NE Nx OR sxpar(h,'NAXIS2') NE Ny THEN d=project2(h,d,href,/silent) +jwst_images[*,*,0,i]=d & i=i+1 +print,sxpar(h,'EXTNAME') +filter_name=sxpar(h0,'FILTER') +print,filter_name +tit=source_name+' '+filter_name +IF keyword_set(show_images) THEN BEGIN + window,win & win=win+1 + image_cont20,d,href,/square,imrange=[-0.2,5],image_color_table='jpbloadct',/silent,tit=tit + IF not keyword_set(nostop) THEN stop +ENDIF + +file=data_dir+use_source_name+'_miri_lv3_f770w_i2d_anchor_atgauss1.fits' +d=mrdfits(file,0,h0) +d=mrdfits(file,1,h) +sxaddpar,h,'EQUINOX',2000. +ind=where(finite(d) NE 1,count) +IF count NE 0 THEN d[ind]=la_undef() +IF sxpar(h,'NAXIS1') NE Nx OR sxpar(h,'NAXIS2') NE Ny THEN d=project2(h,d,href,/silent) +jwst_images[*,*,0,i]=d & i=i+1 +print,sxpar(h,'EXTNAME') +filter_name=sxpar(h0,'FILTER') +print,filter_name +tit=source_name+' '+filter_name +IF keyword_set(show_images) THEN BEGIN + window,win & win=win+1 + image_cont20,d,href,/square,imrange=[-0.2,10],image_color_table='jpbloadct',/silent,tit=tit,off_bar=obp + IF not keyword_set(nostop) THEN stop +ENDIF + +file=data_dir+use_source_name+'_miri_lv3_f1000w_i2d_anchor_atgauss1.fits' +d=mrdfits(file,0,h0) +d=mrdfits(file,1,h) +sxaddpar,h,'EQUINOX',2000. +ind=where(finite(d) NE 1,count) +IF count NE 0 THEN d[ind]=la_undef() +IF sxpar(h,'NAXIS1') NE Nx OR sxpar(h,'NAXIS2') NE Ny THEN d=project2(h,d,href,/silent) +jwst_images[*,*,0,i]=d & i=i+1 +print,sxpar(h,'EXTNAME') +filter_name=sxpar(h0,'FILTER') +print,filter_name +tit=source_name+' '+filter_name +IF keyword_set(show_images) THEN BEGIN + window,win & win=win+1 + image_cont20,d,href,/square,imrange=[-0.2,5],image_color_table='jpbloadct',/silent,tit=tit + IF not keyword_set(nostop) THEN stop +ENDIF + +file=data_dir+use_source_name+'_miri_lv3_f1130w_i2d_anchor_atgauss1.fits' +d=mrdfits(file,0,h0) +d=mrdfits(file,1,h) +sxaddpar,h,'EQUINOX',2000. +ind=where(finite(d) NE 1,count) +IF count NE 0 THEN d[ind]=la_undef() +IF sxpar(h,'NAXIS1') NE Nx OR sxpar(h,'NAXIS2') NE Ny THEN d=project2(h,d,href,/silent) +jwst_images[*,*,0,i]=d & i=i+1 +print,sxpar(h,'EXTNAME') +filter_name=sxpar(h0,'FILTER') +print,filter_name +tit=source_name+' '+filter_name +IF keyword_set(show_images) THEN BEGIN + window,win & win=win+1 + image_cont20,d,href,/square,imrange=[-0.3,20],image_color_table='jpbloadct',/silent,tit=tit + IF not keyword_set(nostop) THEN stop +ENDIF +IF not keyword_set(nostop) THEN stop + +file=data_dir+use_source_name+'_miri_lv3_f2100w_i2d_anchor_atgauss1.fits' +d=mrdfits(file,0,h0) +d=mrdfits(file,1,h) +sxaddpar,h,'EQUINOX',2000. +ind=where(finite(d) NE 1,count) +IF count NE 0 THEN d[ind]=la_undef() +IF sxpar(h,'NAXIS1') NE Nx OR sxpar(h,'NAXIS2') NE Ny THEN d=project2(h,d,href,/silent) +jwst_images[*,*,0,i]=d & i=i+1 +print,sxpar(h,'EXTNAME') +filter_name=sxpar(h0,'FILTER') +print,filter_name +tit=source_name+' '+filter_name +IF keyword_set(show_images) THEN BEGIN + window,win & win=win+1 + image_cont20,d,href,/square,imrange=[-0.5,10],image_color_table='jpbloadct',/silent,tit=tit + IF not keyword_set(nostop) THEN stop +ENDIF +IF not keyword_set(nostop) THEN stop + +;Invent variances (will have to do better) +;jwst_images[*,*,1,*]=(jwst_images[*,*,0,*]*5./100.)^2 ;assumed intensity variance +perc_error=5./100. +jwst_images[*,*,1,*]=la_power(la_mul(jwst_images[*,*,0,*],perc_error),2) ;assumed intensity variance +;=== check for null variances +ind=where(jwst_images[*,*,1,*] EQ 0.,count) +IF count NE 0 THEN BEGIN + message,'There are null variances ...',/continue + stop +ENDIF + +;WCO map: +file=NH_data_dir+use_source_name+'_12m+7m+tp_co21_broad_mom0.fits' +;file='/Volumes/PILOT_FLIGHT1/PHANGS-JWST/'+use_source_name+'_12m+7m+tp_co21_broad_mom0.fits' +d=readfits(file,h) +;sxaddpar,h,'CTYPE1','RA---TAN' +;sxaddpar,h,'CTYPE2','RA---TAN' +sxaddpar,h,'EQUINOX',2000. +ind=where(finite(d) NE 1,count) +IF count NE 0 THEN d[ind]=la_undef() +IF sxpar(h,'NAXIS1') NE Nx OR sxpar(h,'NAXIS2') NE Ny THEN WCO=project2(h,d,href,/silent) ELSE WCO=d +fact=4.e20/1.e21 +NHCO=la_mul(WCO,fact) ;NH from CO in 1e21 H/cm2 +tit=source_name+' '+'NHCO [1e21 H/cm2]' +IF keyword_set(show_images) THEN BEGIN + window,win & win=win+1 + image_cont20,NHCO,href,/square,imrange=[-0.5,10],image_color_table='jpbloadct',/silent,tit=tit + IF not keyword_set(nostop) THEN stop +ENDIF + +IF keyword_set(save) THEN BEGIN + save_file=save_data_dir+use_source_name+'_jwst_images.sav' + save,jwst_images,filters,href,NHCO,file=save_file + message,'Saved '+save_file,/continue +ENDIF + + +END \ No newline at end of file diff --git a/LabTools/IRAP/JPB/phangs_make_muse_filters_images.pro b/LabTools/IRAP/JPB/phangs_make_muse_filters_images.pro new file mode 100644 index 0000000..36c0edd --- /dev/null +++ b/LabTools/IRAP/JPB/phangs_make_muse_filters_images.pro @@ -0,0 +1,151 @@ +PRO phangs_make_muse_filters_images,source_name=source_name,save=save,show_images=show_images,nostop=nostop + +;phangs_make_muse_filters_images,source_name='ngc0628',/show,/nostop +;phangs_make_muse_filters_images,source_name='ngc0628',/save,/show,/nostop + +use_source_name='ngc0628' +IF keyword_set(source_name) THEN use_source_name=source_name + +pdp_define_la_common +;window,0 +obp=[1.1,0,1.15,1] +win=0L + +;data_dir='/Volumes/PILOT_FLIGHT1/PHANGS-JWST/DR1/' +data_dir=!phangs_data_dir+'/phangs_drive/PHANGS_MUSE/DR2p2/coopt/filterimages/NGC0628/' +save_data_dir=!phangs_data_dir+'/ISRF/WORK/' + +MUSE_data: + +;=== this is just to get href +restore,save_data_dir+'ngc0628_jwst_images.sav',/verb + +;muse_data_dir='/Volumes/PILOT_FLIGHT1/PHANGS_MUSE/DR2p2/coopt/filterimages/NGC0628/' +;muse_filters=['COUSIN','DUPONT'] +;muse_filters=['SDSS2','SDSS3','SDSS4'] +muse_filters=dustem_filter_names2filters(['sdss_g','sdss_r','sdss_i']) +Nmuse_filter=n_elements(muse_filters) +muse_images=fltarr(sxpar(href,'NAXIS1'),sxpar(href,'NAXIS2'),2,Nmuse_filter) +files=data_dir+'NGC0628_'+['SDSS_gcopt','SDSS_rcopt','SDSS_icopt']+'.fits' + +;imrange=[-0.5,200]/2000. +imrange=[-1.e-4,0.001] +imrange=[-1.e-2,1.] +muse_undefined=0. +FOR i=0L,Nmuse_filter-1 DO BEGIN + file=files[i] + ;toto=mrdfits(file,0,hh) + d=mrdfits(file,1,h) ;here undefined values are at 0. + hh=cd2astro_header(h) + dv=mrdfits(file,2,hv) ;is this looks like it's a variance + mask=mrdfits(file,3,hm) + ind=where(mask EQ 1,count) ;this looks like a mask + IF count NE 0 THEN BEGIN + d[ind]=la_undef() + dv[ind]=la_undef() + ENDIF + print,la_min(d),la_max(d) + ; -7.37902 17186.9 + factor=dustem_muse_filter_conversion_factor(muse_filters[i],pivot_wav=pivot_wav) ;goes from Muse filter units to muJy/pix + omega_pix=(sxpar(hh,'CDELT2')/!radeg)^2 ;simeq 9e-13 sr + ;use_factor=factor/omega_pix*1.e-12 ;simeq 500 + ;use_factor=factor/omega_pix*1.e-20 ;simeq 500 + use_factor=(1./factor)/omega_pix*1.e-12 ;simeq 500 + ;jpb's estimate: + cmic=2.99792458e14 + use_factor_jp=1.e-7*1.e4*pivot_wav*(pivot_wav/1.e4)/cmic/omega_pix + print,factor,omega_pix,use_factor,use_factor_jp + use_factor=use_factor_jp + ;stop + ; 492.255 9.4017732e-13 5.2357685e-06 + d=la_mul(d,use_factor) ;Now supposidely in MJy/sr (but in what unit convention ??) + dv=la_mul(dv,use_factor^2) ;Now supposidely in (MJy/sr)^2 + print,la_min(d),la_max(d) + ;-3.8634841e-05 0.089986754 + tit=source_name+' '+muse_filters[i] + image_cont20,d,h,/square,imrange=imrange,image_color_table='jpbloadct',/silent,tit=tit,off_bar_pos=obp,axis_color_table=1 + ;stop + IF sxpar(h,'NAXIS1') NE sxpar(href,'NAXIS1') OR sxpar(h,'NAXIS2') NE sxpar(href,'NAXIS2') THEN BEGIN + d=project2(h,d,href,/silent,save_it='/tmp/save_project2.sav') + dv=project2(h,dv,href,/silent,restore_it='/tmp/save_project2.sav') + ENDIF + muse_images[*,*,0,i]=d + muse_images[*,*,1,i]=dv + ;print,filter_name + IF keyword_set(show_images) THEN BEGIN + window,win & win=win+1 + image_cont20,d,href,/square,imrange=imrange,image_color_table='jpbloadct',/silent,tit=tit,off_bar_pos=obp,axis_color_table=1 + ENDIF +ENDFOR + +;Invent variances (will have to do better) +;CAUTION: some variances were 0 because some fluxes are 0, had to add abs_variance +;perc_error=5./100. +;abs_variance=(1.e-12)^2 +;muse_images[*,*,1,*]=la_add(la_power(la_mul(muse_images[*,*,0,*],perc_error),2),abs_variance) ;assumed intensity variance +;=== check for null variances +ind=where(muse_images[*,*,1,*] EQ 0.,count) +IF count NE 0 THEN BEGIN + message,'There are null variances ...',/continue + stop + toto=muse_images[*,*,1,*] + toto[ind]=la_undef() + muse_images[*,*,1,*]=toto +ENDIF + +IF keyword_set(save) THEN BEGIN + file_save=save_data_dir+use_source_name+'_muse_filters_data.sav' + save,muse_images,muse_filters,href,file=file_save + message,'Saved '+file_save,/info +ENDIF + +muse_stuff: + +restore,save_data_dir+use_source_name+'_jwst_images.sav',/verb + +;========== MUSE stuff +st_templates=read_muse_templates_info(age_values=age_values,metalicity_values=metalicity_values,Nbins=Nbins,Nage=Nage,NZ=NZ,bins=bins) +print,Nage,NZ,Nbins +; 13 6 78 +print,la_min(bins),la_max(bins) +; 0 77 +;Muse weights +st_muse_weights=read_muse_phangs_weights(object='NGC0628',bin_numbers=bin_numbers) +print,n_elements(bin_numbers) +; 78 + +voronoi_id=read_muse_phangs_voronoi_bins('NGC0628',header_in=href,snr_bin=snr_bin,snr_flux=snr_flux,flux=muse_flux) ;This is the voronoi bin map + +IF keyword_set(show_images) THEN BEGIN + window,win & win=win+1 + image_cont20,voronoi_id,href,/square,/silent,image_color_table='jpbloadct',title='Voronoi Bins' +ENDIF + +IF keyword_set(save) THEN BEGIN + file_save=save_data_dir+use_source_name+'_muse_images.sav' + save,st_templates,st_muse_weights,voronoi_id,age_values,metalicity_values,bins,href,file=file_save + message,'saved '+file_save,/info +ENDIF + +NH_map: + +restore,save_data_dir+use_source_name+'_jwst_images.sav',/verb +restore,save_data_dir+use_source_name+'_muse_images.sav',/verb +restore,save_data_dir+use_source_name+'_jwst_seds_muse_pixels.sav',/verb + +Nvor=max(voronoi_id) + +ebv=st_muse_weights.reddening +Rv=3.1 +Av_o_NH=1./2. ;2 mag per 1e21 H/cm2 +;Do an Av map +NH_map=fltarr(sxpar(href,'NAXIS1'),sxpar(href,'NAXIS2')) ;in 1e21 H/cm2 +FOR vid=0LL,Nvor-1 DO BEGIN + IF vid mod 100 EQ 0 THEN print,strtrim(vid/Nvor*100.,2)+' %' + ;ind=where(voronoi_id EQ vid) + Nh_map[*all_seds_indices[vid]]=Rv*ebv[vid]/Av_o_NH +ENDFOR + +save,NH_map,file=save_data_dir+use_source_name+'_muse_NH.sav' + +END \ No newline at end of file -- libgit2 0.21.2