Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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