Author: bugman Date: Tue May 8 15:48:28 2012 New Revision: 16101 URL: http://svn.gna.org/viewcvs/relax?rev=16101&view=rev Log: Converted the eliminate user function to the auto-generation design. Added: branches/uf_redesign/user_functions/eliminate.py - copied, changed from r16097, branches/uf_redesign/prompt/eliminate.py Removed: branches/uf_redesign/prompt/eliminate.py Modified: branches/uf_redesign/prompt/__init__.py branches/uf_redesign/prompt/interpreter.py branches/uf_redesign/user_functions/__init__.py Modified: branches/uf_redesign/prompt/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/__init__.py?rev=16101&r1=16100&r2=16101&view=diff ============================================================================== --- branches/uf_redesign/prompt/__init__.py (original) +++ branches/uf_redesign/prompt/__init__.py Tue May 8 15:48:28 2012 @@ -24,7 +24,6 @@ __all__ = ['base_class', 'command', 'doc_string', - 'eliminate', 'fix', 'frame_order', 'frq', Removed: branches/uf_redesign/prompt/eliminate.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/eliminate.py?rev=16100&view=auto ============================================================================== --- branches/uf_redesign/prompt/eliminate.py (original) +++ branches/uf_redesign/prompt/eliminate.py (removed) @@ -1,74 +1,0 @@ -############################################################################### -# # -# Copyright (C) 2003-2012 Edward d'Auvergne # -# # -# This file is part of the program relax. # -# # -# relax is free software; you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation; either version 2 of the License, or # -# (at your option) any later version. # -# # -# relax is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with relax; if not, write to the Free Software # -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# # -############################################################################### - -# Module docstring. -"""Module containing the 'eliminate' user function for removing failed models.""" -__docformat__ = 'plaintext' - -# relax module imports. -from base_class import _build_doc -import arg_check -from generic_fns import eliminate -from relax_errors import RelaxFunctionError, RelaxListStrError, RelaxNoneStrListError, RelaxNoneTupleError -from specific_fns.model_free import Model_free -from status import Status; status = Status() - - -class Eliminate: - """Class containing the function for model elimination.""" - - def eliminate(self, function=None, args=None): - # Function intro text. - if status.prompt_intro: - text = status.ps3 + "eliminate(" - text = text + "function=" + repr(function) - text = text + ", args=" + repr(args) + ")" - print(text) - - # The argument checks. - arg_check.is_func(function, 'function', can_be_none=True) - if function: - arg_check.is_tuple(args, 'args') - - # Execute the functional code. - eliminate.eliminate(function=function, args=args) - - # The function doc info. - eliminate._doc_title = "Elimination or rejection of models." - eliminate._doc_title_short = "Model elimination." - eliminate._doc_args = [ - ["function", "A user supplied function for model elimination."], - ["args", "A tuple of arguments for model elimination."] - ] - eliminate._doc_desc = """ - 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. - - 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. - - 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. - - 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. - """ - eliminate._doc_additional = [] - for i in range(len(Model_free.eliminate_doc)): - eliminate._doc_additional.append(Model_free.eliminate_doc[i]) - _build_doc(eliminate) Modified: branches/uf_redesign/prompt/interpreter.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/interpreter.py?rev=16101&r1=16100&r2=16101&view=diff ============================================================================== --- branches/uf_redesign/prompt/interpreter.py (original) +++ branches/uf_redesign/prompt/interpreter.py Tue May 8 15:48:28 2012 @@ -55,7 +55,6 @@ from status import Status; status = Status() # User functions. -from eliminate import Eliminate from fix import Fix from gpl import GPL from reset import Reset @@ -191,14 +190,12 @@ objects['gpl'] = objects['GPL'] = GPL() # Initialise the user functions (those not in user function classes) - eliminate = Eliminate() fix = Fix() reset = Reset() sys_info = Sys_info() temp = Temp() # Place the user functions in the local namespace. - objects['eliminate'] = eliminate.eliminate objects['fix'] = fix.fix objects['reset'] = reset.reset objects['sys_info'] = sys_info.sys_info Modified: branches/uf_redesign/user_functions/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/user_functions/__init__.py?rev=16101&r1=16100&r2=16101&view=diff ============================================================================== --- branches/uf_redesign/user_functions/__init__.py (original) +++ branches/uf_redesign/user_functions/__init__.py Tue May 8 15:48:28 2012 @@ -43,6 +43,7 @@ 'deselect', 'diffusion_tensor', 'dx', + 'eliminate', 'minimisation', 'model_selection', 'molmol', @@ -64,6 +65,7 @@ import user_functions.deselect import user_functions.diffusion_tensor import user_functions.dx +import user_functions.eliminate import user_functions.minimisation import user_functions.model_selection import user_functions.molmol Copied: branches/uf_redesign/user_functions/eliminate.py (from r16097, branches/uf_redesign/prompt/eliminate.py) URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/user_functions/eliminate.py?p2=branches/uf_redesign/user_functions/eliminate.py&p1=branches/uf_redesign/prompt/eliminate.py&r1=16097&r2=16101&rev=16101&view=diff ============================================================================== --- branches/uf_redesign/prompt/eliminate.py (original) +++ branches/uf_redesign/user_functions/eliminate.py Tue May 8 15:48:28 2012 @@ -25,50 +25,46 @@ __docformat__ = 'plaintext' # relax module imports. -from base_class import _build_doc -import arg_check from generic_fns import eliminate -from relax_errors import RelaxFunctionError, RelaxListStrError, RelaxNoneStrListError, RelaxNoneTupleError +from graphics import WIZARD_IMAGE_PATH from specific_fns.model_free import Model_free -from status import Status; status = Status() +from user_functions.data import Uf_info; uf_info = Uf_info() -class Eliminate: - """Class containing the function for model elimination.""" +# The eliminate user function. +uf = uf_info.add_uf('eliminate') +uf.title = "Elimination or rejection of models." +uf.title_short = "Model elimination." +uf.display = True +uf.add_keyarg( + name = "function", + py_type = "func", + arg_type = "func", + desc_short = "function", + desc = "An optional user supplied function for model elimination.", + can_be_none = True +) +uf.add_keyarg( + name = "args", + py_type = "tuple", + arg_type = "func args", + desc_short = "function arguments", + desc = "A tuple of arguments used by the optional function for model elimination.", + can_be_none = True +) +uf.desc = """ +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. - def eliminate(self, function=None, args=None): - # Function intro text. - if status.prompt_intro: - text = status.ps3 + "eliminate(" - text = text + "function=" + repr(function) - text = text + ", args=" + repr(args) + ")" - print(text) +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. - # The argument checks. - arg_check.is_func(function, 'function', can_be_none=True) - if function: - arg_check.is_tuple(args, 'args') +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. - # Execute the functional code. - eliminate.eliminate(function=function, args=args) - - # The function doc info. - eliminate._doc_title = "Elimination or rejection of models." - eliminate._doc_title_short = "Model elimination." - eliminate._doc_args = [ - ["function", "A user supplied function for model elimination."], - ["args", "A tuple of arguments for model elimination."] - ] - eliminate._doc_desc = """ - 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. - - 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. - - 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. - - 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. - """ - eliminate._doc_additional = [] - for i in range(len(Model_free.eliminate_doc)): - eliminate._doc_additional.append(Model_free.eliminate_doc[i]) - _build_doc(eliminate) +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. +""" +uf.additional = [] +uf.additional += Model_free.eliminate_doc +uf.backend = eliminate.eliminate +uf.menu_text = "&eliminate" +uf.wizard_height_desc = 650 +uf.wizard_size = (1000, 800) +uf.wizard_apply_button = False