Beispiel #1
0
def genbuf( prjfile, bufprefix, beg, end, CTF, npad, verbose = 0 ):
	from EMAN2  import newfile_store
	from utilities import get_im
	from time import time
	import os
	if(verbose == 1):  finfo=open( os.path.join(outdir, "progress.txt"), "w" )
	else:              finfo = None
	start_time = time()
	istore = newfile_store( bufprefix, npad, CTF )
	for i in xrange( beg, end ):
		prj = get_im( prjfile, i )
		istore.add_image( prj, prj.get_attr("xform.projection") )
		if( not(finfo is None) and ((i%100==99 or i==end-1))):
			finfo.write( "%6d buffered, time: %10.3f\n" % (i+1, time()-start_time) )
			finfo.flush()
Beispiel #2
0
def genbuf( prjfile, bufprefix, beg, end, CTF, npad, verbose = 0 ):
	from EMAN2  import newfile_store
	from utilities import get_im
	from time import time
	import os
	if(verbose == 1):  finfo=open( os.path.join(outdir, "progress.txt"), "w" )
	else:              finfo = None
	start_time = time()
	istore = newfile_store( bufprefix, npad, CTF )
	for i in xrange( beg, end ):
		prj = get_im( prjfile, i )
		istore.add_image( prj, prj.get_attr("xform.projection") )
		if( not(finfo is None) and ((i%100==99 or i==end-1))):
			finfo.write( "%6d buffered, time: %10.3f\n" % (i+1, time()-start_time) )
			finfo.flush()
Beispiel #3
0
def resample_insert(bufprefix, fftvols, wgtvols, mults, CTF, npad, info=None):
    from EMAN2 import newfile_store
    ostore = newfile_store(bufprefix, npad, CTF)
    blocksize = 250
    nvol = len(fftvols)
    nprj = len(mults[0])
    nblock = (nprj - 1) / blocksize + 1

    overall_start = time()

    for iblock in range(nblock):
        if iblock == nblock - 1:
            pbeg = iblock * blocksize
            pend = nprj
        else:
            pbeg = iblock * blocksize
            pend = pbeg + blocksize

        start_time = time()
        ostore.read(pend - pbeg)
        if not (info is None):
            t = time()
            info.write("        block %d read.   \t time: %10.3f %10.3f\n" %
                       (iblock, t - start_time, t - overall_start))
            info.flush()

        start_time = time()
        for ivol in range(nvol):
            ostore.add_tovol(fftvols[ivol], wgtvols[ivol], mults[ivol], pbeg,
                             pend)
        if not (info is None):
            t = time()
            info.write("        block %d inserted.\t time: %10.3f %10.3f\n" %
                       (iblock, t - start_time, t - overall_start))
            info.flush()

    if not (info is None):
        info.write("    Projection inserted.\t time: %10.3f\n" %
                   (time() - overall_start))
        info.flush()
Beispiel #4
0
def resample_insert( bufprefix, fftvols, wgtvols, mults, CTF, npad, info=None):
	from EMAN2 import  newfile_store
	ostore = newfile_store( bufprefix, npad, CTF )
	blocksize = 250
	nvol = len(fftvols)
	nprj = len(mults[0])
	nblock = (nprj-1)/blocksize + 1

	overall_start = time()

	for iblock in xrange(nblock):
    		if iblock==nblock - 1:
        		pbeg = iblock*blocksize
        		pend = nprj
    		else:
        		pbeg = iblock*blocksize
        		pend = pbeg + blocksize

		start_time = time()
		ostore.read( pend - pbeg )
 		if not(info is None):
			t = time()
			info.write("        block %d read.   \t time: %10.3f %10.3f\n" % (iblock, t-start_time, t-overall_start) )
			info.flush()

		start_time = time()
    		for ivol in xrange(nvol):
        		ostore.add_tovol( fftvols[ivol], wgtvols[ivol], mults[ivol], pbeg, pend )
       		if not(info is None):
			t = time()
			info.write("        block %d inserted.\t time: %10.3f %10.3f\n" % (iblock, t-start_time, t-overall_start) )
			info.flush()

	if not(info is None):
		info.write("    Projection inserted.\t time: %10.3f\n" % (time() - overall_start) )
		info.flush()