def createRunscripts(filename, jobFile): """ createRunscripts: """ from pytom.tools.files import dump2TextFile, getPytomPath text = '#!/bin/bash\n' text += 'pytom ' + getPytomPath() + '/bin/mcoEXMX.py -j ' + jobFile + '\n' dump2TextFile(filename, text, append=False)
def createRunscripts(filename,parameters): """ createRunscripts: """ from pytom.tools.files import dump2TextFile,getPytomPath text = '#!/bin/bash\n' text += 'pytom ' + getPytomPath() + '/bin/reconstructWB.py ' + parameters dump2TextFile(filename, text,append = False)
def dumpMsg2Log(self,logfile,msg): """ dumpMsg2Log: @param logfile: @param msg: @author: Thomas Hrabe """ from pytom.tools.files import dump2TextFile dump2TextFile(logfile,msg)
def createRunscripts(filename, jobFile, x, y, z): """ createRunscripts: """ from pytom.tools.files import dump2TextFile, getPytomPath text = '#!/bin/bash\n' text += 'pytom ' + getPytomPath( ) + '/bin/localization.py ' + jobFile + ' %d %d %d' % (x, y, z) + '\n' dump2TextFile(filename, text, append=False)
def showRotations(self,volume,directory,mask=None): """ showRotations: Will store x,y,z slice through volume after each rotation was applied """ from pytom.tools.toImage import volumeToPNG from pytom.tools.files import dump2TextFile from pytom_volume import vol,rotateSpline from pytom.tools.files import getPytomPath,readStringFile from pytom.frontend.htmlDefines import headResponse200,copyright pytomPath = getPytomPath() cssDefines = readStringFile(pytomPath + '/frontend/htmlDefines/CSS.css') html = '<html>' + cssDefines html = html + '\n<title>PyTom Alignment</title>\n' html = html + '<body><center><h1 type="Main">List of Rotations</h1></center>\n' html = html + '</br></br></br></br></br></br></br></br><center>\n' html = html + '<table>\n' html = html + '<tr><td>Z1 (Phi) Z2 (Psi) X(Theta)</td><td>x-Slice</td><td>y-Slice</td><td>z-Slice</td></tr>' rotated = vol(volume.sizeX(),volume.sizeY(),volume.sizeZ()) if not mask: mask = vol(volume.sizeX(),volume.sizeY(),volume.sizeZ()) mask.setAll(1) volume = volume * mask self.reset() rotation = self.nextRotation() rotationCounter = 0 while not rotation == [None,None,None]: rotateSpline(volume,rotated,rotation[0],rotation[1],rotation[2]) html = html + '<tr><td>' + str(rotation[0]) + ' ' + str(rotation[1]) + ' ' + str(rotation[2]) +'</td>/n' volumeToPNG(rotated,directory + str(rotationCounter) + '-x.png',rotated.sizeX()/2,'x') html = html + '<td><img src="' + directory + str(rotationCounter) + '-x.png"/></td>' volumeToPNG(rotated,directory + str(rotationCounter) + '-y.png',rotated.sizeY()/2,'y') html = html + '<td><img src="' + directory + str(rotationCounter) + '-y.png"/></td>' volumeToPNG(rotated,directory + str(rotationCounter) + '-z.png',rotated.sizeZ()/2,'z') html = html + '<td><img src="' + directory + str(rotationCounter) + '-z.png"/></td>' rotation = self.nextRotation() rotationCounter = rotationCounter + 1 html = html + '</body></html>' dump2TextFile(directory + 'rotations.html',html)
def setUp(self): from pytom.tools.files import dump2TextFile #from pytom_mpi import rank #exeNames = ['openmpirun','mpirun'] #runMPI = [exeNames[i] for i in range(len(exeNames)) if self.is_exe(exeNames[i])] runMPI = 'mpirun' print(runMPI) self.testCommand = runMPI + ' -c 2 pytom testScript.py' testScript = 'from pytom_mpi import rank,init,isInitialised,finalise \n' testScript += 'import os\n' testScript += 'init()\n' testScript += 'os.system("echo " +str(rank())+ " > " +str(rank())+ ".rnkPyTom" )\n' testScript += 'finalise()\n' dump2TextFile('testScript.py',testScript)