1 """@namespace IMP.EMageFit.utility
10 Snippet from Python website to process multiple values for
11 an option with OptionParser
24 for arg
in parser.rargs:
26 if arg[:2] ==
"--" and len(arg) > 2:
29 if arg[:1] ==
"-" and len(arg) > 1
and not floatable(arg):
33 del parser.rargs[:len(value)]
34 setattr(parser.values, option.dest, value)
41 Imports the configuration file
42 @param fn_params configuration file
43 @return Experiment Class with all the information from the config file
46 import importlib.machinery
50 name, ext = os.path.splitext(fn_params)
52 foo = importlib.machinery.SourceFileLoader(name,
53 fn_params).load_module()
55 foo = imp.load_source(name, fn_params)
56 exp = foo.Experiment()
59 if hasattr(exp,
"sampling_positions"):
61 fn_params, exp.sampling_positions.read)
62 if hasattr(exp,
"benchmark"):
63 if hasattr(exp.benchmark,
"fn_pdb_native"):
65 fn_params, exp.benchmark.fn_pdb_native)
66 if hasattr(exp.benchmark,
"fn_pdbs_native"):
68 for fn
in exp.benchmark.fn_pdbs_native:
70 exp.benchmark.fn_pdbs_native = fns
72 if hasattr(exp,
"dock_transforms"):
73 for i
in range(len(exp.dock_transforms)):
75 fn_params, exp.dock_transforms[i][2])
76 if hasattr(exp,
"em2d_restraints"):
77 for i
in range(len(exp.em2d_restraints)):
79 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.