nugrid_set.py 文件源码

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

项目:NuGridPy 作者: NuGrid 项目源码 文件源码
def remnant_lifetime_agb(self):
                '''
                        For paper1 extension:
            bottom_envelope
                         Numbers of remnant mass shell masses, exists also in mesa_set + star age!
                '''
                inim=[]
                remnm=[]
        time11=[]
        tottime=[]
        c_core=[]
        o_core=[]
        small_co_core=[]
        c_core_center=[]    
                for i in range(len(self.runs_H5_surf)):
                        m1p65_last=se(self.runs_H5_out[i])
                        mass_dummy=m1p65_last.se.get(m1p65_last.se.cycles[len(m1p65_last.se.cycles)-2],'mass')
                        top_of_envelope=mass_dummy[len(mass_dummy)-1]
                        h_dummy=m1p65_last.se.get(m1p65_last.se.cycles[len(m1p65_last.se.cycles)-2],'iso_massf','H-1')
            c_dummy=m1p65_last.se.get(m1p65_last.se.cycles[len(m1p65_last.se.cycles)-2],'iso_massf','C-12')
                        o_dummy=m1p65_last.se.get(m1p65_last.se.cycles[len(m1p65_last.se.cycles)-2],'iso_massf','O-16')
            for j in range(len(mass_dummy)):
                                if h_dummy[j] > 1e-1:
                                        bottom_of_envelope = mass_dummy[j]
                                        break
                        inim.append(m1p65_last.get("mini"))
                        remnm.append(bottom_of_envelope)

            ###Calculate the lifetime (MS)
                        sefiles=m1p65_last
                        cycs=[]
                        for k in range(5,len(sefiles.se.cycles),5):
                                cycs.append(int(sefiles.se.cycles[k]))
                        w=0
                        for cyc in cycs:
                                c12_center=sefiles.get(cyc,'C-12')[0]
                                #c12_center=c12[w][0]
                                w+=1
                                if c12_center>1e-1:
                                        time1=(sefiles.get(cyc,'age')*sefiles.get('age_unit'))/31557600.
                                        time11.append(time1)
                                        break
            tottime.append(sefiles.get(int(sefiles.se.cycles[-1]),'age')/31557600.)



                print "M_initial | M_remn/bottom of envelope | total lifetime"
                for i in range(len(inim)):
                        print inim[i],"|",'{:.3E}'.format(remnm[i]),"|",'{:.3E}'.format(tottime[i])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号