mailr17742 - in /branches/tensor_data: data/diff_tensor.py 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 October 08, 2012 - 11:42:
Author: bugman
Date: Mon Oct  8 11:42:23 2012
New Revision: 17742

URL: http://svn.gna.org/viewcvs/relax?rev=17742&view=rev
Log:
Created the diffusion tensor data structure type() method for setting the 
tensor type.

This is to remove the "cdp.diff_tensor.type = 'x'" code from the core of 
relax, as the structure is
now read only.


Modified:
    branches/tensor_data/data/diff_tensor.py
    branches/tensor_data/generic_fns/diffusion_tensor.py

Modified: branches/tensor_data/data/diff_tensor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/tensor_data/data/diff_tensor.py?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- branches/tensor_data/data/diff_tensor.py (original)
+++ branches/tensor_data/data/diff_tensor.py Mon Oct  8 11:42:23 2012
@@ -1000,6 +1000,22 @@
         fill_object_contents(doc, tensor_element, object=self, 
blacklist=['type'] + list(self.__class__.__dict__.keys()))
 
 
+    def type(self, value):
+        """Set the diffusion tensor type.
+
+        @param value:   The diffusion tensor type.  This can be one of 
'sphere', 'spheroid' or 'ellipsoid'.
+        @type value:    str
+        """
+
+        # Checks.
+        allowed = ['sphere', 'spheroid', 'ellipsoid']
+        if value not in allowed:
+            raise RelaxError("The diffusion tensor type '%s' must be one of 
%s." % (value, allowed))
+
+        # Set the type.
+        self.__dict__['type'] = value
+
+
 
 class DiffTensorSimList(list):
     """Empty data container for Monte Carlo simulation diffusion tensor 
data."""

Modified: branches/tensor_data/generic_fns/diffusion_tensor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/tensor_data/generic_fns/diffusion_tensor.py?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- branches/tensor_data/generic_fns/diffusion_tensor.py (original)
+++ branches/tensor_data/generic_fns/diffusion_tensor.py Mon Oct  8 11:42:23 
2012
@@ -523,7 +523,7 @@
     """
 
     # The diffusion type.
-    cdp.diff_tensor.type = 'ellipsoid'
+    cdp.diff_tensor.type('ellipsoid')
 
     # (tm, Da, Dr, alpha, beta, gamma).
     if param_types == 0:
@@ -1552,7 +1552,7 @@
     """
 
     # The diffusion type.
-    cdp.diff_tensor.type = 'sphere'
+    cdp.diff_tensor.type('sphere')
 
     # tm.
     if param_types == 0:
@@ -1596,7 +1596,7 @@
     """
 
     # The diffusion type.
-    cdp.diff_tensor.type = 'spheroid'
+    cdp.diff_tensor.type('spheroid')
 
     # Spheroid diffusion type.
     allowed_types = [None, 'oblate', 'prolate']




Related Messages


Powered by MHonArc, Updated Mon Oct 08 12:00:02 2012