1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 import sys
24
25 from specific_fns.model_free import Model_free
26
27
30 """Class containing the function for model elimination."""
31
32 self.relax = relax
33
34
35 - def eliminate(self, run=None, function=None, args=None):
36 """Function for model elimination.
37
38 Keyword arguments
39 ~~~~~~~~~~~~~~~~~
40
41 run: The name of the run(s). By supplying a single string, array of strings, or None, a
42 single run, multiple runs, or all runs will be selected respectively.
43
44 function: A user supplied function for model elimination.
45
46 args: A tuple of arguments for model elimination.
47
48
49 Description
50 ~~~~~~~~~~~
51
52 This function is used for model validation to eliminate or reject models prior to model
53 selection. Model validation is a part of mathematical modelling whereby models are either
54 accepted or rejected.
55
56 Empirical rules are used for model rejection and are listed below. However these can be
57 overridden by supplying a function. The function should accept five arguments, a string
58 defining a certain parameter, the value of the parameter, the run name, the minimisation
59 instance (ie the residue index if the model is residue specific), and the function
60 arguments. If the model is rejected, the function should return 1, otherwise it should
61 return 0. The function will be executed multiple times, once for each parameter of the
62 model.
63
64 The 'args' keyword argument should be a tuple, a list enclosed in round brackets, and will
65 be passed to the user supplied function or the inbuilt function. For a description of the
66 arguments accepted by the inbuilt functions, see below.
67
68 Once a model is rejected, the select flag corresponding to that model will be set to 0 so
69 that model selection, or any other function, will then skip the model.
70 """
71
72
73 if self.relax.interpreter.intro:
74 text = sys.ps3 + "eliminate("
75 text = text + "run=" + `run`
76 text = text + ", function=" + `function`
77 text = text + ", args=" + `args` + ")"
78 print text
79
80
81 if run != None and type(run) != str and type(run) != list:
82 raise RelaxNoneStrListError, ('run', run)
83 if type(run) == list:
84 for i in xrange(len(run)):
85 if type(run[i]) != str:
86 raise RelaxListStrError, ('run', run)
87
88
89 if function != None and type(function) != FunctionType:
90 raise RelaxFunctionError, ('function', function)
91
92
93 if args != None and type(args) != tuple:
94 raise RelaxNoneTupleError, ('args', args)
95
96
97 self.relax.generic.eliminate.eliminate(run=run, function=function, args=args)
98
99
100
101
102
103 eliminate.__doc__ = eliminate.__doc__ + "\n\n" + Model_free.eliminate.__doc__ + "\n"
104