本文整理匯總了Python中lsst.sims.photUtils.Sed.Sed.age方法的典型用法代碼示例。如果您正苦於以下問題:Python Sed.age方法的具體用法?Python Sed.age怎麽用?Python Sed.age使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類lsst.sims.photUtils.Sed.Sed
的用法示例。
在下文中一共展示了Sed.age方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: loadBC03
# 需要導入模塊: from lsst.sims.photUtils.Sed import Sed [as 別名]
# 或者: from lsst.sims.photUtils.Sed.Sed import age [as 別名]
def loadBC03(self, subset = None):
"""
This loads the Bruzual and Charlot SEDs that are currently in the SIMS_SED_LIBRARY.
If the user wants to use different SEDs another loading method can be created and used in place
of this.
@param [in] subset is the list of the subset of files in the galDir that the user
can specify if using all the SEDs in the directory is not desired.
@param [out] sedList is the set of model SED spectra objects to be passed onto the matching routines.
"""
files = []
if subset is None:
for fileName in os.listdir(self.galDir):
files.append(fileName)
else:
for fileName in subset:
files.append(fileName)
numFiles = len(files)
numOn = 0
sedList = []
for fileName in files:
if numOn % 100 == 0:
print 'Loading %i of %i: BC Galaxy SEDs' % (numOn, numFiles)
try:
spec = Sed()
spec.readSED_flambda(str(self.galDir + '/' + fileName))
spec.name = fileName
fileNameAsList = fileName.split('.')
spec.type = fileNameAsList[0]
spec.age = float(fileNameAsList[1])
metallicity = fileNameAsList[2].split('Z')[0]
#Final form is z/zSun
spec.metallicity = float(metallicity) * (10 ** ((len(metallicity)-1)*-1))
except:
continue
sedList.append(spec)
numOn += 1
return sedList