mailRe: r24176 - /branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_star.py


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

Header


Content

Posted by Edward d'Auvergne on June 23, 2014 - 10:19:
Again, this should not be committed.  Can these checks, that you later
delete, be converted into unit tests?  That would be of huge benefit
for future developers who would like to further optimise the code.

Cheers,

Edward



On 20 June 2014 08:11,  <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet
Date: Fri Jun 20 08:11:49 2014
New Revision: 24176

URL: http://svn.gna.org/viewcvs/relax?rev=24176&view=rev
Log:
Insert check, that the newly created multidimensional matrix is the same.

They are, but only to the fifth digit.

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

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

Modified: branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_star.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_star.py?rev=24176&r1=24175&r2=24176&view=diff
==============================================================================
--- branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_star.py       
(original)
+++ branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_star.py       Fri 
Jun 20 08:11:49 2014
@@ -62,6 +62,7 @@

 # relax module imports.
 from lib.float import isNaN
+from lib.dispersion.ns_matrices import rcpmg_star_rankN
 from lib.linear_algebra.matrix_exponential import matrix_exponential
 from lib.linear_algebra.matrix_power import square_matrix_power

@@ -137,6 +138,9 @@
     # Extract the total numbers of experiments, number of spins, number of 
magnetic field strength, number of offsets, maximum number of dispersion 
point.
     NE, NS, NM, NO, ND = back_calc.shape

+    # The matrix R that contains all the contributions to the evolution, 
i.e. relaxation, exchange and chemical shift evolution.
+    R_mat, cR2_mat, Rr_mat, Rex_mat, RCS_mat = rcpmg_star_rankN(R2A=r20a, 
R2B=r20b, pA=pA, pB=pB, dw=dw, k_AB=k_AB, k_BA=k_BA, tcp=tcp)
+
     # Loop over the spins
     for si in range(NS):
         # Loop over the spectrometer frequencies.
@@ -170,7 +174,32 @@
                 r20a_si_mi_di = r20a[0, si, mi, 0, di]

                 # This matrix is a propagator that will evolve the 
magnetization with the matrix R for a delay tcp.
-                eR_tcp = matrix_exponential(R*tcp_si_mi_di)
+                R_tcp = R*tcp_si_mi_di
+                R_mat_i = R_mat[0, si, mi, 0, di]
+
+                # Insert check
+                diff = R_tcp.real -R_mat_i.real
+                if sum(diff) > 1.0e-5:
+                    print sum(diff)
+                    print "Rr_mat"
+                    print Rr*tcp_si_mi_di
+                    print Rr_mat[0, si, mi, 0, di]
+                    print "RCS_mat"
+                    print RCS*tcp_si_mi_di
+                    print RCS_mat[0, si, mi, 0, di]
+                    print "Rex_mat"
+                    print Rex*tcp_si_mi_di
+                    print Rex_mat[0, si, mi, 0, di]
+                    print "R_mat"
+                    print R*tcp_si_mi_di
+                    print R_mat[0, si, mi, 0, di]
+                    print "cR2_mat"
+                    print cR2*tcp_si_mi_di
+                    print cR2_mat[0, si, mi, 0, di]
+                    print tcp_si_mi_di - tcp[0, si, mi, 0, di]
+                    print asd
+
+                eR_tcp = matrix_exponential(R_tcp)

                 # This is the propagator for an element of [delay tcp; 180 
deg pulse; 2 times delay tcp; 180 deg pulse; delay tau], i.e. for 2 times 
tau-180-tau.
                 prop_2 = dot(dot(eR_tcp, 
matrix_exponential(cR2*tcp_si_mi_di)), eR_tcp)


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits



Related Messages


Powered by MHonArc, Updated Mon Jun 23 10:40:14 2014