mailr15021 - in /branches/frame_order_testing: generic_fns/align_tensor.py prompt/align_tensor.py


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

Header


Content

Posted by edward on December 02, 2011 - 13:14:
Author: bugman
Date: Fri Dec  2 13:14:46 2011
New Revision: 15021

URL: http://svn.gna.org/viewcvs/relax?rev=15021&view=rev
Log:
Added the spin_id argument to the align_tensor.set_domain user function.

This is to allow the spins of the domain to be specified.


Modified:
    branches/frame_order_testing/generic_fns/align_tensor.py
    branches/frame_order_testing/prompt/align_tensor.py

Modified: branches/frame_order_testing/generic_fns/align_tensor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/generic_fns/align_tensor.py?rev=15021&r1=15020&r2=15021&view=diff
==============================================================================
--- branches/frame_order_testing/generic_fns/align_tensor.py (original)
+++ branches/frame_order_testing/generic_fns/align_tensor.py Fri Dec  2 
13:14:46 2011
@@ -35,6 +35,7 @@
 from angles import wrap_angles
 from data.align_tensor import AlignTensorList
 from generic_fns import pipes
+from generic_fns.mol_res_spin import spin_loop
 from physical_constants import g1H, h_bar, kB, mu0, return_gyromagnetic_ratio
 from relax_errors import RelaxError, RelaxNoTensorError, RelaxStrError, 
RelaxTensorError, RelaxUnknownParamCombError, RelaxUnknownParamError
 
@@ -1789,13 +1790,15 @@
 """
 
 
-def set_domain(tensor=None, domain=None):
+def set_domain(tensor=None, domain=None, spin_id=None):
     """Set the domain label for the given tensor.
 
-    @param tensor:  The alignment tensor label.
-    @type tensor:   str
-    @param domain:  The domain label.
-    @type domain:   str
+    @param tensor:      The alignment tensor label.
+    @type tensor:       str
+    @param domain:      The domain label.
+    @type domain:       str
+    @keyword spin_id:   The spin ID string.
+    @type spin_id:      None or str
     """
 
     # Loop over the tensors.
@@ -1810,6 +1813,16 @@
     if not match:
         raise RelaxNoTensorError('alignment', tensor)
 
+    # Label the spins by domain.
+    if spin_id != None:
+        for spin in spin_loop(spin_id):
+            # Initialise.
+            if not hasattr(spin, 'domain'):
+                spin.domain = {}
+
+            # Set the domain.
+            spin.domain[tensor] = domain
+
 
 def svd(basis_set=0, tensors=None):
     """Function for calculating the singular values of all the loaded 
tensors.

Modified: branches/frame_order_testing/prompt/align_tensor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/prompt/align_tensor.py?rev=15021&r1=15020&r2=15021&view=diff
==============================================================================
--- branches/frame_order_testing/prompt/align_tensor.py (original)
+++ branches/frame_order_testing/prompt/align_tensor.py Fri Dec  2 13:14:46 
2011
@@ -27,7 +27,7 @@
 # Python module imports.
 
 # relax module imports.
-from base_class import User_fn_class
+from base_class import User_fn_class, _build_doc
 import arg_check
 from generic_fns import align_tensor
 
@@ -346,45 +346,40 @@
         align_tensor.reduction(full_tensor=full_tensor, 
red_tensor=red_tensor)
 
 
-    def set_domain(self, tensor=None, domain=None):
-        """Set the domain label for the alignment tensor.
-
-        Keyword Arguments
-        ~~~~~~~~~~~~~~~~~
-
-        tensor:  The alignment tensor to assign the domain label to.
-
-        domain:  The domain label.
-
-
-        Description
-        ~~~~~~~~~~~
-
-        Prior to optimisation of the N-state model or Frame Order theories, 
the domain to which each
-        alignment tensor belongs must be specified.
-
-
-        Examples
-        ~~~~~~~~
-
-        To link the alignment tensor loaded as 'chi3 C-dom' to the 
C-terminal domain 'C', type:
-
-        relax> align_tensor.set_domain(tensor='chi3 C-dom', domain='C')
-        """
-
+    def set_domain(self, tensor=None, domain=None, spin_id=None):
         # Function intro text.
         if self._exec_info.intro:
             text = self._exec_info.ps3 + "align_tensor.set_domain("
             text = text + "tensor=" + repr(tensor)
-            text = text + ", domain=" + repr(domain) + ")"
+            text = text + ", domain=" + repr(domain)
+            text = text + ", spin_id=" + repr(spin_id) + ")"
             print(text)
 
         # The argument checks.
         arg_check.is_str(tensor, 'tensor')
         arg_check.is_str(domain, 'domain')
-
-        # Execute the functional code.
-        align_tensor.set_domain(tensor=tensor, domain=domain)
+        arg_check.is_str(spin_id, 'spin ID string', can_be_none=True)
+
+        # Execute the functional code.
+        align_tensor.set_domain(tensor=tensor, domain=domain, 
spin_id=spin_id)
+
+    # The function doc info.
+    set_domain._doc_title = "Set the domain information for the alignment 
tensor."
+    set_domain._doc_title_short = "Domain information."
+    set_domain._doc_args = [
+        ["tensor", "The alignment tensor to assign the domain label to."],
+        ["domain", "The domain label."],
+        ["spin_id", "The spin ID string to restrict the loading of data to 
certain spin subsets."]
+    ]
+    set_domain._doc_desc = """
+        Prior to optimisation of the N-state model or Frame Order theories, 
the domain to which each alignment tensor belongs must be specified.  
Additionally, the spins attached to this rigid frame can also be specified.
+        """
+    set_domain._doc_examples = """
+        To link the alignment tensor loaded as 'chi3 C-dom' to the 
C-terminal domain 'C', type:
+
+        relax> align_tensor.set_domain(tensor='chi3 C-dom', domain='C')
+        """
+    _build_doc(set_domain)
 
 
     def svd(self, basis_set=0, tensors=None):




Related Messages


Powered by MHonArc, Updated Fri Dec 02 17:20:01 2011