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)
评论列表
文章目录