def close(self):
		self.onClose()
# 		loadavg = os.getloadavg()[0]
# 		if loadavg > 2.0:
# 			apDisplay.printMsg("Load average is high "+str(round(loadavg,2)))
# 			time.sleep(loadavg**2)
		apParam.closeFunctionLog(functionname=self.functionname, 
			logfile=self.logfile, msg=(not self.quiet))
		if self.quiet is False:
			apDisplay.printMsg("Ended at "+time.strftime("%a, %d %b %Y %H:%M:%S"))
			if apDisplay.isDebugOn():
				apDisplay.printDebug("Memory increase during run: %.3f MB"%((mem.active()-self.startmem)/1024.0))
			apDisplay.printColor("Total run time:\t"+apDisplay.timeString(time.time()-self.t0),"green")
Example #2
0
def boxerFrameStack(framestackpath, parttree, outstack, boxsize,framelist):
        """
        boxes the particles and returns them as a list of numpy arrays
        """
        start_frame = framelist[0]
        nframe = len(framelist)
        apDisplay.printMsg("boxing %d particles from sum of total %d frames starting from frame %d using mmap" % (len(parttree),nframe,start_frame))
        boxedparticles = []
        stack = mrc.mmap(framestackpath)
        for partdict in parttree:
                x1,x2,y1,y2 = getBoxBoundary(partdict, boxsize)
                apDisplay.printDebug(' crop range of (x,y)=(%d,%d) to (%d,%d)' % (x1,y1,x2-1,y2-1))
                #numpy arrays are rows,cols --> y,x not x,y
                boxpart = numpy.sum(stack[tuple(framelist),y1:y2,x1:x2],axis=0)
                boxedparticles.append(boxpart)
        apImagicFile.writeImagic(boxedparticles, outstack)
        return True
Example #3
0
 def close(self):
     self.onClose()
     # 		loadavg = os.getloadavg()[0]
     # 		if loadavg > 2.0:
     # 			apDisplay.printMsg("Load average is high "+str(round(loadavg,2)))
     # 			time.sleep(loadavg**2)
     apParam.closeFunctionLog(functionname=self.functionname,
                              logfile=self.logfile,
                              msg=(not self.quiet))
     if self.quiet is False:
         apDisplay.printMsg("Ended at " +
                            time.strftime("%a, %d %b %Y %H:%M:%S"))
         if apDisplay.isDebugOn():
             apDisplay.printDebug("Memory increase during run: %.3f MB" %
                                  ((mem.active() - self.startmem) / 1024.0))
         apDisplay.printColor(
             "Total run time:\t" +
             apDisplay.timeString(time.time() - self.t0), "green")