sed.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:nmmn 作者: rsnemmen 项目源码 文件源码
def sum(seds):
    """
Given a list of SEDs previously interpolated in the same binning, 
sums their luminosities and returns a SED object with the sum.

>>> ss=sum([s,s1,s2])

returns the SED ss <- [lognu, s+s1+s2],
where s+s1+s2 -> log10[nuLnu(s)+nuLnu(s1)+nuLnu(s2)], lognu being the common 
units of frequency for the SEDs after interpolation.

The method is designed to automatically call the interp method for each SED
if needed.
    """
    # Precaution in case the user did not use the interp method
    seds[0].interp(seds)

    sums=numpy.zeros_like(seds[0].lognui)   # initializes the sum

    for sed in seds:
        sums=sums+sed.nlnui

    return SED(lognu=seds[0].lognui, ll=numpy.log10(sums), logfmt=1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号