Package prompt :: Module eliminate
[hide private]
[frames] | no frames]

Source Code for Module prompt.eliminate

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2003, 2004, 2009-2010 Edward d'Auvergne                       # 
 4  #                                                                             # 
 5  # This file is part of the program relax.                                     # 
 6  #                                                                             # 
 7  # relax is free software; you can redistribute it and/or modify               # 
 8  # it under the terms of the GNU General Public License as published by        # 
 9  # the Free Software Foundation; either version 2 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # relax is distributed in the hope that it will be useful,                    # 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
15  # GNU General Public License for more details.                                # 
16  #                                                                             # 
17  # You should have received a copy of the GNU General Public License           # 
18  # along with relax; if not, write to the Free Software                        # 
19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
20  #                                                                             # 
21  ############################################################################### 
22   
23  # Module docstring. 
24  """Module containing the 'eliminate' user function for removing failed models.""" 
25  __docformat__ = 'plaintext' 
26   
27  # relax module imports. 
28  from base_class import Basic_class, _build_doc 
29  import arg_check 
30  from generic_fns import eliminate 
31  from relax_errors import RelaxFunctionError, RelaxListStrError, RelaxNoneStrListError, RelaxNoneTupleError 
32  from specific_fns.model_free import Model_free 
33   
34   
35 -class Eliminate(Basic_class):
36 """Class containing the function for model elimination.""" 37
38 - def eliminate(self, function=None, args=None):
39 # Function intro text. 40 if self._exec_info.intro: 41 text = self._exec_info.ps3 + "eliminate(" 42 text = text + "function=" + repr(function) 43 text = text + ", args=" + repr(args) + ")" 44 print(text) 45 46 # The argument checks. 47 arg_check.is_func(function, 'function', can_be_none=True) 48 if function: 49 arg_check.is_tuple(args, 'args') 50 51 # Execute the functional code. 52 eliminate.eliminate(function=function, args=args)
53 54 # The function doc info. 55 eliminate._doc_title = "Elimination or rejection of models." 56 eliminate._doc_title_short = "Model elimination." 57 eliminate._doc_args = [ 58 ["function", "A user supplied function for model elimination."], 59 ["args", "A tuple of arguments for model elimination."] 60 ] 61 eliminate._doc_desc = """ 62 This is used for model validation to eliminate or reject models prior to model selection. Model validation is a part of mathematical modelling whereby models are either accepted or rejected. 63 64 Empirical rules are used for model rejection and are listed below. However these can be overridden by supplying a function in the prompt and scripting modes. The function should accept five arguments, a string defining a certain parameter, the value of the parameter, the minimisation instance (ie the residue index if the model is residue specific), and the function arguments. If the model is rejected, the function should return True, otherwise it should return False. The function will be executed multiple times, once for each parameter of the model. 65 66 The 'args' keyword argument should be a tuple, a list enclosed in round brackets, and will be passed to the user supplied function or the inbuilt function. For a description of the 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 False so that model selection, or any other function, will then skip the model. 69 """ 70 eliminate._doc_additional = [] 71 for i in range(len(Model_free.eliminate_doc)): 72 eliminate._doc_additional.append(Model_free.eliminate_doc[i]) 73 _build_doc(eliminate)
74