nugrid_set.py 文件源码

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

项目:NuGridPy 作者: NuGrid 项目源码 文件源码
def set_pocket(self,runs=[],cycle=[45532,47566],mass_cell=[0.641981,0.641981],isotopes=[],x_charge=False,mass_number_range=[],decayed=False,iso_label=False,title="PDCZ",colors=["red","blue","green","black"],yax_log=True,filename_norm="iniab2.0E-02GN93.ppn",elem_norm=''):

        '''
            plots isotopic composition for different runs, each with specific cycle number cycle[i] and specific mass cell mass_cell[i].
            Initial abundace file for normalization can be chosen as filename_norm, but MUST be in run directory

            decayed - plot only decayed isotopes
            mass_number_range - array of min mass number and max mass number, isotopes inbetween will be plottet, if set, isotope array will be ignored
            iso_label - set labels of isotopes True or False
            title - 
            colors -
            filename_norm - not yet included, normalization with initial abundance file
            ....
            e.g.

            setse.set_pocket(cycle=[32840,29390],mass_cell=[0.6300,0.6076],isotopes=["He-4","C-12","O-16","Ne-22"],mass_number_range=[80,140],decayed=True)



        '''

        import nugridse as mp   
                sefiles=[]
                legend=[]
                HDF5_out=[]
                extra_label=[]

        if len(runs) ==0:
            HDF5_out=self.runs_H5_out
            runs=self.run_dirs_name
            extra_label=self.extra_label
        else:
            for i in range(len(self.run_dirs_name)):
                if self.run_dirs_name[i] in runs:
                    HDF5_out.append(self.runs_H5_out[i])
                                        extra_label.append(self.extra_label[i])
        for i in range(len(HDF5_out)):
            reload(mp)
            file_norm=HDF5_out[i][:-6]+filename_norm
            sefiles=se(HDF5_out[i])
                        mass=sefiles.get("mini")
                        z=sefiles.get("zini")
                        legend=str(mass)+"M$_{\odot}$ Z= "+str(z)+", "+extra_label[i]
            if len(isotopes)==0:
                                self.plot_abu_atmasscoord(mp,sefiles,cycle[i],mass_cell[i],["He-4","C-12","O-16","Ne-22"],x_charge,mass_number_range,decayed,file_norm,elem_norm,yax_log,label=iso_label,legend=legend,color=colors[i],title=title)

                #plt.figure(111);self.pocket_composition(mp,sefiles=sefiles,cycle=cycle[i], massbot=massrange[i][0],masstop=massrange[i][1],isotopes=["He-4","C-12","O-16","Ne-22"],label=True,legend=legend,color=colors[i],title=title)
                #plt.figure(222);self.pocket_composition(mp,sefiles=sefiles,cycle=cycle[i], massbot=massrange[i][0],masstop=massrange[i][1],isotopes=['Fe-56','Co-60','Ni-61','Cu-65','Zn-67','Ga-71','Ge-73','As-75','Se-77','Br-82','Kr-84','Rb-87','Sr-88','Y-89','Zr-92','Nb-94','Zr-96','Mo-96','Ba-137','Ba-138','La-139','Ce-140','Nd-142','Sm-144','Pb-206'],label=True,legend=legend,color=colors[i],title=title)
            else:
                #plt.figure(111);self.pocket_composition(mp,sefiles=sefiles,cycle=cycle[i], massbot=massrange[i][0],masstop=massrange[i][1],isotopes=isotopes,label=True,legend=legend,color=colors[i],title=title)
                self.plot_abu_atmasscoord(mp,sefiles,cycle[i],mass_cell[i],isotopes,x_charge,mass_number_range,decayed,file_norm,elem_norm,yax_log,label=iso_label,legend=legend,color=colors[i],title=title)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号