mailr18104 - in /branches/cst: ./ generic_fns/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 11, 2012 - 12:34:
Author: bugman
Date: Tue Dec 11 12:34:59 2012
New Revision: 18104

URL: http://svn.gna.org/viewcvs/relax?rev=18104&view=rev
Log:
Merged revisions 18102 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk

........
  r18102 | bugman | 2012-12-11 12:32:10 +0100 (Tue, 11 Dec 2012) | 6 lines
  
  Fixes for the align_tensor.copy user function for when the tensor_to 
argument is not supplied.
  
  Now it is assumed that the new tensor will have the same name as the old.  
The new tensor is also
  properly initialised.
........

Modified:
    branches/cst/   (props changed)
    branches/cst/generic_fns/align_tensor.py

Propchange: branches/cst/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Dec 11 12:34:59 2012
@@ -1,1 +1,1 @@
-/trunk:1-18097
+/trunk:1-18102

Modified: branches/cst/generic_fns/align_tensor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/cst/generic_fns/align_tensor.py?rev=18104&r1=18103&r2=18104&view=diff
==============================================================================
--- branches/cst/generic_fns/align_tensor.py (original)
+++ branches/cst/generic_fns/align_tensor.py Tue Dec 11 12:34:59 2012
@@ -115,8 +115,8 @@
     @type tensor_from:  str
     @param pipe_from:   The data pipe to copy the alignment tensor data 
from.  This defaults to the current data pipe.
     @type pipe_from:    str
-    @param tensor_to:   The identification string of the alignment tensor to 
copy the data to.
-    @type tensor_to:    str
+    @param tensor_to:   The identification string of the alignment tensor to 
copy the data to.  If set to None, then the ID string will be set to the 
value of tensor_from.
+    @type tensor_to:    str or None
     @param pipe_to:     The data pipe to copy the alignment tensor data to.  
This defaults to the current data pipe.
     @type pipe_to:      str
     """
@@ -129,6 +129,10 @@
     elif pipe_to == None:
         pipe_to = pipes.cdp_name()
 
+    # The target tensor ID string.
+    if tensor_to == None:
+        tensor_to = tensor_from
+
     # Test if the pipe_from and pipe_to data pipes exist.
     pipes.test(pipe_from)
     pipes.test(pipe_to)
@@ -148,6 +152,10 @@
     # Create the align_tensors dictionary if it doesn't yet exist.
     if not hasattr(dp_to, 'align_tensors'):
         dp_to.align_tensors = AlignTensorList()
+
+    # Add the tensor if it doesn't already exist.
+    if tensor_to not in dp_to.align_tensors.names():
+        tensor_obj = cdp.align_tensors.add_item(tensor_to)
 
     # Find the tensor index.
     index_from = get_tensor_index(tensor_from, pipe_from)




Related Messages


Powered by MHonArc, Updated Tue Dec 11 12:40:02 2012