Author: tlinnet Date: Wed Jun 18 19:20:19 2014 New Revision: 24129 URL: http://svn.gna.org/viewcvs/relax?rev=24129&view=rev Log: Removal of junk, and replacing func. Task #7807 (https://gna.org/task/index.php?7807): Speed-up of dispersion models for Clustered analysis. Modified: branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_b14.py Modified: branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_b14.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_b14.py?rev=24129&r1=24128&r2=24129&view=diff ============================================================================== --- branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_b14.py (original) +++ branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_b14.py Wed Jun 18 19:20:19 2014 @@ -55,7 +55,7 @@ from lib.physical_constants import g1H, g15N from target_functions.chi2 import chi2 from target_functions.relax_disp import Dispersion -from specific_analyses.relax_disp.variables import EXP_TYPE_CPMG_SQ, MODEL_B14_FULL, MODEL_CR72, MODEL_CR72_FULL, MODEL_NS_CPMG_2SITE_3D_FULL, MODEL_NS_CPMG_2SITE_STAR_FULL +from specific_analyses.relax_disp.variables import EXP_TYPE_CPMG_SQ, MODEL_B14, MODEL_B14_FULL, MODEL_CR72, MODEL_CR72_FULL, MODEL_NS_CPMG_2SITE_3D_FULL, MODEL_NS_CPMG_2SITE_STAR_FULL # Alter setup. @@ -188,27 +188,6 @@ @return: The numpy array structures of the R2eff/R1rho values, errors, missing data, and corresponding Larmor frequencies. For each structure, the first dimension corresponds to the experiment types, the second the spins of a spin block, the third to the spectrometer field strength, and the fourth is the dispersion points. For the Larmor frequency structure, the fourth dimension is omitted. For R1rho-type data, an offset dimension is inserted between the spectrometer field strength and the dispersion points. @rtype: lists of numpy float arrays, lists of numpy float arrays, lists of numpy float arrays, numpy rank-2 int array """ - - # Unpack the parameter values. - # Initialise the post spin parameter indices. - end_index = [] - # The spin and frequency dependent R2 parameters. - end_index.append(len(self.exp_type) * self.num_spins * len(self.fields)) - if self.model in [MODEL_B14_FULL, MODEL_CR72_FULL, MODEL_NS_CPMG_2SITE_3D_FULL, MODEL_NS_CPMG_2SITE_STAR_FULL]: - end_index.append(2 * len(self.exp_type) * self.num_spins * len(self.fields)) - # The spin and dependent parameters (phi_ex, dw, padw2). - end_index.append(end_index[-1] + self.num_spins) - - # Unpack the parameter values. - R20 = self.params[:end_index[1]].reshape(self.num_spins*2, len(self.fields)) - R20A = R20[::2].flatten() - R20B = R20[1::2].flatten() - dw = self.params[end_index[1]:end_index[2]] - pA = self.params[end_index[2]] - kex = self.params[end_index[2]+1] - pB = 1.0 - pA - k_BA = pA * kex - k_AB = pB * kex # Initialise the data structures for the target function. exp_types = [] @@ -280,13 +259,6 @@ # Get the cpmg frq. cpmg_frqs[ei][mi][oi] = self.points[mi] - # Calculate how the value should be, so chi2 gets zero. - # The R20 index. - r20_index = mi + si*len(self.fields) - # Convert dw from ppm to rad/s. - dw_frq = dw[si] * frqs[ei][si][mi] - r20a=R20A[r20_index] - r20b=R20B[r20_index] back_calc = array([0.0]*len(cpmg_frqs[ei][mi][oi])) for oi in range(len(self.offset)): @@ -432,7 +404,7 @@ """ # Return chi2 value. - chi2 = self.model.func_B14_full(params) + chi2 = self.model.func_B14(params) return chi2 @@ -474,7 +446,7 @@ """ # Instantiate class - C1 = Profile(num_spins=num_spins, model=model, r2a=5.0, r2b=10.0, dw=3.0, pA=0.9, kex=1000.0, spins_params=['r2a', 'r2b', 'dw', 'pA', 'kex']) + C1 = Profile(num_spins=num_spins, model=model, r2=5.0, dw=3.0, pA=0.9, kex=1000.0, spins_params=['r2', 'dw', 'pA', 'kex']) # Repeat the function call, to simulate minimisation. for i in xrange(iter): @@ -485,38 +457,3 @@ # Execute main function. if __name__ == "__main__": main() - -def test_reshape(): - C1 = Profile(num_spins=1, model=MODEL_B14_FULL, r2a=5.0, r2b=10.0, dw=3.0, pA=0.9, kex=1000.0, spins_params=['r2a', 'r2b', 'dw', 'pA', 'kex']) - end_index = C1.model.end_index - #print("end_index:", end_index) - num_spins = C1.model.num_spins - #print("num_spins:", num_spins) - num_frq = C1.model.num_frq - #print("num_frq:", num_frq) - params = C1.params - #print("params", params) - - R20 = params[:end_index[1]].reshape(num_spins*2, num_frq) - R20A = R20[::2].flatten() - R20B = R20[1::2].flatten() - dw = params[end_index[1]:end_index[2]] - pA = params[end_index[2]] - kex = params[end_index[2]+1] - print("R20A", R20A, len(R20A)) - print("R20B", R20B, len(R20B)) - print("dw", dw, len(dw)) - print("dw", pA) - print("kex", kex) - - for si in range(num_spins): - for mi in range(num_frq): - r20_index = mi + si*num_frq - r20a=R20A[r20_index] - r20b=R20B[r20_index] - print("r20a", r20a, "r20b", r20b) - - model = C1.calc(params) - print(model) - -#test_reshape()