Author: bugman Date: Mon Dec 5 15:47:19 2011 New Revision: 15027 URL: http://svn.gna.org/viewcvs/relax?rev=15027&view=rev Log: Created the prompt/script front end for the domain user function. Added: branches/frame_order_testing/prompt/domain.py - copied, changed from r15025, branches/frame_order_testing/prompt/eliminate.py Modified: branches/frame_order_testing/prompt/interpreter.py Copied: branches/frame_order_testing/prompt/domain.py (from r15025, branches/frame_order_testing/prompt/eliminate.py) URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/prompt/domain.py?p2=branches/frame_order_testing/prompt/domain.py&p1=branches/frame_order_testing/prompt/eliminate.py&r1=15025&r2=15027&rev=15027&view=diff ============================================================================== --- branches/frame_order_testing/prompt/eliminate.py (original) +++ branches/frame_order_testing/prompt/domain.py Mon Dec 5 15:47:19 2011 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2003, 2004, 2009-2010 Edward d'Auvergne # +# Copyright (C) 2003, 2004, 2009-2011 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -21,53 +21,43 @@ ############################################################################### # Module docstring. -"""Module containing the 'eliminate' user function for removing failed models.""" +"""Module containing the 'domain' user function for defining structural domains.""" __docformat__ = 'plaintext' # relax module imports. from base_class import Basic_class, _build_doc import arg_check -from generic_fns import eliminate -from relax_errors import RelaxFunctionError, RelaxListStrError, RelaxNoneStrListError, RelaxNoneTupleError +from generic_fns import domain +from relax_errors import RelaxListStrError, RelaxNoneStrListError, RelaxNoneTupleError from specific_fns.model_free import Model_free -class Eliminate(Basic_class): - """Class containing the function for model elimination.""" +class Domain(Basic_class): + """Class containing the user function for defining domains.""" - def eliminate(self, function=None, args=None): + def domain(self, id=None, spin_id=None): # Function intro text. if self._exec_info.intro: - text = self._exec_info.ps3 + "eliminate(" - text = text + "function=" + repr(function) - text = text + ", args=" + repr(args) + ")" + text = self._exec_info.ps3 + "domain(" + text = text + "id=" + repr(id) + text = text + ", spin_id=" + repr(spin_id) + ")" print(text) # The argument checks. - arg_check.is_func(function, 'function', can_be_none=True) - if function: - arg_check.is_tuple(args, 'args') + arg_check.is_str(id, 'domain ID string') + arg_check.is_str(spin_id, 'spin ID string') # Execute the functional code. - eliminate.eliminate(function=function, args=args) + domain.define(id=id, spin_id=spin_id) # 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."] + domain._doc_title = "Definition of structural domains." + domain._doc_title_short = "Domain definition." + domain._doc_args = [ + ["id", "The domain ID string."], + ["spin_id", "The spin ID string of all atomic members of the domain."] ] - 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. + domain._doc_desc = """ + This is used to define structural domains. Multiple domains can be defined, and these can overlap. Rather than labelling the currently loaded spins with the ID string, the spin ID string is stored for later use. This allows new spins to be loaded later and still be included within the same domain. """ - eliminate._doc_additional = [] - for i in range(len(Model_free.eliminate_doc)): - eliminate._doc_additional.append(Model_free.eliminate_doc[i]) - _build_doc(eliminate) + _build_doc(domain) Modified: branches/frame_order_testing/prompt/interpreter.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/prompt/interpreter.py?rev=15027&r1=15026&r2=15027&view=diff ============================================================================== --- branches/frame_order_testing/prompt/interpreter.py (original) +++ branches/frame_order_testing/prompt/interpreter.py Mon Dec 5 15:47:19 2011 @@ -54,6 +54,7 @@ # User functions. from angles import Angles +from domain import Domain from dx import OpenDX from eliminate import Eliminate from fix import Fix @@ -168,6 +169,7 @@ # Initialise the user functions (those not in user function classes) angles = Angles(self._exec_info) + domain = Domain(self._exec_info) eliminate = Eliminate(self._exec_info) fix = Fix(self._exec_info) reset = Reset(self._exec_info) @@ -180,6 +182,7 @@ # Place the user functions in the local namespace. objects['angle_diff_frame'] = angles.angle_diff_frame objects['calc'] = minimisation.calc + objects['domain'] = domain.domain objects['eliminate'] = eliminate.eliminate objects['fix'] = fix.fix objects['grid_search'] = minimisation.grid_search