1 """@namespace IMP.EMageFit.utility
11 Snippet from Python website to process multiple values for
12 an option with OptionParser
25 for arg
in parser.rargs:
27 if arg[:2] ==
"--" and len(arg) > 2:
30 if arg[:1] ==
"-" and len(arg) > 1
and not floatable(arg):
34 del parser.rargs[:len(value)]
35 setattr(parser.values, option.dest, value)
42 Imports the configuration file
43 @param fn_params configuration file
44 @return Experiment Class with all the information from the config file
47 import importlib.machinery
51 name, ext = os.path.splitext(fn_params)
53 foo = importlib.machinery.SourceFileLoader(name,
54 fn_params).load_module()
56 foo = imp.load_source(name, fn_params)
57 exp = foo.Experiment()
60 if hasattr(exp,
"sampling_positions"):
62 fn_params, exp.sampling_positions.read)
63 if hasattr(exp,
"benchmark"):
64 if hasattr(exp.benchmark,
"fn_pdb_native"):
66 fn_params, exp.benchmark.fn_pdb_native)
67 if hasattr(exp.benchmark,
"fn_pdbs_native"):
69 for fn
in exp.benchmark.fn_pdbs_native:
71 exp.benchmark.fn_pdbs_native = fns
73 if hasattr(exp,
"dock_transforms"):
74 for i
in range(len(exp.dock_transforms)):
76 fn_params, exp.dock_transforms[i][2])
77 if hasattr(exp,
"em2d_restraints"):
78 for i
in range(len(exp.em2d_restraints)):
80 fn_params, exp.em2d_restraints[i][1])
def vararg_callback
Snippet from Python website to process multiple values for an option with OptionParser.
def get_experiment_params
Imports the configuration file.
std::string get_relative_path(std::string base, std::string relative)
Return a path to a file relative to another file.