Commit ebbb6019 authored by Zhang Xin's avatar Zhang Xin
Browse files

fix redshift calculation method

parent 4ce9fe3e
......@@ -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())
......@@ -482,7 +482,9 @@ 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 = 10**(-.4 * cosmo.distmod(gal_z).value)
factor=1
if gal_z != 0:
factor = 10**(-.4 * cosmo.distmod(gal_z).value)
flux = np.matmul(pcs, coeff) * factor
flux[flux < 0] = 0.
......@@ -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'))
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:
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 = getNormFactorForSpecWithABMAG(ABMag=mag_norm, spectrum=orig_spec_phot,
norm_thr=normThr,
sWave=np.floor(normThr[norm_thr_rang_ids][0][0]),
......@@ -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")
......@@ -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)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment