mailr3983 - /1.3/generic_fns/diffusion_tensor.py


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

Header


Content

Posted by edward on November 25, 2007 - 23:49:
Author: bugman
Date: Sun Nov 25 23:49:50 2007
New Revision: 3983

URL: http://svn.gna.org/viewcvs/relax?rev=3983&view=rev
Log:
Implemented the generic_fns.diffusion_tensor.copy() function.


Modified:
    1.3/generic_fns/diffusion_tensor.py

Modified: 1.3/generic_fns/diffusion_tensor.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/diffusion_tensor.py?rev=3983&r1=3982&r2=3983&view=diff
==============================================================================
--- 1.3/generic_fns/diffusion_tensor.py (original)
+++ 1.3/generic_fns/diffusion_tensor.py Sun Nov 25 23:49:50 2007
@@ -33,27 +33,39 @@
 from relax_errors import RelaxError, RelaxNoPipeError, RelaxNoTensorError, 
RelaxTensorError, RelaxUnknownParamCombError, RelaxUnknownParamError
 
 
-def copy(run1=None, run2=None):
-    """Function for copying diffusion tensor data from run1 to run2."""
-
-    # Test if run1 exists.
-    if not run1 in relax_data_store.run_names:
-        raise RelaxNoPipeError, run1
-
-    # Test if run2 exists.
-    if not run2 in relax_data_store.run_names:
-        raise RelaxNoPipeError, run2
-
-    # Test if run1 contains diffusion tensor data.
-    if not relax_data_store.diff.has_key(run1):
-        raise RelaxNoTensorError, run1
-
-    # Test if run2 contains diffusion tensor data.
-    if relax_data_store.diff.has_key(run2):
-        raise RelaxTensorError, run2
+def copy(pipe_from=None, pipe_to=None):
+    """Function for copying diffusion tensor data from one data pipe to 
another.
+
+    @param pipe_from:   The data pipe to copy the diffusion tensor data 
from.  This defaults to the
+                        current data pipe.
+    @type pipe_from:    str
+    @param pipe_to:     The data pipe to copy the diffusion tensor data to.  
This defaults to the
+                        current data pipe.
+    @type pipe_to:      str
+    """
+
+    # Defaults.
+    if pipe_from == None and pipe_to == None:
+        raise RelaxError, "The pipe_from and pipe_to arguments cannot both 
be set to None."
+    elif pipe_from == None:
+        pipe_from = relax_data_store.current_pipe
+    elif pipe_to == None:
+        pipe_from = relax_data_store.current_pipe
+
+    # Test if the pipe_from and pipe_to data pipes exist.
+    pipes.test(pipe_from)
+    pipes.test(pipe_to)
+
+    # Test if pipe_from contains diffusion tensor data.
+    if not diff_data_exists(pipe_from):
+        raise RelaxNoTensorError
+
+    # Test if pipe_to contains diffusion tensor data.
+    if diff_data_exists(pipe_to):
+        raise RelaxTensorError
 
     # Copy the data.
-    relax_data_store.diff[run2] = deepcopy(relax_data_store.diff[run1])
+    relax_data_store[pipe_to].diff_tensor = 
deepcopy(relax_data_store[pipe_from].diff_tensor)
 
 
 def data_names():




Related Messages


Powered by MHonArc, Updated Mon Nov 26 00:00:18 2007