mailr15838 - /1.3/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 April 30, 2012 - 16:39:
Author: bugman
Date: Fri Apr 27 10:30:19 2012
New Revision: 15838

URL: http://svn.gna.org/viewcvs/relax?rev=15838&view=rev
Log:
The alignment tensor user functions can now all handle the situation whereby 
no tensors exist.

This was previously giving non-informative Python tracebacks.


Modified:
    1.3/generic_fns/align_tensor.py

Modified: 1.3/generic_fns/align_tensor.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/align_tensor.py?rev=15838&r1=15837&r2=15838&view=diff
==============================================================================
--- 1.3/generic_fns/align_tensor.py (original)
+++ 1.3/generic_fns/align_tensor.py Fri Apr 27 10:30:19 2012
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003-2011 Edward d'Auvergne                                  
 #
+# Copyright (C) 2003-2012 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -230,6 +230,8 @@
     # Test if alignment tensor data exists.
     if tensor and not align_data_exists(tensor):
         raise RelaxNoTensorError('alignment')
+    if not hasattr(cdp, 'align_tensors') or len(cdp.align_tensors) == 0 or 
not hasattr(cdp, 'align_ids'):
+        raise RelaxNoTensorError('alignment')
 
     # The tensor list.
     if tensor:
@@ -262,6 +264,12 @@
 
     # Test if the current data pipe exists.
     pipes.test()
+
+    # Test if alignment tensor data exists.
+    if tensor and not align_data_exists(tensor):
+        raise RelaxNoTensorError('alignment')
+    if not hasattr(cdp, 'align_tensors') or len(cdp.align_tensors) == 0 or 
not hasattr(cdp, 'align_ids'):
+        raise RelaxNoTensorError('alignment')
 
     # Construct the tensor list.
     tensor_list = []
@@ -476,6 +484,12 @@
 
     # Test if the current data pipe exists.
     pipes.test()
+
+    # Test if alignment tensor data exists.
+    if tensor and not align_data_exists(tensor):
+        raise RelaxNoTensorError('alignment')
+    if not hasattr(cdp, 'align_tensors') or not hasattr(cdp, 'align_ids'):
+        raise RelaxNoTensorError('alignment')
 
     # Loop over the tensors.
     for i in range(len(cdp.align_tensors)):
@@ -956,7 +970,7 @@
     """
 
     # Test that alignment tensor data exists.
-    if not hasattr(cdp, 'align_tensors') or len(cdp.align_tensors) == 0:
+    if not hasattr(cdp, 'align_tensors') or len(cdp.align_tensors) == 0 or 
not hasattr(cdp, 'align_ids'):
         raise RelaxNoTensorError('alignment')
 
     # Count the number of tensors.
@@ -1075,6 +1089,13 @@
     @type red_tensor:   str
     """
 
+    # Test if the current data pipe exists.
+    pipes.test()
+
+    # Test if alignment tensor data exists.
+    if not hasattr(cdp, 'align_tensors') or len(cdp.align_tensors) == 0 or 
not hasattr(cdp, 'align_ids'):
+        raise RelaxNoTensorError('alignment')
+
     # Tensor information.
     match_full = False
     match_red = False
@@ -1798,6 +1819,10 @@
     @type domain:   str
     """
 
+    # Test if alignment tensor data exists.
+    if not hasattr(cdp, 'align_tensors') or len(cdp.align_tensors) == 0 or 
not hasattr(cdp, 'align_ids'):
+        raise RelaxNoTensorError('alignment')
+
     # Loop over the tensors.
     match = False
     for tensor_cont in cdp.align_tensors:
@@ -1851,7 +1876,7 @@
     """
 
     # Test that alignment tensor data exists.
-    if not hasattr(cdp, 'align_tensors') or len(cdp.align_tensors) == 0:
+    if not hasattr(cdp, 'align_tensors') or len(cdp.align_tensors) == 0 or 
not hasattr(cdp, 'align_ids'):
         raise RelaxNoTensorError('alignment')
 
     # Count the number of tensors used in the SVD.




Related Messages


Powered by MHonArc, Updated Mon Apr 30 16:40:08 2012