本文整理汇总了Python中mpi.mpi_finalize函数的典型用法代码示例。如果您正苦于以下问题:Python mpi_finalize函数的具体用法?Python mpi_finalize怎么用?Python mpi_finalize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mpi_finalize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: measure_for_outlier_criterion
def measure_for_outlier_criterion(criterion_name, masterdir, rviper_iter, list_of_viper_run_indices):
# main_iterations = [NAME_OF_MAIN_DIR + "%03d" % i for i in range(1, rviper_iter + 1)]
main_iterations = [NAME_OF_MAIN_DIR + "%03d" % i for i in range(rviper_iter, rviper_iter + 1)]
mainoutputdir = masterdir + DIR_DELIM + main_iterations[0] + DIR_DELIM
p = []
for i1 in list_of_viper_run_indices:
p.append(read_text_row(mainoutputdir + NAME_OF_RUN_DIR + "%03d" % (i1) + DIR_DELIM + "params.txt"))
subset, avg_diff_per_image, outp = find_common_subset(p, 0)
avg_diff_per_image.sort()
x1 = len(avg_diff_per_image)
y1 = avg_diff_per_image[-1]
if y1 <= ANGLE_ERROR_THRESHOLD:
return TRIPLET_WITH_ANGLE_ERROR_LESS_THAN_THRESHOLD_HAS_BEEN_FOUND
if criterion_name == "80th percentile":
return avg_diff_per_image[int(x1*PERCENT_THRESHOLD_X)]/y1
elif criterion_name == "fastest increase in the last quartile":
for k in range(5,6):
avg_diff_per_image_diff = [x - avg_diff_per_image[i - k] for i, x in enumerate(avg_diff_per_image)][k:]
avg_diff_per_image_diff_max = max(avg_diff_per_image_diff)
avg_diff_per_image_diff_max_normalized = max(avg_diff_per_image_diff)/y1
if avg_diff_per_image_diff.index(avg_diff_per_image_diff_max) >= int(x1*0.75):
return avg_diff_per_image_diff_max_normalized
return 0.0
else:
print "Error, no criterion name is specified!"
mpi_finalize()
sys.exit()
示例2: f1
def f1():
myid = mpi_comm_rank(MPI_COMM_WORLD)
program_state_stack(locals(), getframeinfo(currentframe()), "my_state.json")
for local_var_i in range(2):
for local_var_j in range(2):
if program_state_stack(locals(), getframeinfo(currentframe())):
my_s = "%s_f1_%d_%d_%03d_%03d.txt" % (
mydir,
local_var_i,
local_var_j,
myid,
getframeinfo(currentframe()).lineno,
)
f = open(my_s, "w")
f.write(my_s[5:])
f.flush()
f.close()
if program_state_stack(locals(), getframeinfo(currentframe())):
my_s = "%s_f1_%d_%d_%03d_%03d.txt" % (
mydir,
local_var_i,
local_var_j,
myid,
getframeinfo(currentframe()).lineno,
)
f = open(my_s, "w")
f.write(my_s[5:])
f.flush()
f.close()
if program_state_stack(locals(), getframeinfo(currentframe())):
my_s = "%s_f1_%d_%d_%03d_%03d.txt" % (
mydir,
local_var_i,
local_var_j,
myid,
getframeinfo(currentframe()).lineno,
)
f = open(my_s, "w")
f.write(my_s[5:])
f.flush()
f.close()
a(local_var_i, local_var_j)
if program_state_stack(locals(), getframeinfo(currentframe())):
my_s = "%s_f1_%d_%d_%03d_%03d.txt" % (
mydir,
local_var_i,
local_var_j,
myid,
getframeinfo(currentframe()).lineno,
)
f = open(my_s, "w")
f.write(my_s[5:])
f.flush()
f.close()
program_state_stack(locals(), getframeinfo(currentframe()), last_call="LastCall")
mpi_finalize()
示例3: get_already_processed_viper_runs
def get_already_processed_viper_runs(run_get_already_processed_viper_runs):
import random
if run_get_already_processed_viper_runs:
location_location = "/Users/hvoicu/Analysis/rrviper/particle__PIC_ISAC_g1_clean/0001__sim_r_viper_pool_001/"
location_location = "/Users/hvoicu/Analysis/rrviper/particle__sp_MED_isac_clean_v1/0001__sim_r_viper_pool_001/"
if "counter" not in get_already_processed_viper_runs.__dict__:
# function needs to be called once before being used !
get_already_processed_viper_runs.counter = -2
path, dirs, files = os.walk(location_location).next()
# dirs = filter(lambda x:'run' in x, dirs)
import re
dirs = filter(lambda x:re.search('run\d\d\d$', x), dirs)
get_already_processed_viper_runs.r_permutation = range(len(dirs))
random.shuffle(get_already_processed_viper_runs.r_permutation)
print str(get_already_processed_viper_runs.r_permutation)
get_already_processed_viper_runs.counter += 1
print "get_already_processed_viper_runs.counter: " + str(get_already_processed_viper_runs.counter)
# if get_already_processed_viper_runs.counter > 9:
if get_already_processed_viper_runs.counter > (MAXIMUM_NO_OF_VIPER_RUNS_ANALYZED_TOGETHER - 1):
print "get_already_processed_viper_runs.counter > 9"
mpi_finalize()
sys.exit()
return location_location + NAME_OF_RUN_DIR + "%03d"%get_already_processed_viper_runs.r_permutation[get_already_processed_viper_runs.counter]
else:
get_already_processed_viper_runs.r_permutation = [0]*20
示例4: main
def main():
progname = os.path.basename(sys.argv[0])
usage = progname + " stack outdir <maskfile> --K=2 --nb_part=5 --th_nobj=10 --rand_seed=10 --opt_method=SSE --maxit=1000 --normalize --CTF --MPI"
parser = OptionParser(usage,version=SPARXVERSION)
parser.add_option("--K", type="int", default=2, help="Number of classes for K-means (default 2)")
parser.add_option("--nb_part", type="int", default=5, help="Number of partitions used to calculate the stability (default 5)")
#parser.add_option("--F", type="float", default=0.0, help="Cooling factor in simulated annealing, <1.0")
#parser.add_option("--T0", type="float", default=0.0, help="Simulated annealing first temperature")
parser.add_option("--th_nobj", type="int", default=1, help="Cleanning threshold, classes with number of images < th_nobj are removed (default 1)")
parser.add_option("--rand_seed", type="int", default=0, help="Random seed")
#parser.add_option("--opt_method", type='string', default='SSE', help="K-means method: SSE (default), cla")
#parser.add_option("--match", type='string', default='bbenum', help='Algorithm to match partitions: pwa, pair-wise agreement (default), or hh, hierarchical Hungarian algorithm, or bbenum')
parser.add_option("--maxit", type="int", default=1e9, help="Maximum number of iterations for k-means")
parser.add_option("--normalize", action="store_true", default=False, help="Normalize images under the mask")
parser.add_option("--CTF", action="store_true", default=False, help="Perform classification using CTF information")
#parser.add_option("--CUDA", action="store_true", default=False, help="CUDA version")
parser.add_option("--MPI", action="store_true", default=False, help="Use MPI version ")
(options, args) = parser.parse_args()
if len(args) < 2 or len(args) > 3:
print "usage: " + usage
print "Please run '" + progname + " -h' for detailed options"
else:
if len(args) == 2: mask = None
else: mask = args[2]
if options.K < 2:
sys.stderr.write('ERROR: K must be > 1 group\n\n')
sys.exit()
if options.nb_part < 2:
sys.stderr.write('ERROR: nb_part must be > 1 partition\n\n')
sys.exit()
if global_def.CACHE_DISABLE:
from utilities import disable_bdb_cache
disable_bdb_cache()
global_def.BATCH = True
if options.MPI:
from mpi import mpi_init
sys.argv = mpi_init(len(sys.argv), sys.argv)
'''if options.CUDA:
from development import k_means_stab_MPICUDA_stream_YANG
k_means_stab_MPICUDA_stream_YANG(args[0], args[1], mask, options.K, options.nb_part, options.F, options.T0, options.th_nobj, options.rand_seed, options.maxit)
else:'''
from statistics import k_means_stab_MPI_stream
k_means_stab_MPI_stream(args[0], args[1], mask, options.K, options.nb_part, 0.0, 0.0, options.th_nobj, options.rand_seed, "SSE", options.CTF, options.maxit)
else:
'''if options.CUDA:
from development import k_means_stab_CUDA_stream
k_means_stab_CUDA_stream(args[0], args[1], mask, options.K, options.nb_part, options.F, options.T0, options.th_nobj, options.rand_seed, options.maxit)
else:'''
from statistics import k_means_stab_stream
k_means_stab_stream(args[0], args[1], mask, options.K, options.nb_part, 0.0, 0.0, options.th_nobj, options.rand_seed, "SSE", options.CTF, options.maxit)
global_def.BATCH = False
if options.MPI:
from mpi import mpi_finalize
mpi_finalize()
示例5: main
def main():
arglist = []
for arg in sys.argv:
arglist.append( arg )
progname = os.path.basename(sys.argv[0])
usage = progname + " stack outdir <maskfile> --ou=outer_radius --delta=angular_bracket --maxit=max_iter --chunk=data_chunk_for_update --center --CTF --snr=SNR --sym=symmetry --function=user_function --MPI"
parser = OptionParser(usage,version=SPARXVERSION)
parser.add_option("--ou", type="float", default=-1, help="outer radius of a circular mask that should encompass the particle< int(nx/2)-1 (set to int(nx/2)-1)")
parser.add_option("--delta", type="float", default=2, help="angular bracket (set to 2)")
parser.add_option("--ts", type="float", default=2, help="shift bracket (set to 2)")
parser.add_option("--center", type="float", default=0, help="-1 - average centering method; 0 - no cetnering of template volume (default), 1 - center the volume using center of gravity")
parser.add_option("--maxit", type="int", default=10, help="maximum number of iterations (set to 10)")
parser.add_option("--chunk", type="float", default=1.0, help="chunk of data after which the 3-D structure will be updated 0<chunk<=1.0 (set to 1.0)")
parser.add_option("--CTF", action="store_true", default=False, help="Consider CTF correction during the alignments")
parser.add_option("--snr", type="float", default=1, help="SNR > 0.0 (set to 1.0)")
parser.add_option("--sym", type="string", default="c1", help="symmetry group (set to c1)")
parser.add_option("--function", type="string", default="ref_ali3d", help="name of the user-supplied reference preparation function")
parser.add_option("--npad", type="int", default= 2, help="padding size for 3D reconstruction")
parser.add_option("--debug", action="store_true", default=False, help="Debug printout")
parser.add_option("--MPI", action="store_true", default=False, help="use MPI version")
parser.add_option("--fourvar", action="store_true", default=False, help="compute Fourier variance")
(options, args) = parser.parse_args(arglist[1:])
if(len(args) < 2 or len(args) > 3):
print "usage: " + usage
print "Please run '" + progname + " -h' for detailed options"
else:
if(len(args) == 2):
mask = None
else:
mask = args[2]
if options.MPI:
from mpi import mpi_init
sys.argv = mpi_init(len(sys.argv), sys.argv)
if global_def.CACHE_DISABLE:
from utilities import disable_bdb_cache
disable_bdb_cache()
global_def.BATCH = True
if options.fourvar:
from development import nlocal_ali3d_MPI
nlocal_ali3d_MPI(args[0], args[1], mask, options.ou, options.delta, options.ts, options.center, options.maxit,
options.CTF, options.snr, options.sym, options.chunk, options.function, options.fourvar,
options.npad, options.debug)
else:
from applications import local_ali3d
local_ali3d(args[0], args[1], mask, options.ou, options.delta, options.ts, options.center, options.maxit,
options.CTF, options.snr, options.sym, options.chunk, options.function, options.fourvar,
options.npad, options.debug, options.MPI)
global_def.BATCH = False
if options.MPI:
from mpi import mpi_finalize
mpi_finalize()
示例6: main
def main():
from optparse import OptionParser
progname = os.path.basename(sys.argv[0])
usage = progname + " filelist outdir --fl=filter_low_value --aa=filter_fall_off --radccc=radius_ccc -repair=repairfile --pca --pcamask --pcanvec --MPI"
parser = OptionParser(usage,version=SPARXVERSION)
parser.add_option("--fl", type="float", default=0.0, help="cut-off frequency of hyperbolic tangent low-pass Fourier filter")
parser.add_option("--aa", type="float", default=0.0, help="fall-off of hyperbolic tangent low-pass Fourier filter")
parser.add_option("--radccc", type="int", default=-1, help="radius for ccc calculation")
parser.add_option("--MPI", action="store_true", default=False, help="use MPI version" )
parser.add_option("--repair", type="string", default="default", help="repair original bootstrap volumes: None or repair file name")
parser.add_option("--pca", action="store_true", default=False, help="run pca" )
parser.add_option("--pcamask", type="string", default=None, help="mask for pca" )
parser.add_option("--pcanvec", type="int", default=2, help="number of eigvectors computed in PCA")
parser.add_option("--n", action="store_true", default=False, help="new")
parser.add_option("--scratch", type="string", default="./", help="scratch directory")
(options, args) = parser.parse_args(sys.argv[1:])
if len(args)<2 :
print "usage: " + usage
print "Please run '" + progname + " -h' for detailed options"
else:
files = args[0:-1]
outdir = args[-1]
if global_def.CACHE_DISABLE:
from utilities import disable_bdb_cache
disable_bdb_cache()
if options.MPI:
from mpi import mpi_init
sys.argv = mpi_init( len(sys.argv), sys.argv )
arglist = []
for arg in sys.argv:
arglist.append( arg )
global_def.BATCH = True
if(options.n):
from development import var_mpi_new
var_mpi_new( files[0], outdir, options.scratch, options.fl, options.aa, options.radccc, False, False, options.repair, options.pca, options.pcamask, options.pcanvec)
else:
from applications import var_mpi
var_mpi( files, outdir, options.fl, options.aa, options.radccc, options.repair, options.pca, options.pcamask, options.pcanvec)
global_def.BATCH = False
from mpi import mpi_finalize
mpi_finalize()
else:
global_def.BATCH = True
ERROR("Please use MPI version","sxvar",1)
from applications import defvar
defvar( files, outdir, options.fl, options.aa, options.radccc, options.repair, options.pca, options.pcamask, options.pcanvec)
global_def.BATCH = False
示例7: main
def main():
arglist = []
for arg in sys.argv:
arglist.append( arg )
progname = os.path.basename(sys.argv[0])
usage = progname + " data_stack reference_stack outdir <maskfile> --ir=inner_radius --ou=outer_radius --rs=ring_step --xr=x_range --yr=y_range --ts=translation_step --center=center_type --maxit=max_iteration --CTF --snr=SNR --function=user_function_name --rand_seed=random_seed --MPI"
parser = OptionParser(usage,version=SPARXVERSION)
parser.add_option("--ir", type="float", default=1, help=" inner radius for rotational correlation > 0 (set to 1)")
parser.add_option("--ou", type="float", default=-1, help=" outer radius for rotational correlation < nx/2-1 (set to the radius of the particle)")
parser.add_option("--rs", type="float", default=1, help=" step between rings in rotational correlation > 0 (set to 1)" )
parser.add_option("--xr", type="float", default=0, help=" range for translation search in x direction, search is +/-xr ")
parser.add_option("--yr", type="float", default=0, help=" range for translation search in y direction, search is +/-yr ")
parser.add_option("--ts", type="float", default=1, help=" step of translation search in both directions")
parser.add_option("--center", type="float", default=1, help=" 0 - if you do not want the average to be centered, 1 - center the average (default=1)")
parser.add_option("--maxit", type="float", default=10, help=" maximum number of iterations (set to 10) ")
parser.add_option("--CTF", action="store_true", default=False, help=" Consider CTF correction during multiple reference alignment")
parser.add_option("--snr", type="float", default= 1.0, help=" signal-to-noise ratio of the data (set to 1.0)")
parser.add_option("--function", type="string", default="ref_ali2d", help=" name of the reference preparation function")
parser.add_option("--rand_seed", type="int", default=1000, help=" random seed of initial (set to 1000)" )
parser.add_option("--MPI", action="store_true", default=False, help=" whether to use MPI version ")
parser.add_option("--EQ", action="store_true", default=False, help=" equal version ")
(options, args) = parser.parse_args(arglist[1:])
if len(args) < 3 or len(args) > 4:
print "usage: " + usage
print "Please run '" + progname + " -h' for detailed options"
else:
if len(args) == 3:
mask = None
else:
mask = args[3]
if global_def.CACHE_DISABLE:
from utilities import disable_bdb_cache
disable_bdb_cache()
if options.MPI:
from mpi import mpi_init
sys.argv = mpi_init(len(sys.argv), sys.argv)
global_def.BATCH = True
if options.EQ:
from development import mrefeq_ali2df
#print " calling MPI",options.MPI,options.function,options.rand_seed
#print args
mrefeq_ali2df(args[0], args[1], mask, options.ir, options.ou, options.rs, options.xr, options.yr, options.ts, options.center, options.maxit, options.CTF, options.snr, options.function, options.rand_seed, options.MPI)
else:
from applications import mref_ali2d
mref_ali2d(args[0], args[1], args[2], mask, options.ir, options.ou, options.rs, options.xr, options.yr, options.ts, options.center, options.maxit, options.CTF, options.snr, options.function, options.rand_seed, options.MPI)
global_def.BATCH = False
if options.MPI:
from mpi import mpi_finalize
mpi_finalize()
示例8: main
def main():
import sys
arglist = []
for arg in sys.argv:
arglist.append( arg )
progname = os.path.basename(arglist[0])
usage = progname + " prjstack outdir bufprefix --delta --d --nvol --nbufvol --seedbase --snr --npad --CTF --MPI --verbose"
parser = OptionParser(usage,version=SPARXVERSION)
parser.add_option("--nvol", type="int", help="number of resample volumes to be generated")
parser.add_option("--nbufvol", type="int", default=1, help="number of fftvols in the memory")
parser.add_option("--delta", type="float", default=10.0, help="angular step for cones")
parser.add_option("--d", type="float", default=0.1, help="fraction of projections to leave out")
parser.add_option("--CTF", action="store_true", default=False, help="use CTF")
parser.add_option("--snr", type="float", default=1.0, help="Signal-to-Noise Ratio")
parser.add_option("--npad", type="int", default=2, help="times of padding")
parser.add_option("--seedbase", type="int", default=-1, help="random seed base")
parser.add_option("--MPI", action="store_true", default=False, help="use MPI")
parser.add_option("--verbose", type="int", default=0, help="verbose level: 0 no, 1 yes")
(options, args) = parser.parse_args( arglist[1:] )
if( len(args) !=1 and len(args) != 3):
print "usage: " + usage
return None
prjfile = args[0]
if options.MPI:
from mpi import mpi_barrier, mpi_comm_rank, mpi_comm_size, mpi_comm_split, MPI_COMM_WORLD
from mpi import mpi_init
sys.argv = mpi_init( len(sys.argv), sys.argv )
myid = mpi_comm_rank( MPI_COMM_WORLD )
ncpu = mpi_comm_size( MPI_COMM_WORLD )
else:
myid = 0
ncpu = 1
if global_def.CACHE_DISABLE:
from utilities import disable_bdb_cache
disable_bdb_cache()
outdir = args[1]
bufprefix = args[2]
resample( prjfile, outdir, bufprefix, options.nbufvol, options.nvol, options.seedbase,\
options.delta, options.d, options.snr, options.CTF, options.npad,\
options.MPI, myid, ncpu, options.verbose )
if options.MPI:
from mpi import mpi_finalize
mpi_finalize()
示例9: main
def main():
progname = os.path.basename(sys.argv[0])
usage = progname + " stack outdir <maskfile> --ir=inner_radius --ou=outer_radius --rs=ring_step --xr=x_range --yr=y_range --ts=translation_step --dst=delta --center=center --maxit=max_iteration --CTF --snr=SNR --Fourvar=Fourier_variance --Ng=group_number --Function=user_function_name --CUDA --GPUID --MPI"
parser = OptionParser(usage,version=SPARXVERSION)
parser.add_option("--ir", type="float", default=1, help="inner radius for rotational correlation > 0 (set to 1)")
parser.add_option("--ou", type="float", default=-1, help="outer radius for rotational correlation < nx/2-1 (set to the radius of the particle)")
parser.add_option("--rs", type="float", default=1, help="step between rings in rotational correlation > 0 (set to 1)" )
parser.add_option("--xr", type="string", default="4 2 1 1", help="range for translation search in x direction, search is +/xr ")
parser.add_option("--yr", type="string", default="-1", help="range for translation search in y direction, search is +/yr ")
parser.add_option("--ts", type="string", default="2 1 0.5 0.25",help="step of translation search in both directions")
parser.add_option("--dst", type="float", default=0.0, help="delta")
parser.add_option("--center", type="float", default=-1, help="-1.average center method; 0.not centered; 1.phase approximation; 2.cc with Gaussian function; 3.cc with donut-shaped image 4.cc with user-defined reference 5.cc with self-rotated average")
parser.add_option("--maxit", type="float", default=0, help="maximum number of iterations (0 means the maximum iterations is 10, but it will automatically stop should the criterion falls")
parser.add_option("--CTF", action="store_true", default=False, help="use CTF correction during alignment ")
parser.add_option("--snr", type="float", default=1.0, help="signal-to-noise ratio of the data (set to 1.0)")
parser.add_option("--Fourvar", action="store_true", default=False, help="compute Fourier variance")
parser.add_option("--Ng", type="int", default=-1, help="number of groups in the new CTF filteration")
parser.add_option("--num_ali", type="int", default=3, help="number of independent alignments to do")
parser.add_option("--function", type="string", default="ref_ali2d", help="name of the reference preparation function (default ref_ali2d)")
parser.add_option("--CUDA", action="store_true", default=False, help="use CUDA program")
parser.add_option("--GPUID", type="string", default="", help="ID of GPUs available")
parser.add_option("--MPI", action="store_true", default=False, help="use MPI version ")
(options, args) = parser.parse_args()
if len(args) < 2 or len(args) > 3:
print "usage: " + usage
print "Please run '" + progname + " -h' for detailed options"
else:
if args[1] == 'None': outdir = None
else: outdir = args[1]
if len(args) == 2: mask = None
else: mask = args[2]
from development import multi_ali2d
if global_def.CACHE_DISABLE:
from utilities import disable_bdb_cache
disable_bdb_cache()
if options.MPI:
from mpi import mpi_init
sys.argv = mpi_init(len(sys.argv),sys.argv)
global_def.BATCH = True
multi_ali2d(args[0], outdir, mask, options.ir, options.ou, options.rs, options.xr, options.yr, options.ts, options.dst, options.center, \
options.maxit, options.CTF, options.snr, options.Fourvar, options.Ng, options.num_ali, options.function, options.CUDA, options.GPUID, options.MPI)
global_def.BATCH = False
if options.MPI:
from mpi import mpi_finalize
mpi_finalize()
示例10: main
def main():
progname = os.path.basename(sys.argv[0])
usage = progname + " out_averages outdir --ou=outer_radius --xr=x_range --ts=translation_step --maxit=max_iteration --CTF --snr=SNR --function=user_function_name --Fourvar --ali=kind_of_alignment --center=center_type"
parser = OptionParser(usage,version=SPARXVERSION)
parser.add_option("--ou", type="int", default=-1, help="outer radius for rotational correlation < nx/2-1 (set to the radius of the particle)")
parser.add_option("--xr", type="string", default="4 2", help="range for translation search in x direction, search is +/xr ")
parser.add_option("--ts", type="string", default="2 1", help="step of translation search in both directions")
parser.add_option("--maxit", type="float", default=0, help="maximum number of iterations (0 means the maximum iterations is 10, but it will automatically stop should the criterion falls")
parser.add_option("--CTF", action="store_true", default=False, help="Consider CTF correction during the alignment ")
parser.add_option("--snr", type="float", default=1.0, help="signal-to-noise ratio of the data (set to 1.0)")
parser.add_option("--Fourvar", action="store_true", default=False, help="compute Fourier variance")
parser.add_option("--function", type="string", default="ref_ali2d", help="name of the reference preparation function")
parser.add_option('--Ng', type='int', default=-1, help='Ng')
parser.add_option('--num_ali', type='int', default=2, help='number of alignments')
parser.add_option('--err_th', type='float', default=1.0, help='')
parser.add_option('--th_mir', type='float', default=0.5, help='')
parser.add_option('--th_err', type='float', default=1.0, help='')
parser.add_option('--K', type='int', default=100, help='number of clusters')
parser.add_option('--dst', type='float', default=0.0, help='')
parser.add_option("--center", type="float", default=-1, help="-1.average center method; 0.not centered; 1.phase approximation; 2.cc with Gaussian function; 3.cc with donut-shaped image 4.cc with user-defined reference 5.cc with self-rotated average")
parser.add_option("--CUDA", action="store_true", default=False, help="whether to use CUDA ")
parser.add_option("--GPUID", type="string", default="", help="the IDs of GPU to use")
parser.add_option('--MPI', action='store_true', default=False, help='MPI')
parser.add_option('--old', action='store_true', default=False, help='old')
(options, args) = parser.parse_args()
if options.old == False and len(args) != 3 or options.old and len(args) != 4:
print "usage: " + usage
print "Please run '" + progname + " -h' for detailed options"
else:
if global_def.CACHE_DISABLE:
from utilities import disable_bdb_cache
disable_bdb_cache()
if options.MPI:
from mpi import mpi_init
sys.argv = mpi_init(len(sys.argv),sys.argv)
global_def.BATCH = True
if options.old:
from development import realid
realid(args[0], args[1], args[2], args[3], options.ou, options.xr, options.ts, options.maxit, options.function, options.snr, options.CTF, options.Fourvar, options.Ng, options.num_ali, options.th_mir, options.th_err, options.dst, options.center, options.CUDA, options.GPUID, options.MPI)
else:
from development import realignment
realignment(args[0], args[1], args[2], options.ou, options.xr, options.ts, options.maxit, options.function, options.snr, options.CTF, options.Fourvar, options.Ng, options.num_ali, options.err_th, options.K, options.dst, options.center, options.CUDA, options.GPUID, options.MPI)
global_def.BATCH = False
if options.MPI:
from mpi import mpi_finalize
mpi_finalize()
示例11: main
def main():
progname = os.path.basename(sys.argv[0])
usage = progname + " configure_file.cfg"
parser = OptionParser(usage,version=SPARXVERSION)
parser.add_option("--ir", type="float", default=1, help=" inner radius for rotational correlation (set to 1)")
parser.add_option("--ou", type="float", default=-1, help=" outer radius for rotational correlation (set to the radius of the particle)")
parser.add_option("--rs", type="float", default=1, help=" step between rings in rotational correlation (set to 1)" )
parser.add_option("--xr", type="float", default=0, help=" range for translation search in x direction, search is +/-xr ")
parser.add_option("--yr", type="float", default=-1, help=" range for translation search in y direction, search is +/-yr ")
parser.add_option("--ts", type="float", default=1, help=" step of translation search in both directions")
parser.add_option("--CTF", action="store_true", default=False, help=" Consider CTF correction during multiple reference assignment")
parser.add_option("--CUDA", action="store_true", default=False, help=" whether to use CUDA")
parser.add_option("--GPUID", type="string", default="0 1 2 3", help=" the IDs of GPU to use")
parser.add_option("--SA", action="store_true", default=False, help=" whether to use simulated annealing")
parser.add_option("--T", type="float", default=0.001, help=" the temperature of simulated annealing")
parser.add_option("--F", type="float", default=0.995, help=" the temperature cooling rate")
parser.add_option("--heads_up", action="store_true", default=False, help=" whether to give a heads up")
parser.add_option("--MPI", action="store_true", default=False, help=" whether to use MPI version ")
(options, args) = parser.parse_args()
if len(args) < 3 or len(args) > 4:
print "usage: " + usage
print "Please run '" + progname + " -h' for detailed options"
sys.exit()
if len(args) == 4: mask = args[3]
else: mask = None
if global_def.CACHE_DISABLE:
from utilities import disable_bdb_cache
disable_bdb_cache()
if options.MPI:
from mpi import mpi_init
sys.argv = mpi_init(len(sys.argv),sys.argv)
from development import multi_assign
global_def.BATCH = True
multi_assign(args[0], args[1], args[2], mask, options.ir, options.ou, options.rs, options.xr, options.yr, options.ts,
options.CTF, options.CUDA, options.GPUID, options.SA, options.T, options.F, options.heads_up, options.MPI)
global_def.BATCH = False
if options.MPI:
from mpi import mpi_finalize
mpi_finalize()
示例12: main
def main():
progname = os.path.basename(sys.argv[0])
usage = progname + " stack <maskfile> --search_rng=10 --maxit=max_iteration --CTF --snr=SNR --Fourvar=Fourier_variance --oneDx --MPI"
parser = OptionParser(usage,version=SPARXVERSION)
parser.add_option("--search_rng", type="int", default=-1, help="Search range for x-shift")
parser.add_option("--search_ang", type="int", default=-1, help="Search range for inplane rotation angle")
parser.add_option("--search_rng_y", type="int", default=-1, help="Search range for x-shift. Not used for 1D search (oneDx flag set).")
parser.add_option("--maxit", type="int", default=100, help="Maximum number of iterations program will perform")
parser.add_option("--CTF", action="store_true", default=False, help="Use CTF correction")
parser.add_option("--snr", type="float", default=1.0, help="signal-to-noise ratio of the data (default is 1.0)")
parser.add_option("--Fourvar", action="store_true", default=False, help="compute Fourier variance")
parser.add_option("--oneDx", action="store_true", default=False, help="1D search along x-axis")
parser.add_option("--MPI", action="store_true", default=False, help="use MPI")
parser.add_option("--curvature", action="store_true", default=False, help="for curved filament alignment")
(options, args) = parser.parse_args()
if not(options.MPI):
print "Only MPI version is currently implemented."
print "Please run '" + progname + " -h' for detailed options"
return
if len(args) < 1 or len(args) > 2:
print "usage: " + usage
print "Please run '" + progname + " -h' for detailed options"
else:
if len(args) == 1: mask = None
else: mask = args[1]
if global_def.CACHE_DISABLE:
from utilities import disable_bdb_cache
disable_bdb_cache()
from mpi import mpi_init
sys.argv = mpi_init(len(sys.argv),sys.argv)
global_def.BATCH = True
if options.oneDx:
helicalshiftali_MPI(args[0], mask, options.maxit, options.CTF, options.snr, options.Fourvar, options.search_rng)
else:
shiftali_MPI(args[0], mask, options.maxit, options.CTF, options.snr, options.Fourvar,options.search_rng,options.oneDx,options.search_rng_y)
global_def.BATCH = False
from mpi import mpi_finalize
mpi_finalize()
示例13: main
def main():
arglist = []
for arg in sys.argv:
arglist.append( arg )
progname = os.path.basename(arglist[0])
usage = progname + " stack ref_vol outdir --dp=rise --dphi=rotation --apix=pixel_size --phistep=phi_step --zstep=z_step --fract=helicising_fraction --rmax=maximum_radius --rmin=min_radius --CTF --sym=c1 --function=user_function --maxit=max_iter --MPI"
parser = OptionParser(usage,version=SPARXVERSION)
parser.add_option("--dp", type="float", default= 1.0, help="delta z - translation in Angstroms")
parser.add_option("--dphi", type="float", default= 1.0, help="delta phi - rotation in degrees")
parser.add_option("--apix", type="float", default= 1.84, help="pixel size in Angstroms")
parser.add_option("--rmin", type="int", default= 0, help="minimal radial extent of structure")
parser.add_option("--rmax", type="int", default= 70, help="maximal radial extent of structure")
parser.add_option("--fract", type="float", default= 0.66, help="fraction of the volume used for helical search")
parser.add_option("--sym", type="string", default="c1", help="symmetry of the structure")
parser.add_option("--function", type="string", default="helical", help="name of the reference preparation function")
parser.add_option("--zstep", type="int", default= 1, help="Step size for translational search along z")
parser.add_option("--CTF", action="store_true", default=False, help="CTF correction")
parser.add_option("--maxit", type="int", default=5, help="maximum number of iterations performed")
parser.add_option("--MPI", action="store_true", default=False, help="use MPI version")
(options, args) = parser.parse_args(arglist[1:])
if len(args) != 3:
print "usage: " + usage
print "Please run '" + progname + " -h' for detailed options"
else:
if options.MPI:
from mpi import mpi_init, mpi_finalize
sys.argv = mpi_init(len(sys.argv), sys.argv)
else:
print "There is only MPI version of sxfilrecons3d.py. See SPARX wiki page for downloading MyMPI details."
sys.exit()
if global_def.CACHE_DISABLE:
from utilities import disable_bdb_cache
disable_bdb_cache()
from development import filrecons3D_MPI
global_def.BATCH = True
filrecons3D_MPI(args[0], args[1], args[2], options.dp, options.dphi, options.apix, options.function, options.zstep, options.fract, options.rmax, options.rmin,
options.CTF, options.maxit, options.sym)
global_def.BATCH = False
if options.MPI: mpi_finalize()
示例14: main
def main():
progname = os.path.basename(sys.argv[0])
usage = progname + " tifdir <micdir> --inx=tif --foc=f --ext=spi --cst=1 pixel_size=2 --sca_a=1 --sca_b=1 --step=63.5 --mag=40 --MPI"
parser = OptionParser(usage,version=SPARXVERSION)
parser.add_option("--inx", type = "string", default="tif", help =" input extension ")
parser.add_option("--foc", type = "string", default="f", help =" film or CCD frames ")
parser.add_option("--ext", type = "string", default="spi", help =" extenstion of output file")
parser.add_option("--cst", type = "float", default=1, help =" contrast invert or not, -1=invert ")
parser.add_option("--pixel_size", type = "float", default=1, help =" the dimension adjusted output image pixel size")
parser.add_option("--sca_a", type = "float", default=1, help =" scanner OD converting parameter a, check manual of the scanner ")
parser.add_option("--sca_b", type = "float", default=1, help =" scanner OD converting parameter b, check manual of the scanner ")
parser.add_option("--step", type = "float", default=63.5, help =" scan step size of scanner or CCD camera ")
parser.add_option("--mag", type = "float", default=40, help =" magnification at which the images are taken ")
parser.add_option("--MPI", action="store_true", default=False, help=" whether using MPI version ")
(options, args) = parser.parse_args()
if len(args) < 1:
print "usage: " + usage
print "Please run '" + progname + " -h' for detailed options"
else:
if len(args) == 1:
outdir = None
else:
outdir = args[1]
from applications import copyfromtif
if global_def.CACHE_DISABLE:
from utilities import disable_bdb_cache
disable_bdb_cache()
if options.MPI:
from mpi import mpi_init
sys.argv = mpi_init(len(sys.argv),sys.argv)
global_def.BATCH = True
copyfromtif(args[0], outdir, options.inx, options.foc, options.ext, options.cst, options.pixel_size, options.sca_a, options.sca_b, options.step, options.mag, options.MPI)
global_def.BATCH = False
if options.MPI:
from mpi import mpi_finalize
mpi_finalize()
示例15: main
def main():
progname = os.path.basename(sys.argv[0])
usage = progname + " stackfile outdir <maskfile> --K1=Min_number_of_Cluster --K2=Max_number_of_Clusters --opt_method=K-means_method --trials=Number_of_trials_of_K-means --CTF --rand_seed=1000 --maxit=Maximum_number_of_iterations --F=simulated_annealing --T0=simulated_annealing --MPI --CUDA --debug"
parser = OptionParser(usage,version=SPARXVERSION)
parser.add_option("--K1", type="int", default=2, help="Mimimum number of clusters")
parser.add_option("--K2", type="int", default=3, help="Maximum number of clusters")
parser.add_option("--trials", type="int", default=1, help="Number of trials in K-means (default 1)")
parser.add_option("--CTF", action="store_true", default=False, help="Perform clustering using CTF information")
parser.add_option("--rand_seed", type="int", default=-1, help="Random seed of initial (default random)" )
parser.add_option("--maxit", type="int", default=100, help="Mimimum number of iterations within K-means")
#parser.add_option("--F", type="float", default=0.0, help="Factor to decrease temperature in simulated annealing, ex.: 0.9")
#parser.add_option("--T0", type="float", default=0.0, help="Initial temperature in simulated annealing, ex: 100")
parser.add_option("--MPI", action="store_true", default=False, help="Use MPI version")
parser.add_option("--debug", action="store_true", default=False, help="Debug output")
(options, args) = parser.parse_args()
if len(args) < 2 or len(args) > 3:
print "usage: " + usage
print "Please run '" + progname + " -h' for detailed options"
elif options.trials < 1:
sys.stderr.write("ERROR: Number of trials should be at least 1.\n\n")
sys.exit()
else:
if len(args)==2: mask = None
else: mask = args[2]
if options.K1 < 2:
sys.stderr.write('ERROR: K1 must be > 1 group\n\n')
sys.exit()
if global_def.CACHE_DISABLE:
from utilities import disable_bdb_cache
disable_bdb_cache()
from applications import k_means_groups
global_def.BATCH = True
k_means_groups(args[0], args[1], mask, "SSE", options.K1, options.K2, options.rand_seed, options.maxit, options.trials, options.CTF, 0.0, 0.0, options.MPI, False, options.debug)
global_def.BATCH = False
if options.MPI:
from mpi import mpi_finalize
mpi_finalize()