pullspectra.py 文件源码

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

项目:ThePayne 作者: pacargile 项目源码 文件源码
def __init__(self,**kwargs):
        # define the [Fe/H] array, this is the values that the MIST 
        # and C3K grids are built
        self.FeHarr = ([-4.0,-3.5,-3.0,-2.75,-2.5,-2.25,-2.0,-1.75,
            -1.5,-1.25,-1.0,-0.75,-0.5,-0.25,0.0,0.25,0.5])

        # define the [alpha/Fe] array
        self.alphaarr = [0.0,0.2,0.4]

        # define aliases for the MIST isochrones and C3K/CKC files
        self.MISTpath = kwargs.get('MISTpath',Payne.__abspath__+'data/MIST/')
        self.C3Kpath  = kwargs.get('C3Kpath',Payne.__abspath__+'data/C3K/')

        # load MIST models
        self.MIST = h5py.File(self.MISTpath+'/MIST_1.2_EEPtrk.h5','r')
        self.MISTindex = list(self.MIST['index'])

        # create weights for Teff
        # determine the min/max Teff from MIST
        MISTTeffmin = np.inf
        MISTTeffmax = 0.0
        for ind in self.MISTindex:
            MISTTeffmin_i = self.MIST[ind]['log_Teff'].min()
            MISTTeffmax_i = self.MIST[ind]['log_Teff'].max()
            if MISTTeffmin_i < MISTTeffmin:
                MISTTeffmin = MISTTeffmin_i
            if MISTTeffmax_i > MISTTeffmax:
                MISTTeffmax = MISTTeffmax_i
        self.teffwgts = beta(0.5,0.5,loc=MISTTeffmin-10.0,scale=(MISTTeffmax+10.0)-(MISTTeffmin-10.0))

        # create weights for [Fe/H]
        self.fehwgts = beta(1.0,0.5,loc=-2.1,scale=2.7).pdf(self.FeHarr)
        self.fehwgts = self.fehwgts/np.sum(self.fehwgts)

        # create a dictionary for the C3K models and populate it for different
        # metallicities
        self.C3K = {}
        for aa in self.alphaarr:
            self.C3K[aa] = {}
            for mm in self.FeHarr:
                self.C3K[aa][mm] = h5py.File(
                    self.C3Kpath+'/c3k_v1.3_feh{0:+4.2f}_afe{1:+3.1f}.full.h5'.format(mm,aa),
                    'r')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号