Author: bugman Date: Thu May 10 12:40:03 2012 New Revision: 16180 URL: http://svn.gna.org/viewcvs/relax?rev=16180&view=rev Log: Converted the paramag.centre user function to the auto-generation design. Added: branches/uf_redesign/user_functions/paramag.py - copied, changed from r16173, branches/uf_redesign/prompt/paramag.py Removed: branches/uf_redesign/prompt/paramag.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=16180&r1=16179&r2=16180&view=diff ============================================================================== --- branches/uf_redesign/prompt/__init__.py (original) +++ branches/uf_redesign/prompt/__init__.py Thu May 10 12:40:03 2012 @@ -28,7 +28,6 @@ 'help', 'interpreter', 'objects', - 'paramag', 'pcs', 'rdc', 'relax_fit', Modified: branches/uf_redesign/prompt/interpreter.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/interpreter.py?rev=16180&r1=16179&r2=16180&view=diff ============================================================================== --- branches/uf_redesign/prompt/interpreter.py (original) +++ branches/uf_redesign/prompt/interpreter.py Thu May 10 12:40:03 2012 @@ -63,7 +63,6 @@ # User classes. from residue import Residue from structure import Structure -from paramag import Paramag from pcs import PCS from rdc import RDC from relax_fit import Relax_fit @@ -190,7 +189,6 @@ objects['temperature'] = temp.set # Place the user classes in the local namespace. - objects['paramag'] = Paramag() objects['pcs'] = PCS() objects['rdc'] = RDC() objects['relax_fit'] = Relax_fit() Removed: branches/uf_redesign/prompt/paramag.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/paramag.py?rev=16179&view=auto ============================================================================== --- branches/uf_redesign/prompt/paramag.py (original) +++ branches/uf_redesign/prompt/paramag.py (removed) @@ -1,123 +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 user function class for paramagnetic related functions.""" -__docformat__ = 'plaintext' - -# relax module imports. -from base_class import User_fn_class -import arg_check -from generic_fns import paramag -from relax_errors import RelaxError -from status import Status; status = Status() - - -class Paramag(User_fn_class): - """Class for handling paramagnetic information.""" - - def centre(self, pos=None, atom_id=None, pipe=None, verbosity=1, fix=True, ave_pos=True, force=False): - """Specify which atom is the paramagnetic centre. - - Keyword Arguments - ~~~~~~~~~~~~~~~~~ - - pos: The atomic position. - - atom_id: The atom ID string. - - pipe: The data pipe containing the structures to extract the centre from. - - verbosity: The amount of information to print out. - - fix: A flag specifying if the paramagnetic centre should be fixed during optimisation. - - ave_pos: A flag specifying if the position of the atom is to be averaged across all models. - - force: A flag which if True will cause the current paramagnetic centre to be overwritten. - - - Description - ~~~~~~~~~~~ - - This function is required for specifying where the paramagnetic centre is located in the - loaded structure file. If no structure number is given, then the average atom position will - be calculated if multiple structures are loaded. - - A different set of structures than those loaded into the current data pipe can also be used - to determine the position, or its average. This can be achieved by loading the alternative - structures into another data pipe, and then specifying that pipe through the pipe argument. - - If the ave_pos flag is set to True, the average position from all models will be used as the - position of the paramagnetic centre. If False, then the positions from all structures will - be used. If multiple positions are used, then a fast paramagnetic centre motion will be - assumed so that PCSs for a single tensor will be calculated for each position, and the PCS - values linearly averaged. - - - Examples - ~~~~~~~~ - - If the paramagnetic centre is the lanthanide Dysprosium which is labelled as Dy in a loaded - PDB file, then type one of: - - relax> paramag.centre('Dy') - relax> paramag.centre(atom_id='Dy') - - If the carbon atom 'C1' of residue '4' in the PDB file is to be used as the paramagnetic - centre, then type: - - relax> paramag.centre(':4@C1') - - To state that the Dy3+ atomic position is [0.136, 12.543, 4.356], type one of: - - relax> paramag.centre([0.136, 12.543, 4.356]) - relax> paramag.centre(pos=[0.136, 12.543, 4.356]) - - To find an unknown paramagnetic centre, type: - - relax> paramag.centre(fix=False) - """ - - # Function intro text. - if status.prompt_intro: - text = status.ps3 + "paramag.centre(" - text = text + "pos=" + repr(pos) - text = text + ", atom_id=" + repr(atom_id) - text = text + ", pipe=" + repr(pipe) - text = text + ", verbosity=" + repr(verbosity) - text = text + ", fix=" + repr(fix) - text = text + ", ave_pos=" + repr(ave_pos) - text = text + ", force=" + repr(force) + ")" - print(text) - - # The argument checks. - arg_check.is_num_list(pos, 'atomic position', size=3, can_be_none=True) - arg_check.is_str(atom_id, 'atom ID string', can_be_none=True) - arg_check.is_str(pipe, 'data pipe', can_be_none=True) - arg_check.is_int(verbosity, 'verbosity level') - arg_check.is_bool(fix, 'fix flag') - arg_check.is_bool(ave_pos, 'average position flag') - arg_check.is_bool(force, 'force flag') - - # Execute the functional code. - paramag.centre(pos=pos, atom_id=atom_id, pipe=pipe, verbosity=verbosity, fix=fix, ave_pos=ave_pos, force=force) Modified: branches/uf_redesign/user_functions/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/user_functions/__init__.py?rev=16180&r1=16179&r2=16180&view=diff ============================================================================== --- branches/uf_redesign/user_functions/__init__.py (original) +++ branches/uf_redesign/user_functions/__init__.py Thu May 10 12:40:03 2012 @@ -58,6 +58,7 @@ 'n_state_model', 'noe', 'palmer', + 'paramag', 'pipe', 'pymol_control', 'relax_data', @@ -90,6 +91,7 @@ import user_functions.n_state_model import user_functions.noe import user_functions.palmer +import user_functions.paramag import user_functions.pipe import user_functions.pymol_control import user_functions.relax_data Copied: branches/uf_redesign/user_functions/paramag.py (from r16173, branches/uf_redesign/prompt/paramag.py) URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/user_functions/paramag.py?p2=branches/uf_redesign/user_functions/paramag.py&p1=branches/uf_redesign/prompt/paramag.py&r1=16173&r2=16180&rev=16180&view=diff ============================================================================== --- branches/uf_redesign/prompt/paramag.py (original) +++ branches/uf_redesign/user_functions/paramag.py Thu May 10 12:40:03 2012 @@ -21,103 +21,106 @@ ############################################################################### # Module docstring. -"""Module containing the user function class for paramagnetic related functions.""" -__docformat__ = 'plaintext' +"""Module containing the user function data for paramagnetic related functions.""" # relax module imports. -from base_class import User_fn_class -import arg_check -from generic_fns import paramag -from relax_errors import RelaxError -from status import Status; status = Status() +from generic_fns import paramag, pipes +from graphics import WIZARD_IMAGE_PATH +from user_functions.data import Uf_info; uf_info = Uf_info() -class Paramag(User_fn_class): - """Class for handling paramagnetic information.""" - - def centre(self, pos=None, atom_id=None, pipe=None, verbosity=1, fix=True, ave_pos=True, force=False): - """Specify which atom is the paramagnetic centre. - - Keyword Arguments - ~~~~~~~~~~~~~~~~~ - - pos: The atomic position. - - atom_id: The atom ID string. - - pipe: The data pipe containing the structures to extract the centre from. - - verbosity: The amount of information to print out. - - fix: A flag specifying if the paramagnetic centre should be fixed during optimisation. - - ave_pos: A flag specifying if the position of the atom is to be averaged across all models. - - force: A flag which if True will cause the current paramagnetic centre to be overwritten. +# The user function class. +uf_class = uf_info.add_class('paramag') +uf_class.title = "Class for handling paramagnetic information." +uf_class.menu_text = "¶mag" - Description - ~~~~~~~~~~~ +# The paramag.centre user function. +uf = uf_info.add_uf('paramag.centre') +uf.title = "Specify which atom is the paramagnetic centre." +uf.title_short = "Paramagnetic centre selection." +uf.add_keyarg( + name = "pos", + py_type = "num_list", + size = 3, + desc_short = "atomic position", + desc = "The atomic position of the paramagnetic centre.", + can_be_none = True +) +uf.add_keyarg( + name = "atom_id", + py_type = "str", + desc_short = "atom ID string", + desc = "The atom ID string.", + can_be_none = True +) +uf.add_keyarg( + name = "pipe", + py_type = "str", + desc_short = "data pipe", + desc = "The data pipe containing the structures to extract the centre from.", + wiz_element_type = 'combo', + wiz_combo_iter = pipes.pipe_names, + can_be_none = True +) +uf.add_keyarg( + name = "verbosity", + default = 1, + py_type = "int", + desc_short = "verbosity level", + desc = "The amount of information to print out." +) +uf.add_keyarg( + name = "fix", + default = True, + py_type = "bool", + desc_short = "fix flag", + desc = "A flag specifying if the paramagnetic centre should be fixed during optimisation." +) +uf.add_keyarg( + name = "ave_pos", + default = True, + py_type = "bool", + desc_short = "average position flag", + desc = "A flag specifying if the position of the atom is to be averaged across all models." +) +uf.add_keyarg( + name = "force", + default = False, + py_type = "bool", + desc_short = "force flag", + desc = "A flag which if True will cause the current paramagnetic centre to be overwritten." +) +uf.desc = """ +This is required for specifying where the paramagnetic centre is located in the loaded structure file. If no structure number is given, then the average atom position will be calculated if multiple structures are loaded. - This function is required for specifying where the paramagnetic centre is located in the - loaded structure file. If no structure number is given, then the average atom position will - be calculated if multiple structures are loaded. +A different set of structures than those loaded into the current data pipe can also be used to determine the position, or its average. This can be achieved by loading the alternative structures into another data pipe, and then specifying that pipe through the pipe argument. - A different set of structures than those loaded into the current data pipe can also be used - to determine the position, or its average. This can be achieved by loading the alternative - structures into another data pipe, and then specifying that pipe through the pipe argument. +If the average position flag is set to True, the average position from all models will be used as the position of the paramagnetic centre. If False, then the positions from all structures will be used. If multiple positions are used, then a fast paramagnetic centre motion will be assumed so that PCSs for a single tensor will be calculated for each position, and the PCS values linearly averaged. +""" +uf.prompt_examples = """ +If the paramagnetic centre is the lanthanide Dysprosium which is labelled as Dy in a loaded +PDB file, then type one of: - If the ave_pos flag is set to True, the average position from all models will be used as the - position of the paramagnetic centre. If False, then the positions from all structures will - be used. If multiple positions are used, then a fast paramagnetic centre motion will be - assumed so that PCSs for a single tensor will be calculated for each position, and the PCS - values linearly averaged. +relax> paramag.centre('Dy') +relax> paramag.centre(atom_id='Dy') +If the carbon atom 'C1' of residue '4' in the PDB file is to be used as the paramagnetic +centre, then type: - Examples - ~~~~~~~~ +relax> paramag.centre(':4@C1') - If the paramagnetic centre is the lanthanide Dysprosium which is labelled as Dy in a loaded - PDB file, then type one of: +To state that the Dy3+ atomic position is [0.136, 12.543, 4.356], type one of: - relax> paramag.centre('Dy') - relax> paramag.centre(atom_id='Dy') +relax> paramag.centre([0.136, 12.543, 4.356]) +relax> paramag.centre(pos=[0.136, 12.543, 4.356]) - If the carbon atom 'C1' of residue '4' in the PDB file is to be used as the paramagnetic - centre, then type: +To find an unknown paramagnetic centre, type: - relax> paramag.centre(':4@C1') - - To state that the Dy3+ atomic position is [0.136, 12.543, 4.356], type one of: - - relax> paramag.centre([0.136, 12.543, 4.356]) - relax> paramag.centre(pos=[0.136, 12.543, 4.356]) - - To find an unknown paramagnetic centre, type: - - relax> paramag.centre(fix=False) - """ - - # Function intro text. - if status.prompt_intro: - text = status.ps3 + "paramag.centre(" - text = text + "pos=" + repr(pos) - text = text + ", atom_id=" + repr(atom_id) - text = text + ", pipe=" + repr(pipe) - text = text + ", verbosity=" + repr(verbosity) - text = text + ", fix=" + repr(fix) - text = text + ", ave_pos=" + repr(ave_pos) - text = text + ", force=" + repr(force) + ")" - print(text) - - # The argument checks. - arg_check.is_num_list(pos, 'atomic position', size=3, can_be_none=True) - arg_check.is_str(atom_id, 'atom ID string', can_be_none=True) - arg_check.is_str(pipe, 'data pipe', can_be_none=True) - arg_check.is_int(verbosity, 'verbosity level') - arg_check.is_bool(fix, 'fix flag') - arg_check.is_bool(ave_pos, 'average position flag') - arg_check.is_bool(force, 'force flag') - - # Execute the functional code. - paramag.centre(pos=pos, atom_id=atom_id, pipe=pipe, verbosity=verbosity, fix=fix, ave_pos=ave_pos, force=force) +relax> paramag.centre(fix=False) +""" +uf.backend = paramag.centre +uf.menu_text = "¢re" +uf.wizard_height_desc = 400 +uf.wizard_size = (1000, 800) +uf.wizard_apply_button = False