nugrid_set.py 文件源码

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

项目:NuGridPy 作者: NuGrid 项目源码 文件源码
def pocket_composition(self,mp,sefiles,cycle,massbot,masstop,isotopes,label,legend,color,title):  ###hdf5out
            '''

        mass_range    - required to plot data in a certain mass range. Needed for read_iso_abund_marco
            cycle         - which cycle from the h5 file?. Needed for read_iso_abund_marco
            stable        - logic if want to plot only stable or not.  
            i_decay       - if = 1 I plot not decayed, if = 2 I plot decayed. Make sense only if stable is true.


        '''


        mass_range=[massbot,masstop]
        sefiles.average_iso_abund_marco(mass_range,cycle,stable=False,i_decay=1)
        mass=[]
        plotiso=[]
        startyields=[]
        plotiso_massfrac=[]
        for i in range(len(isotopes)):
            startyields.append(sefiles.get(sefiles.se.cycles[0],isotopes[i])[0])
        for j in range(len(sefiles.se.isotopes)):
            if sefiles.se.isotopes[j] in isotopes:
                plotiso.append(mp.average_mass_frac[j])
                mass.append(sefiles.se.A[j])
        for i in range(len(isotopes)):
            plotiso_massfrac.append(plotiso[i]/startyields[i])
        plt.plot(mass,plotiso_massfrac,marker='*',markersize=8,mfc=color,linestyle='None',label=legend)
        #plt.plot(mass,plotiso_massfrac,marker='*')
        if label ==True:
            for j in range(len(isotopes)):
                plt.annotate(isotopes[j], xytext = (0, 10),textcoords = 'offset points' ,xy=(mass[j], plotiso_massfrac[j]))
        mass=np.array(mass)
        plt.xlim(mass.min()-4,mass.max()+4)
        plt.legend()
        plt.title(title)
        plt.xlabel("mass number")
        plt.ylabel("Isotopic production factors")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号