Loading produceSED_1.py +8 −8 Original line number Diff line number Diff line Loading @@ -239,7 +239,7 @@ def getObservedSED(sedCat, redshift=0.0, av=0.0, redden=0): sw, sf = sedCat[:,0], sedCat[:,1] # reddening sf = reddening(sw, sf, av=av, model=redden) sw, sf = sw*z, sf*(z**3) sw, sf = sw*z, sf/z # lyman forest correction sf = lyman_forest(sw, sf, redshift) isedObs = (sw.copy(), sf.copy()) Loading Loading @@ -482,6 +482,8 @@ def produceGalSED_C6( gal_id_s = '03593100052300144566', gal_z = 1.6927,mag_norm pcs = pcs['pcs'][()] cosmo = FlatLambdaCDM(H0=67.66, Om0=0.3111) factor=1 if gal_z != 0: factor = 10**(-.4 * cosmo.distmod(gal_z).value) flux = np.matmul(pcs, coeff) * factor Loading @@ -501,11 +503,12 @@ def produceGalSED_C6( gal_id_s = '03593100052300144566', gal_z = 1.6927,mag_norm all_sed = y * lamb / (cons.h.value * cons.c.value) * 1e-13 orig_spec_phot = Table(np.array([lamb, all_sed]).T, names=('WAVELENGTH', 'FLUX')) sedNormFactor=1.0 if mag_norm != -99: normThr = Table.read(norm_filter_thr_fn) # orig_spec = Table(np.array([wave,flux]).T, names=(['WAVELENGTH', 'FLUX'])) norm_thr_rang_ids = normThr['SENSITIVITY'] > 0.001 sedNormFactor=1.0 if mag_norm != -99: sedNormFactor = getNormFactorForSpecWithABMAG(ABMag=mag_norm, spectrum=orig_spec_phot, norm_thr=normThr, sWave=np.floor(normThr[norm_thr_rang_ids][0][0]), Loading @@ -516,10 +519,8 @@ def produceGalSED_C6( gal_id_s = '03593100052300144566', gal_z = 1.6927,mag_norm return norm_spec, norm_spec_phot fileDir = os.getcwd() #normlization filter star # star_norm_fn = '/Users/zhangxin/Work/SlitlessSim/sed/produceSED_bycatfile/data/throughputs/SDSS/SLOAN_SDSS.g.fits' star_norm_fn = os.path.join(fileDir, "data/throughputs/SDSS/SLOAN_SDSS.g.fits") Loading Loading @@ -562,4 +563,3 @@ gal_spec, gal_spec_photo = produceGalSED_C6(gal_id_s = '03490800052300010462', g # mag = getABMAG(spec_p, throughput_dir+fi+'.Throughput.fits') # print(fi,mag) Loading
produceSED_1.py +8 −8 Original line number Diff line number Diff line Loading @@ -239,7 +239,7 @@ def getObservedSED(sedCat, redshift=0.0, av=0.0, redden=0): sw, sf = sedCat[:,0], sedCat[:,1] # reddening sf = reddening(sw, sf, av=av, model=redden) sw, sf = sw*z, sf*(z**3) sw, sf = sw*z, sf/z # lyman forest correction sf = lyman_forest(sw, sf, redshift) isedObs = (sw.copy(), sf.copy()) Loading Loading @@ -482,6 +482,8 @@ def produceGalSED_C6( gal_id_s = '03593100052300144566', gal_z = 1.6927,mag_norm pcs = pcs['pcs'][()] cosmo = FlatLambdaCDM(H0=67.66, Om0=0.3111) factor=1 if gal_z != 0: factor = 10**(-.4 * cosmo.distmod(gal_z).value) flux = np.matmul(pcs, coeff) * factor Loading @@ -501,11 +503,12 @@ def produceGalSED_C6( gal_id_s = '03593100052300144566', gal_z = 1.6927,mag_norm all_sed = y * lamb / (cons.h.value * cons.c.value) * 1e-13 orig_spec_phot = Table(np.array([lamb, all_sed]).T, names=('WAVELENGTH', 'FLUX')) sedNormFactor=1.0 if mag_norm != -99: normThr = Table.read(norm_filter_thr_fn) # orig_spec = Table(np.array([wave,flux]).T, names=(['WAVELENGTH', 'FLUX'])) norm_thr_rang_ids = normThr['SENSITIVITY'] > 0.001 sedNormFactor=1.0 if mag_norm != -99: sedNormFactor = getNormFactorForSpecWithABMAG(ABMag=mag_norm, spectrum=orig_spec_phot, norm_thr=normThr, sWave=np.floor(normThr[norm_thr_rang_ids][0][0]), Loading @@ -516,10 +519,8 @@ def produceGalSED_C6( gal_id_s = '03593100052300144566', gal_z = 1.6927,mag_norm return norm_spec, norm_spec_phot fileDir = os.getcwd() #normlization filter star # star_norm_fn = '/Users/zhangxin/Work/SlitlessSim/sed/produceSED_bycatfile/data/throughputs/SDSS/SLOAN_SDSS.g.fits' star_norm_fn = os.path.join(fileDir, "data/throughputs/SDSS/SLOAN_SDSS.g.fits") Loading Loading @@ -562,4 +563,3 @@ gal_spec, gal_spec_photo = produceGalSED_C6(gal_id_s = '03490800052300010462', g # mag = getABMAG(spec_p, throughput_dir+fi+'.Throughput.fits') # print(fi,mag)