analysis.py 文件源码

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

项目:AdK_analysis 作者: orbeckst 项目源码 文件源码
def _auto_plots(self,mode,filebasename,figdir,plotargs):
        """Generate standard plots and write png and and pdf. Chooses filename and plot title."""
        import pylab

        try:
            os.makedirs(figdir)
        except OSError,err:
            if err.errno != errno.EEXIST:
                raise

        def figs(*args):
            return os.path.join(figdir,*args)

        modefilebasename = filebasename + self._suffix[mode]
        _plotargs = plotargs.copy()  # need a copy because of changing 'title'
        if plotargs.get('title') is None:  # None --> set automatic title
            _plotargs['title'] = self._title[mode]+' '+self.legend

        pylab.clf()
        self.plot(**_plotargs)
        pylab.savefig(figs(modefilebasename + '.png'))   # png
        pylab.savefig(figs(modefilebasename + '.pdf'))   # pdf

        print "--- Plotted %(modefilebasename)r (png,pdf)." % vars()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号