mailr23768 - /branches/disp_spin_speed/lib/dispersion/cr72.py


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

Header


Content

Posted by tlinnet on June 10, 2014 - 01:02:
Author: tlinnet
Date: Tue Jun 10 01:02:04 2014
New Revision: 23768

URL: http://svn.gna.org/viewcvs/relax?rev=23768&view=rev
Log:
Needed to increase the relative tolerance when testing if pA array is 1.

Now system test Relax_disp.test_hansen_cpmg_data_missing_auto_analysis passes.

Also added some comments lines, to prepare for mask replace of values.
For example if only some of etapos values should be replaced.

Task #7807 (https://gna.org/task/index.php?7807): Speed-up of dispersion 
models for Clustered analysis.

Modified:
    branches/disp_spin_speed/lib/dispersion/cr72.py

Modified: branches/disp_spin_speed/lib/dispersion/cr72.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/cr72.py?rev=23768&r1=23767&r2=23768&view=diff
==============================================================================
--- branches/disp_spin_speed/lib/dispersion/cr72.py     (original)
+++ branches/disp_spin_speed/lib/dispersion/cr72.py     Tue Jun 10 01:02:04 
2014
@@ -93,6 +93,7 @@
 
 # Python module imports.
 from numpy import allclose, arccosh, array, cos, cosh, isfinite, isnan, min, 
max, ndarray, ones, sqrt, sum, zeros
+import numpy.ma as ma
 
 # Repetitive calculations (to speed up calculations).
 eta_scale = 2.0**(-3.0/2.0)
@@ -121,6 +122,11 @@
     @type num_points:       int
     """
 
+    # Initiate test masks.
+    #mask_dw_t = False
+    #mask_pA_t = False
+    #mask_kex_t = False
+
     # Determine if calculating in numpy rank-1 float array, of higher 
dimensions.
     rank_1 = True
     if isinstance(num_points, ndarray):
@@ -134,7 +140,24 @@
             return
     # For higher dimensions, return same structure.
     else:
-        if allclose(dw, zeros(dw.shape)) or allclose(pA, ones(dw.shape)) or 
allclose(kex, zeros(dw.shape)):
+        # Test if dw is zero.
+        if allclose(dw, zeros(dw.shape)):
+            #mask_dw_t = True
+            #mask_dw = ma.masked_values(dw, 0.0)
+            back_calc[:] = r20a
+            return
+            
+        # Test if pA is zero.
+        elif allclose(pA, ones(pA.shape), rtol=1e-07):
+            #mask_pA_t = True
+            #mask_pA = ma.masked_values(pA, 1.0)
+            back_calc[:] = r20a
+            return
+
+       # Test if kex is zero.       
+        elif allclose(kex, zeros(kex.shape)):
+            #mask_kex_t = True
+            #mask_kex = ma.masked_values(kex, 0.0)
             back_calc[:] = r20a
             return
 
@@ -192,6 +215,14 @@
     # Calculate R2eff.
     R2eff = r20_kex - cpmg_frqs * arccosh( fact )
 
+    # Replace data in array.
+    #if mask_dw_t:
+    #    R2eff[mask_dw] = r20a
+    #if mask_pA_t:
+    #    R2eff[mask_pA] = r20a
+    #if mask_kex_t:
+    #    R2eff[mask_kex] = r20a
+
     # Catch errors, taking a sum over array is the fastest way to check for
     # +/- inf (infinity) and nan (not a number).
     if not isfinite(sum(R2eff)):




Related Messages


Powered by MHonArc, Updated Tue Jun 10 01:20:02 2014