pforma_io.py 文件源码

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

项目:PH5 作者: PIC-IRIS 项目源码 文件源码
def initialize_ph5 (self) :
        '''   Set up processing directory structure and set M from existing mini files   '''
        if self.home == None : return
        if not os.path.exists (self.home) :
            try :
                os.makedirs (self.home)
            except Exception as e :
                raise FormaIOError (4, "Failed to create output directory: {0}".format (self.home))

        for m in self.nmini :
            os.chdir (self.home)
            if not os.path.exists (m) :
                os.mkdir (m)

            try :
                os.chdir (m)
                subprocess.call ('initialize_ph5 -n master', shell=True, stdout=open (os.devnull, 'w'), stderr=open (os.devnull, 'w'))
            except Exception as e :
                raise FormaIOError (5, "Failed to initialize {0}".format (os.path.join (self.home, m)))

            files = os.listdir ('.')
            minis = filter (lambda a : a[0:5] == 'miniP' and a[-3:] == 'ph5', files)
            if len (minis) :
                if self.M == None or len (minis) > self.M :
                    self.M = len (minis)

        os.chdir (self.whereami)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号