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
46 import importlib.machinery
47 name, ext = os.path.splitext(fn_params)
48 foo = importlib.machinery.SourceFileLoader(name,
49 fn_params).load_module()
50 exp = foo.Experiment()
53 if hasattr(exp,
"sampling_positions"):
55 fn_params, exp.sampling_positions.read)
56 if hasattr(exp,
"benchmark"):
57 if hasattr(exp.benchmark,
"fn_pdb_native"):
59 fn_params, exp.benchmark.fn_pdb_native)
60 if hasattr(exp.benchmark,
"fn_pdbs_native"):
62 for fn
in exp.benchmark.fn_pdbs_native:
64 exp.benchmark.fn_pdbs_native = fns
66 if hasattr(exp,
"dock_transforms"):
67 for i
in range(len(exp.dock_transforms)):
69 fn_params, exp.dock_transforms[i][2])
70 if hasattr(exp,
"em2d_restraints"):
71 for i
in range(len(exp.em2d_restraints)):
73 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.