mailr2426 - in /1.2: data.py test_suite/diffusion_tensor.py


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

Header


Content

Posted by edward on March 28, 2006 - 08:51:
Author: bugman
Date: Tue Mar 28 08:51:05 2006
New Revision: 2426

URL: http://svn.gna.org/viewcvs/relax?rev=2426&view=rev
Log:
Merged r2424:2425 of the 'diff_tensor_bug_5559_fix' branch back into the main 
development line.

The command used was:
svn merge -r2424:2425 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/branches/diff_tensor_bug_5559_fix/ .

These changes fix bug #5559 at 
https://gna.org/bugs/?func=detailitem&item_id=5559.


Modified:
    1.2/data.py
    1.2/test_suite/diffusion_tensor.py

Modified: 1.2/data.py
URL: 
http://svn.gna.org/viewcvs/relax/1.2/data.py?rev=2426&r1=2425&r2=2426&view=diff
==============================================================================
--- 1.2/data.py (original)
+++ 1.2/data.py Tue Mar 28 08:51:05 2006
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2003, 2004 Edward d'Auvergne                                 
 #
+# Copyright (C) 2003, 2004, 2006 Edward d'Auvergne                           
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -43,7 +43,7 @@
         self.pdb = SpecificData()
 
         # Diffusion data.
-        self.diff = SpecificData()
+        self.diff = DiffTensorData()
 
         # The residue specific data.
         self.res = Residue()
@@ -134,6 +134,80 @@
 
 
 
+# Diffusion tensor specific data.
+#################################
+
+class DiffTensorData(SpecificData):
+    def __init__(self):
+        """Dictionary type class for the diffusion tensor data.
+
+        The non-default diffusion parameters are calculated on the fly.
+        """
+
+
+    def add_item(self, key):
+        """Function for adding an empty container to the dictionary.
+        
+        This overwrites the function from the parent class SpecificData.
+        """
+
+        self[key] = DiffTensorElement()
+
+
+
+class DiffTensorElement(Element):
+    def __init__(self):
+        """An empty data container for the diffusion tensor elements."""
+
+
+    def __getattr__(self, name):
+        """Function for calculating the parameters on the fly."""
+
+        # All tensor types.
+        ###################
+
+        # Diso.
+        if name == 'Diso':
+            return 1.0 / (6.0 * self.tm)
+
+
+        # Spheroidal diffusion.
+        #######################
+
+        # Dper = Diso - 1/3Da.
+        if name == 'Dper':
+            return self.Diso - 1.0/3.0 * self.Da
+
+        # Dpar = Diso + 2/3Da.
+        if name == 'Dpar':
+            return self.Diso + 2.0/3.0 * self.Da
+
+        # Dratio = Dpar / Dper.
+        if name == 'Dratio':
+            return self.Dpar / self.Dper
+
+        
+        # Ellipsoidal diffusion.
+        ########################
+
+        # Dx = Diso - 1/3Da(1 + 3Dr).
+        if name == 'Dx':
+            return self.Diso - 1.0/3.0 * self.Da * (1.0 + 3.0*self.Dr)
+
+        # Dy = Diso - 1/3Da(1 - 3Dr).
+        if name == 'Dy':
+            return self.Diso - 1.0/3.0 * self.Da * (1.0 - 3.0*self.Dr)
+
+        # Dz = Diso + 2/3Da.
+        if name == 'Dz':
+            return self.Diso + 2.0/3.0 * self.Da
+
+
+        # The attribute asked for does not exist.
+        raise AttributeError, name
+
+
+
 # Residue specific data.
 ########################
 

Modified: 1.2/test_suite/diffusion_tensor.py
URL: 
http://svn.gna.org/viewcvs/relax/1.2/test_suite/diffusion_tensor.py?rev=2426&r1=2425&r2=2426&view=diff
==============================================================================
--- 1.2/test_suite/diffusion_tensor.py (original)
+++ 1.2/test_suite/diffusion_tensor.py Tue Mar 28 08:51:05 2006
@@ -120,5 +120,5 @@
 
         # Initialise some data.
         self.relax.interpreter._Diffusion_tensor.init('sphere', 10e-9, 
fixed=1)
-        self.relax.interpreter._Diffusion_tensor.init('spheroid', (2e-8, 
1.3, 60-360, 290), spheroid_type='prolate', fixed=1)
-        self.relax.interpreter._Diffusion_tensor.init('ellipsoid', (9e-8, 
0.5, 0.3, 60+360, 290, 100), fixed=0)
+        self.relax.interpreter._Diffusion_tensor.init('spheroid', (2e-8, 
1.3, 60-360, 290), param_types=2, spheroid_type='prolate', fixed=1)
+        self.relax.interpreter._Diffusion_tensor.init('ellipsoid', (9e-8, 
5e6, 0.3, 60+360, 290, 100), fixed=0)




Related Messages


Powered by MHonArc, Updated Tue Mar 28 09:00:06 2006