本文整理汇总了Python中lsst.sims.photUtils.Sed.synchronizeSED方法的典型用法代码示例。如果您正苦于以下问题:Python Sed.synchronizeSED方法的具体用法?Python Sed.synchronizeSED怎么用?Python Sed.synchronizeSED使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lsst.sims.photUtils.Sed
的用法示例。
在下文中一共展示了Sed.synchronizeSED方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: galaxy
# 需要导入模块: from lsst.sims.photUtils import Sed [as 别名]
# 或者: from lsst.sims.photUtils.Sed import synchronizeSED [as 别名]
mags1 = {}
for f in filterlist:
mags1[f] = numpy.zeros(num_gal, dtype='float')
# For each galaxy (in num_gal's), apply internal dust, redshift, apply MW dust, fluxnorm & calculate mags.
for i in range(num_gal):
galname = gallist[gal_name[i]]
tmpgal = Sed(wavelen=gals[galname].wavelen, flambda=gals[galname].flambda)
tmpgal.addCCMDust(a_int, b_int, ebv=ebv_int[i])
tmpgal.redshiftSED(redshifts[i])
a_mw, b_mw = tmpgal.setupCCMab()
tmpgal.addCCMDust(a_mw, b_mw, ebv=ebv_mw[i])
tmpgal.multiplyFluxNorm(fluxnorm[i])
# If you comment out the synchronize sed here, then the difference between this method and the optimized
# version increases to a 2.5 times difference. (i.e. this 'synchronizeSED' buys you 1.6x faster, by itself.)
tmpgal.synchronizeSED(wavelen_min=wavelen_min,
wavelen_max=wavelen_max,
wavelen_step = wavelen_step)
for f in filterlist:
mags1[f][i] = tmpgal.calcMag(lsstbp[f])
dt, t = dtime(t)
print "Calculating dust/redshift/dust/fluxnorm/%d magnitudes for %d galaxies took %f s" \
%(len(filterlist), num_gal, dt)
# For next test: want to also do all the same steps, but in an optimized form. This means
# doing some things that Sed does 'behind the scenes' explicitly, but also means the code may be a little
# harder to read at first.
# First: calculate internal a/b on wavelength range required for internal dust extinction.
a_int, b_int = gals[gallist[0]].setupCCMab() # this is a/b on native galaxy sed range.
# Next: calculate milky way a/b on wavelength range required for calculating magnitudes - i.e. 300 to 1200 nm.
tmpgal = Sed()
tmpgal.setFlatSED(wavelen_min=wavelen_min, wavelen_max=wavelen_max, wavelen_step = wavelen_step)