Author: bugman Date: Thu Nov 21 21:59:57 2013 New Revision: 21588 URL: http://svn.gna.org/viewcvs/relax?rev=21588&view=rev Log: Converted the 'MQ CR72' dispersion model to handle MMQ data. This model can now handle proton-heteronuclear SQ, ZQ, DQ, and MQ CPMG-type data. Some debugging might still be required. Modified: branches/relax_disp/specific_analyses/relax_disp/parameters.py branches/relax_disp/specific_analyses/relax_disp/variables.py branches/relax_disp/target_functions/relax_disp.py Modified: branches/relax_disp/specific_analyses/relax_disp/parameters.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/parameters.py?rev=21588&r1=21587&r2=21588&view=diff ============================================================================== --- branches/relax_disp/specific_analyses/relax_disp/parameters.py (original) +++ branches/relax_disp/specific_analyses/relax_disp/parameters.py Thu Nov 21 21:59:57 2013 @@ -34,7 +34,7 @@ from pipe_control import pipes from pipe_control.mol_res_spin import exists_mol_res_spin_data, return_spin from specific_analyses.relax_disp.disp_data import generate_r20_key, has_exponential_exp_type, loop_cluster, loop_exp_frq, return_value_from_frq_index -from specific_analyses.relax_disp.variables import MODEL_M61B, MODEL_MMQ_2SITE +from specific_analyses.relax_disp.variables import MODEL_LIST_MMQ, MODEL_M61B def assemble_param_vector(spins=None, key=None, sim_index=None): @@ -554,7 +554,7 @@ # Chemical exchange difference (dw >= 0). elif param_name in ['dw', 'dwH']: - if not spins[0].model in [MODEL_MMQ_2SITE]: + if not spins[0].model in MODEL_LIST_MMQ: A.append(zero_array * 0.0) A[j][param_index] = 1.0 b.append(0.0) Modified: branches/relax_disp/specific_analyses/relax_disp/variables.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/variables.py?rev=21588&r1=21587&r2=21588&view=diff ============================================================================== --- branches/relax_disp/specific_analyses/relax_disp/variables.py (original) +++ branches/relax_disp/specific_analyses/relax_disp/variables.py Thu Nov 21 21:59:57 2013 @@ -150,7 +150,7 @@ MODEL_LIST_MQ_CPMG_FULL = [MODEL_R2EFF, MODEL_NOREX, MODEL_MQ_CR72, MODEL_MMQ_2SITE] """The list of the R2eff model together with all dispersion models specifically for MQ CPMG-type experiments.""" -MODEL_LIST_MMQ = [MODEL_MMQ_2SITE] +MODEL_LIST_MMQ = [MODEL_MQ_CR72, MODEL_MMQ_2SITE] """The list of all dispersion models specifically for MMQ CPMG-type experiments.""" MODEL_LIST_ANALYTIC = [MODEL_LM63, MODEL_LM63_3SITE, MODEL_CR72, MODEL_CR72_FULL, MODEL_IT99, MODEL_TSMFK01,MODEL_M61, MODEL_M61B, MODEL_DPL94, MODEL_TP02, MODEL_TAP03, MODEL_MP05, MODEL_MQ_CR72] Modified: branches/relax_disp/target_functions/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/target_functions/relax_disp.py?rev=21588&r1=21587&r2=21588&view=diff ============================================================================== --- branches/relax_disp/target_functions/relax_disp.py (original) +++ branches/relax_disp/target_functions/relax_disp.py Thu Nov 21 21:59:57 2013 @@ -1009,29 +1009,48 @@ k_AB = pB * kex # Initialise. - chi2_sum = 0.0 - - # Loop over the spins. - for spin_index in range(self.num_spins): - # Loop over the spectrometer frequencies. - for frq_index in range(self.num_frq): - # The R20 index. - r20_index = frq_index + spin_index*self.num_frq - - # Convert dw from ppm to rad/s. - dw_frq = dw[spin_index] * self.frqs[0][spin_index][frq_index] - dwH_frq = dwH[spin_index] * self.frqs_H[0][spin_index][frq_index] - - # Back calculate the R2eff values. - r2eff_mq_cr72(r20=R20[r20_index], pA=pA, pB=pB, dw=dw_frq, dwH=dwH_frq, kex=kex, k_AB=k_AB, k_BA=k_BA, cpmg_frqs=self.cpmg_frqs[0][frq_index], tcp=self.tau_cpmg[0][frq_index], back_calc=self.back_calc[spin_index][frq_index], num_points=self.num_disp_points[0][frq_index], power=self.power[0][frq_index]) - - # For all missing data points, set the back-calculated value to the measured values so that it has no effect on the chi-squared value. - for point_index in range(self.num_disp_points[0][frq_index]): - if self.missing[spin_index][frq_index][point_index]: - self.back_calc[spin_index][frq_index][point_index] = self.values[spin_index][frq_index][point_index] - - # Calculate and return the chi-squared value. - chi2_sum += chi2(self.values[spin_index][frq_index], self.back_calc[spin_index][frq_index], self.errors[spin_index][frq_index]) + aliased_dwH = 0.0 + chi2_sum = 0.0 + + # Loop over the experiment types. + for exp_index in range(self.num_exp): + # Loop over the spins. + for spin_index in range(self.num_spins): + # Loop over the spectrometer frequencies. + for frq_index in range(self.num_frq): + # The R20 index. + r20_index = frq_index + spin_index*self.num_frq + + # Convert dw from ppm to rad/s. + dw_frq = dw[spin_index] * self.frqs[exp_index][spin_index][frq_index] + dwH_frq = dwH[spin_index] * self.frqs_H[exp_index][spin_index][frq_index] + + # Alias the dw frequency combinations. + if self.exp_types[exp_index] == EXP_TYPE_CPMG_SQ: + aliased_dw = dw_frq + elif self.exp_types[exp_index] == EXP_TYPE_CPMG_PROTON_SQ: + aliased_dw = dwH_frq + elif self.exp_types[exp_index] == EXP_TYPE_CPMG_DQ: + aliased_dw = dwH_frq + dw_frq + elif self.exp_types[exp_index] == EXP_TYPE_CPMG_ZQ: + aliased_dw = dwH_frq - dw_frq + elif self.exp_types[exp_index] == EXP_TYPE_CPMG_MQ: + aliased_dw = dw_frq + aliased_dwH = dwH_frq + elif self.exp_types[exp_index] == EXP_TYPE_CPMG_PROTON_MQ: + aliased_dw = dwH_frq + aliased_dwH = dw_frq + + # Back calculate the R2eff values. + r2eff_mq_cr72(r20=R20[r20_index], pA=pA, pB=pB, dw=aliased_dw, dwH=aliased_dwH, kex=kex, k_AB=k_AB, k_BA=k_BA, cpmg_frqs=self.cpmg_frqs[exp_index][frq_index], tcp=self.tau_cpmg[exp_index][frq_index], back_calc=self.back_calc[exp_index][spin_index][frq_index], num_points=self.num_disp_points[exp_index][frq_index], power=self.power[exp_index][frq_index]) + + # For all missing data points, set the back-calculated value to the measured values so that it has no effect on the chi-squared value. + for point_index in range(self.num_disp_points[exp_index][frq_index]): + if self.missing[exp_index][spin_index][frq_index][point_index]: + self.back_calc[exp_index][spin_index][frq_index][point_index] = self.values[spin_index][frq_index][point_index] + + # Calculate and return the chi-squared value. + chi2_sum += chi2(self.values[exp_index][spin_index][frq_index], self.back_calc[exp_index][spin_index][frq_index], self.errors[exp_index][spin_index][frq_index]) # Return the total chi-squared value. return chi2_sum