Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sumvol += volref
set_filter_parameters_from_adjusted_fsc(Tracker["constants"]["total_stack"],ngroup[iref],Tracker)
if myid==main_node:
log.add("%d reference low pass filter is %f %f %d"%(iref,Tracker["lowpass"],Tracker["falloff"],ngroup[iref]))
refdata= [None]*4
refdata[0] = volref
refdata[1] = Tracker
refdata[2] = None
refdata[3] = None
volref = user_func(refdata)
if myid == main_node:
volref.write_image(os.path.join(outdir, "volf%04d.hdf"%( total_iter)), iref)
del volref
if runtype=="REFINEMENT":
if fourvar:
varf = varf3d_MPI(data, os.path.join(outdir, "ssnr%04d"%total_iter), None,sumvol,last_ring, 1.0, 1, CTF, 1, sym, myid)
if myid == main_node:
varf = 1.0/varf
varf.write_image( os.path.join(outdir,"varf%04d.hdf"%total_iter) )
# here we write header info
mpi_barrier(MPI_COMM_WORLD)
#start_time = time()
if runtype=="REFINEMENT":
par_str = ['xform.projection', 'ID', 'group']
else:
par_str = ['group', 'ID' ]
#if myid == main_node:
# from utilities import file_type
# if file_type(stack) == "bdb":
# from utilities import recv_attr_dict_bdb
# recv_attr_dict_bdb(main_node, stack, data, par_str, image_start, image_end, number_of_proc)
# else:
if debug:
finfo.write( "Image_start, image_end: %d %d\n" %(image_start, image_end) )
finfo.flush()
start_time = time()
if myid == main_node:
log.add( "Time to read data: %d\n" % (time()-start_time) );start_time = time()
# Initialize Particle ID and set group number to non-existant -1
assignment = [-1]*len(data)
for im in xrange(len(data)):
data[im].set_attr_dict({'ID':list_of_particles[im], 'group':-1})
if fourvar:
from reconstruction import rec3D_MPI
from statistics import varf3d_MPI
# Compute Fourier variance
vol, fscc = rec3D_two_chunks_MPI(data,snr,sym,fscmask,os.path.join(outdir, "resolution0000"), myid, main_node, finfo=frec, npad=npad)
varf = varf3d_MPI(data, os.path.join(outdir, "ssnr0000"), None, vol, last_ring, 1.0, 1, CTF, 1, sym, myid)
if myid == main_node:
varf = 1.0/varf
varf.write_image( os.path.join(outdir,"varf0000.hdf") )
else:
varf = None
refdata =[None]*4
for iref in xrange(numref):
set_filter_parameters_from_adjusted_fsc(Tracker["constants"]["total_stack"],Tracker["number_of_ref_class"][iref],Tracker)
refdata[0] = ref_list[iref]
refdata[1] = Tracker
refdata[2] = 0
refdata[3] = None
volref = user_func(refdata)
if myid ==main_node:
log.add("%d reference low pass filter is %f %f %d"%(iref, Tracker["lowpass"], Tracker["falloff"],Tracker["number_of_ref_class"][iref]))
ref_list[iref].write_image(os.path.join(outdir, "volf0000.hdf"), iref)
if( type(stack) is types.StringType ):
data[im] = get_im(stack, list_of_particles[im])
data[im].set_attr_dict({'ID':list_of_particles[im], 'group':-1})
else:
data[im] = stack[list_of_particles[im]]
# NOTE: in case data comes in, it would have to have ID set as there is no way to tell here what was the original ordering.
data[im].set_attr_dict({ 'group':-1})
if(myid == 0):
log.add( "Time to read data: %d" % (time()-start_time) );start_time = time()
if fourvar:
from reconstruction import rec3D_MPI
from statistics import varf3d_MPI
# Compute Fourier variance
vol, fscc = rec3D_MPI(data, snr, sym, model_circle(last_ring, nx, nx, nx), os.path.join(outdir, "resolution0000"), myid, main_node, finfo=frec, npad=npad)
varf = varf3d_MPI(data, os.path.join(outdir, "ssnr0000"), None, vol, last_ring, 1.0, 1, CTF, 1, sym, myid)
if myid == main_node:
varf = 1.0/varf
varf.write_image( os.path.join(outdir,"varf0000.hdf") )
else:
varf = None
if myid == main_node:
refdata = [None]*7
for iref in xrange(numref):
vol = get_im(ref_vol, iref).write_image(os.path.join(outdir, "vol0000.hdf"), iref)
refdata[0] = numref
refdata[1] = outdir
refdata[2] = frequency_low_pass
refdata[3] = 0
#refdata[4] = varf
refdata[5] = mask3D