mailr12174 - /1.3/data/diff_tensor.py


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

Header


Content

Posted by edward on January 10, 2011 - 14:45:
Author: bugman
Date: Mon Jan 10 14:45:04 2011
New Revision: 12174

URL: http://svn.gna.org/viewcvs/relax?rev=12174&view=rev
Log:
The diffusion tensor spheroid_type variable is now only updated if it is 
never explicitly set.

This is to fix the diffusion tensor setting bug found by Vitaly Vostri 
<vvostri att gmail dott com> 
(Message-id: <AANLkTinRO3ZCNwL6GeqWdx0uBvv=PQ=zw6vpdQQeruBW@xxxxxxxxxxxxxx>
https://mail.gna.org/public/relax-users/2010-12/msg00014.html).

The result of this bug is that initialising a prolate diffusion tensor with 
Da set to zero caused 
the spheroid_type to be automatically set to 'oblate'.  This bug was 
introduced at exactly r11678,
and was part of changes for better BMRB support.  This affects relax version 
1.3.6 and the 1.3
repository line from r11678 to 12174.


Modified:
    1.3/data/diff_tensor.py

Modified: 1.3/data/diff_tensor.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/data/diff_tensor.py?rev=12174&r1=12173&r2=12174&view=diff
==============================================================================
--- 1.3/data/diff_tensor.py (original)
+++ 1.3/data/diff_tensor.py Mon Jan 10 14:45:04 2011
@@ -393,14 +393,22 @@
         raise RelaxError('The diffusion tensor has not been specified')
 
 
-def calc_spheroid_type(Da):
+def calc_spheroid_type(Da, spheroid_type, flag):
     """Determine the spheroid type.
 
-    @keyword Da:    The diffusion tensor anisotropy.
-    @type Da:       float
-    @return:        The spheroid type, either 'oblate' or 'prolate'.
-    @rtype:         str
-    """
+    @param Da:              The diffusion tensor anisotropy.
+    @type Da:               float
+    @param spheroid_type:   The current value of spheroid_type.
+    @type spheroid_type:    str
+    @param flag:            A flag which if True will cause the current 
spheroid_type value to be returned.
+    @type flag:             bool
+    @return:                The spheroid type, either 'oblate' or 'prolate'.
+    @rtype:                 str
+    """
+
+    # Do not change.
+    if flag:
+        return spheroid_type
 
     # The spheroid type.
     if Da > 0.0:
@@ -549,7 +557,7 @@
         yield ('tensor_diag',   ['tm', 'Da'],                   ['type', 
'Dpar', 'Dper'])
         yield ('rotation',      ['theta', 'phi'],               ['type', 
'spheroid_type', 'theta', 'phi'])
         yield ('tensor',        ['tm', 'Da', 'theta', 'phi'],   ['rotation', 
'tensor_diag'])
-        yield ('spheroid_type', ['Da'],                         ['Da'])
+        yield ('spheroid_type', ['Da'],                         ['Da', 
'spheroid_type', '__spheroid_type'])
 
     # Ellipsoidal diffusion.
     elif diff_type == 'ellipsoid':
@@ -626,6 +634,9 @@
         # Set the initial diffusion type to None.
         self.type = None
 
+        # Initialise the spheroid type flag.
+        self.__dict__['__spheroid_type'] = False
+
 
     def __setattr__(self, name, value):
         """Function for calculating the parameters, unit vectors, and 
tensors on the fly.
@@ -652,6 +663,10 @@
 
         # Set the attribute normally.
         self.__dict__[name] = value
+
+        # Flag for the spheroid type.
+        if name == 'spheroid_type' and value:
+            self.__dict__['__spheroid_type'] = True
 
         # Skip the updating process for certain objects.
         if name in ['type', 'fixed', 'spheroid_type']:




Related Messages


Powered by MHonArc, Updated Mon Jan 10 15:20:02 2011