Author: tlinnet Date: Thu Jun 19 17:41:55 2014 New Revision: 24155 URL: http://svn.gna.org/viewcvs/relax?rev=24155&view=rev Log: Added another intermediate step. 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_3d.py Modified: branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_3d.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_3d.py?rev=24155&r1=24154&r2=24155&view=diff ============================================================================== --- branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_3d.py (original) +++ branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_3d.py Thu Jun 19 17:41:55 2014 @@ -55,7 +55,7 @@ """ # Python module imports. -from numpy import asarray, dot, fabs, isfinite, log, min, sum +from numpy import asarray, dot, fabs, isfinite, log, min, sum, tile from numpy.ma import fix_invalid, masked_where @@ -150,6 +150,13 @@ Rexpo = matrix_exponential(R_mat_i) Rexpo_mat[0, si, mi, 0, di] = Rexpo + # Initial magnetisation. + Mint_mat = tile(M0[None, None, None, None, None, :, None], (NE, NS, NM, NO, ND, 1, 1) ) + r180x_mat = tile(r180x[None, None, None, None, None, :, :], (NE, NS, NM, NO, ND, 1, 1) ) + #print Mint.shape + #print r180x_mat.shape + #print Rexpo_mat.shape + # Loop over the spins for si in range(NS): # Loop over the spectrometer frequencies. @@ -166,14 +173,15 @@ r20a_si_mi_di = r20a[0, si, mi, 0, di] # Initial magnetisation. - Mint = M0 + Mint = Mint_mat[0, si, mi, 0, di] # This matrix is a propagator that will evolve the magnetization with the matrix R for a delay tcp. Rexpo = Rexpo_mat[0, si, mi, 0, di] + r180x_i = r180x_mat[0, si, mi, 0, di] # The essential evolution matrix. # This is the first round. - evolution_matrix = dot(Rexpo, r180x) + evolution_matrix = dot(Rexpo, r180x_i) evolution_matrix = dot(evolution_matrix, Rexpo) # The second round. evolution_matrix = dot(evolution_matrix, evolution_matrix ) @@ -183,7 +191,7 @@ Mint = dot(evolution_matrix, Mint) # The next lines calculate the R2eff using a two-point approximation, i.e. assuming that the decay is mono-exponential. - Mx = Mint[1] / pA + Mx = Mint[1][0] / pA if Mx <= 0.0 or isNaN(Mx): back_calc[0, si, mi, 0, di] = r20a_si_mi_di else: