mailr13430 - /branches/gui_testing/prompt/deselect.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on July 06, 2011 - 09:56:
Author: bugman
Date: Wed Jul  6 09:56:10 2011
New Revision: 13430

URL: http://svn.gna.org/viewcvs/relax?rev=13430&view=rev
Log:
The deselect user functions now all have documentation created via 
_build_doc().


Modified:
    branches/gui_testing/prompt/deselect.py

Modified: branches/gui_testing/prompt/deselect.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/prompt/deselect.py?rev=13430&r1=13429&r2=13430&view=diff
==============================================================================
--- branches/gui_testing/prompt/deselect.py (original)
+++ branches/gui_testing/prompt/deselect.py Wed Jul  6 09:56:10 2011
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003, 2004, 2008-2010 Edward d'Auvergne                      
 #
+# Copyright (C) 2003-2011 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -25,6 +25,7 @@
 __docformat__ = 'plaintext'
 
 # Python module imports.
+from select import boolean_doc
 
 # relax module imports.
 from base_class import User_fn_class
@@ -36,95 +37,28 @@
     """Class for deselecting spins."""
 
     def all(self):
-        """Function for deselecting all spins.
-
-        Examples
-        ~~~~~~~~
-
+        # Function intro test.
+        if self._exec_info.intro:
+            text = self._exec_info.ps3 + "deselect.all()"
+            print(text)
+
+        # Execute the functional code.
+        selection.desel_all()
+
+    # The function doc info.
+    all._doc_title = "Deselect all spins."
+    all._doc_desc = """
+        This will deselect all spins, irregardless of their current state.
+        """
+    all._doc_examples = """
         To deselect all spins, simply type:
 
         relax> deselect.all()
         """
-
-        # Function intro test.
-        if self._exec_info.intro:
-            text = self._exec_info.ps3 + "deselect.all()"
-            print(text)
-
-        # Execute the functional code.
-        selection.desel_all()
+    _build_doc(all)
 
 
     def read(self, file=None, dir=None, spin_id_col=None, mol_name_col=None, 
res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None, 
sep=None, spin_id=None, boolean='AND', change_all=False):
-        """Function for deselecting the spins contained in a file.
-
-        Keyword Arguments
-        ~~~~~~~~~~~~~~~~~
-
-        file:  The name of the file containing the list of spins to deselect.
-
-        dir:  The directory where the file is located.
-
-        spin_id_col:  The spin ID string column (an alternative to the mol, 
res, and spin name and
-            number columns).
-
-        mol_name_col:  The molecule name column (alternative to the 
spin_id_col).
-
-        res_num_col:  The residue number column (alternative to the 
spin_id_col).
-
-        res_name_col:  The residue name column (alternative to the 
spin_id_col).
-
-        spin_num_col:  The spin number column (alternative to the 
spin_id_col).
-
-        spin_name_col:  The spin name column (alternative to the 
spin_id_col).
-
-        data_col:  The RDC data column.
-
-        error_col:  The experimental error column.
-
-        sep:  The column separator (the default is white space).
-
-        spin_id:  The spin ID string to restrict the loading of data to 
certain spin subsets.
-
-        boolean:  The boolean operator specifying how spins should be 
selected.
-
-        change_all:  A flag specifying if all other spins should be changed.
-
-
-        Description
-        ~~~~~~~~~~~
-
-        The spin system can be identified in the file using two different 
formats.  The first is the
-        spin ID string column which can include the molecule name, the 
residue name and number, and
-        the spin name and number.  Alternatively the mol_name_col, 
res_num_col, res_name_col,
-        spin_num_col, and/or spin_name_col arguments can be supplied 
allowing this information to be
-        in separate columns.  Note that the numbering of columns starts at 
one.  The spin_id
-        argument can be used to restrict the reading to certain spin types, 
for example only 15N
-        spins when only residue information is in the file.
-
-        Empty lines and lines beginning with a hash are ignored.
-
-        The 'change_all' flag argument default is False meaning that all 
spins currently either
-        selected or deselected will remain that way.  Setting the argument 
to True will cause all
-        spins not specified in the file to be selected.
-
-
-        Examples
-        ~~~~~~~~
-
-        To deselect all overlapped residues listed with residue numbers in 
the first column of the
-        file 'unresolved', type:
-
-        relax> deselect.read('unresolved', res_num_col=1)
-        relax> deselect.read(file='unresolved', res_num_col=1)
-
-        To deselect the spins in the second column of the relaxation data 
file 'r1.600' while
-        selecting all other spins, for example type:
-
-        relax> deselect.read('r1.600', spin_num_col=2, change_all=True)
-        relax> deselect.read(file='r1.600', spin_num_col=2, change_all=True)
-        """
-
         # Function intro test.
         if self._exec_info.intro:
             text = self._exec_info.ps3 + "deselect.read("
@@ -159,31 +93,49 @@
         # Execute the functional code.
         selection.desel_read(file=file, dir=dir, spin_id_col=spin_id_col, 
mol_name_col=mol_name_col, res_num_col=res_num_col, 
res_name_col=res_name_col, spin_num_col=spin_num_col, 
spin_name_col=spin_name_col, sep=sep, spin_id=spin_id, boolean=boolean, 
change_all=change_all)
 
+    # The function doc info.
+    read._doc_title = "Deselect the spins contained in a file."
+    read._doc_args = [
+        ["file", "The name of the file containing the list of spins to 
deselect."],
+        ["dir", "The directory where the file is located."],
+        ["spin_id_col", "The spin ID string column (an alternative to the 
mol, res, and spin name and number columns)."],
+        ["mol_name_col", "The molecule name column (alternative to the 
spin_id_col)."],
+        ["res_num_col", "The residue number column (alternative to the 
spin_id_col)."],
+        ["res_name_col", "The residue name column (alternative to the 
spin_id_col)."],
+        ["spin_num_col", "The spin number column (alternative to the 
spin_id_col)."],
+        ["spin_name_col", "The spin name column (alternative to the 
spin_id_col)."],
+        ["data_col", "The RDC data column."],
+        ["error_col", "The experimental error column."],
+        ["sep", "The column separator (the default is white space)."],
+        ["spin_id", "The spin ID string to restrict the loading of data to 
certain spin subsets."],
+        ["boolean", "The boolean operator specifying how spins should be 
selected."],
+        ["change_all", "A flag specifying if all other spins should be 
changed."]
+    ]
+    read._doc_desc = """
+        The spin system can be identified in the file using two different 
formats.  The first is the spin ID string column which can include the 
molecule name, the residue name and number, and the spin name and number.  
Alternatively the mol_name_col, res_num_col, res_name_col, spin_num_col, 
and/or spin_name_col arguments can be supplied allowing this information to 
be in separate columns.  Note that the numbering of columns starts at one.  
The spin_id argument can be used to restrict the reading to certain spin 
types, for example only 15N spins when only residue information is in the 
file.
+
+        Empty lines and lines beginning with a hash are ignored.
+
+        The 'change_all' flag argument default is False meaning that all 
spins currently either selected or deselected will remain that way.  Setting 
the argument to True will cause all spins not specified in the file to be 
selected.
+        """
+    read._doc_examples = """
+        To deselect all overlapped residues listed with residue numbers in 
the first column of the
+        file 'unresolved', type one of:
+
+        relax> deselect.read('unresolved', res_num_col=1)
+        relax> deselect.read(file='unresolved', res_num_col=1)
+
+        To deselect the spins in the second column of the relaxation data 
file 'r1.600' while
+        selecting all other spins, for example type:
+
+        relax> deselect.read('r1.600', spin_num_col=2, change_all=True)
+        relax> deselect.read(file='r1.600', spin_num_col=2, change_all=True)
+        """
+    read._doc_additional = [boolean_doc]
+    _build_doc(read)
+
 
     def reverse(self, spin_id=None):
-        """Function for the reversal of the spin selection.
-
-        Keyword Arguments
-        ~~~~~~~~~~~~~~~~~
-
-        spin_id:  The spin identification string.
-
-
-        Description
-        ~~~~~~~~~~~
-
-        By supplying the spin_id argument, a subset of spin can have their 
selection status
-        reversed.
-
-
-        Examples
-        ~~~~~~~~
-
-        To deselect all currently selected spins and select those which are 
deselected type:
-
-        relax> deselect.reverse()
-        """
-
         # Function intro test.
         if self._exec_info.intro:
             text = self._exec_info.ps3 + "deselect.reverse("
@@ -196,29 +148,47 @@
         # Execute the functional code.
         selection.reverse(spin_id=spin_id)
 
+    # The function doc info.
+    reverse._doc_title = "Reversal of the spin selection for the given 
spins."
+    reverse._doc_args = [
+        ["spin_id", "The spin identification string."]
+    ]
+    reverse._doc_desc = """
+        By supplying the spin_id argument, a subset of spin can have their 
selection status reversed.
+        """
+    reverse._doc_examples = """
+        To deselect all currently selected spins and select those which are 
deselected type:
+
+        relax> deselect.reverse()
+        """
+    _build_doc(reverse)
+
 
     def spin(self, spin_id=None, change_all=False):
-        """Function for deselecting specific spins.
-
-        Keyword Arguments
-        ~~~~~~~~~~~~~~~~~
-
-        spin_id:  The spin identification string.
-
-        change_all:  A flag specifying if all other spins should be changed.
-
-
-        Description
-        ~~~~~~~~~~~
-
-        The 'change_all' flag argument default is False meaning that all 
spins currently either
-        selected or deselected will remain that way.  Setting the argument 
to True will cause all
-        spins not specified by 'spin_id' to be selected.
-
-
-        Examples
-        ~~~~~~~~
-
+        # Function intro test.
+        if self._exec_info.intro:
+            text = self._exec_info.ps3 + "deselect.spin("
+            text = text + "spin_id=" + repr(spin_id)
+            text = text + ", change_all=" + repr(change_all) + ")"
+            print(text)
+
+        # The argument checks.
+        arg_check.is_str(spin_id, 'spin identification string', 
can_be_none=True)
+        arg_check.is_bool(change_all, 'change all')
+
+        # Execute the functional code.
+        selection.desel_spin(spin_id=spin_id, change_all=change_all)
+
+    # The function doc info.
+    spin._doc_title = "Deselect specific spins."
+    spin._doc_args = [
+        ["spin_id", "The spin identification string."],
+        ["change_all", "A flag specifying if all other spins should be 
changed."]
+    ]
+    spin._doc_desc = """
+        The 'change_all' flag argument default is False meaning that all 
spins currently either selected or deselected will remain that way.  Setting 
the argument to True will cause all spins not specified by 'spin_id' to be 
selected.
+        """
+    spin._doc_examples = """
         To deselect all glycines and alanines, type:
 
         relax> deselect.spin(spin_id=':GLY|:ALA')
@@ -229,17 +199,4 @@
         relax> deselect.spin(spin_id=':12')
         relax> deselect.spin(spin_id=':12&:MET')
         """
-
-        # Function intro test.
-        if self._exec_info.intro:
-            text = self._exec_info.ps3 + "deselect.spin("
-            text = text + "spin_id=" + repr(spin_id)
-            text = text + ", change_all=" + repr(change_all) + ")"
-            print(text)
-
-        # The argument checks.
-        arg_check.is_str(spin_id, 'spin identification string', 
can_be_none=True)
-        arg_check.is_bool(change_all, 'change all')
-
-        # Execute the functional code.
-        selection.desel_spin(spin_id=spin_id, change_all=change_all)
+    _build_doc(spin)




Related Messages


Powered by MHonArc, Updated Wed Jul 06 10:20:02 2011