Author: tlinnet Date: Wed Jun 18 17:57:44 2014 New Revision: 24115 URL: http://svn.gna.org/viewcvs/relax?rev=24115&view=rev Log: Moved the parameter conversion from target function to lib function for NS r1rho 2site. 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_r1rho_2site.py branches/disp_spin_speed/target_functions/relax_disp.py Modified: branches/disp_spin_speed/lib/dispersion/ns_r1rho_2site.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/ns_r1rho_2site.py?rev=24115&r1=24114&r2=24115&view=diff ============================================================================== --- branches/disp_spin_speed/lib/dispersion/ns_r1rho_2site.py (original) +++ branches/disp_spin_speed/lib/dispersion/ns_r1rho_2site.py Wed Jun 18 17:57:44 2014 @@ -59,7 +59,7 @@ from lib.linear_algebra.matrix_exponential import matrix_exponential -def ns_r1rho_2site(M0=None, matrix=None, r1rho_prime=None, omega=None, offset=None, r1=0.0, pA=None, pB=None, dw=None, k_AB=None, k_BA=None, spin_lock_fields=None, relax_time=None, inv_relax_time=None, back_calc=None, num_points=None): +def ns_r1rho_2site(M0=None, matrix=None, r1rho_prime=None, omega=None, offset=None, r1=0.0, pA=None, dw=None, kex=None, spin_lock_fields=None, relax_time=None, inv_relax_time=None, back_calc=None, num_points=None): """The 2-site numerical solution to the Bloch-McConnell equation for R1rho data. This function calculates and stores the R1rho values. @@ -79,14 +79,10 @@ @type r1: numpy float array of rank [NS][NM][NO][ND] @keyword pA: The population of state A. @type pA: float - @keyword pB: The population of state B. - @type pB: float @keyword dw: The chemical exchange difference between states A and B in rad/s. @type dw: numpy float array of rank [NS][NM][NO][ND] - @keyword k_AB: The rate of exchange from site A to B (rad/s). - @type k_AB: float - @keyword k_BA: The rate of exchange from site B to A (rad/s). - @type k_BA: float + @keyword kex: The kex parameter value (the exchange rate in rad/s). + @type kex: float @keyword spin_lock_fields: The R1rho spin-lock field strengths (in rad.s^-1). @type spin_lock_fields: numpy float array of rank [NS][NM][NO][ND] @keyword relax_time: The total relaxation time period for each spin-lock field strength (in seconds). @@ -98,6 +94,11 @@ @keyword num_points: The number of points on the dispersion curve, equal to the length of the tcp and back_calc arguments. @type num_points: numpy int array of rank [NS][NM][NO] """ + + # Once off parameter conversions. + pB = 1.0 - pA + k_BA = pA * kex + k_AB = pB * kex # Extract shape of experiment. NE, NS, NM, NO = num_points.shape Modified: branches/disp_spin_speed/target_functions/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/target_functions/relax_disp.py?rev=24115&r1=24114&r2=24115&view=diff ============================================================================== --- branches/disp_spin_speed/target_functions/relax_disp.py (original) +++ branches/disp_spin_speed/target_functions/relax_disp.py Wed Jun 18 17:57:44 2014 @@ -1621,11 +1621,6 @@ pA = params[self.end_index[1]] kex = params[self.end_index[1]+1] - # Once off parameter conversions. - pB = 1.0 - pA - k_BA = pA * kex - k_AB = pB * kex - # Convert dw from ppm to rad/s. Use the out argument, to pass directly to structure. multiply( multiply.outer( dw.reshape(1, self.NS), self.nm_no_nd_ones ), self.frqs, out=self.dw_struct ) @@ -1633,7 +1628,7 @@ self.r20_struct[:] = multiply.outer( r1rho_prime.reshape(self.NE, self.NS, self.NM), self.no_nd_ones ) # Back calculate the R2eff values. - ns_r1rho_2site(M0=self.M0, matrix=self.matrix, r1rho_prime=self.r20_struct, omega=self.chemical_shifts, offset=self.offset, r1=self.r1, pA=pA, pB=pB, dw=self.dw_struct, k_AB=k_AB, k_BA=k_BA, spin_lock_fields=self.spin_lock_omega1, relax_time=self.relax_times, inv_relax_time=self.inv_relax_times, back_calc=self.back_calc, num_points=self.num_disp_points) + ns_r1rho_2site(M0=self.M0, matrix=self.matrix, r1rho_prime=self.r20_struct, omega=self.chemical_shifts, offset=self.offset, r1=self.r1, pA=pA, dw=self.dw_struct, kex=kex, spin_lock_fields=self.spin_lock_omega1, relax_time=self.relax_times, inv_relax_time=self.inv_relax_times, back_calc=self.back_calc, num_points=self.num_disp_points) # Clean the data for all values, which is left over at the end of arrays. self.back_calc = self.back_calc*self.disp_struct