Exemple #1
0
 def finish(self):
     global mcsOut
     global c_value
     self.f = open(
         CompuCellSetup.getScreenshotDirectoryName() + "\cvalue.txt", "w+")
     self.f.write("%d\r\n\n" % mcsOut)
     for ck in c_value:
         self.f.write("%d\r" % ck)
     self.f.close()
 def finish(self):
     global mcsOut
     global c_value
     # saving number of cells getting deleted at lattice boundary at each mcs
     self.f = open(
         CompuCellSetup.getScreenshotDirectoryName() + "\cvalue.txt", "w+")
     self.f.write(
         "%d\r\n\n" %
         mcsOut)  #saving the number of MCS when cells start getting deleted
     for ck in c_value:
         self.f.write("%d\r" % ck)
     self.f.close()
 def copyFilesToOutputDirectory(self):
     import CompuCellSetup
     screenshotDirectoryName=CompuCellSetup.getScreenshotDirectoryName()
     import shutil
     import os
     if screenshotDirectoryName=="":
         return
         
     for fileName in self.fileNamesList:
         fileName=CompuCellSetup.simulationPaths.normalizePath(fileName)            
         sourceFileName=os.path.abspath(fileName)
         destinationFileName=os.path.join(screenshotDirectoryName,os.path.basename(sourceFileName))
         
         shutil.copy(sourceFileName,destinationFileName)
      pass
#
#
PYTHON STEPPABLES: #=======================================================================
  #
  File Management:
    import os
    import inspect
     
    sourceFile = os.path.abspath(__file__)
    sourceFile = inspect.getfile(inspect.currentframe())
     
    SourceDir = os.path.dirname(os.path.abspath(__file__))
    SourceDir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
    
    screenDir = CompuCellSetup.getScreenshotDirectoryName()
    
    source=os.path.abspath( __file__ )
    if (source[-1]=="c"): source=source[:-1]
    os.system("copy "+source[:source.rfind("_")]+".py "+screenDir)
    os.system("copy "+source+" "+screenDir)
  #
  Loading/Saving files:
    File=open(FileName,'w')#=write  | 'a')=append  | 'r')=read  | 'r+')=read+write
    
    File.write("%s%d%f\n" % ("string", integer, real) )
    
    File.read() #read entire file
    File.readline() #read one line  | File.readline() again reads next line
    for line in File:
      #line = current line in file