Author: bugman Date: Tue Aug 20 23:15:37 2013 New Revision: 20653 URL: http://svn.gna.org/viewcvs/relax?rev=20653&view=rev Log: Fix for converting dw from ppm to rad/s. Progress sr #3071: https://gna.org/support/index.php?3071 - Implementation of Tollinger/Kay dispersion model (2001) Following the guide at: http://wiki.nmr-relax.com/Tutorial_for_adding_relaxation_dispersion_models_to_relax Troels E. Linnet provided this patch. Commit by: tlinnet _aaattt_ gmail_dot_com Signed-off-by: Edward d'Auvergne <edward@xxxxxxxxxxxxx> Modified: branches/relax_disp/target_functions/relax_disp.py 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=20653&r1=20652&r2=20653&view=diff ============================================================================== --- branches/relax_disp/target_functions/relax_disp.py (original) +++ branches/relax_disp/target_functions/relax_disp.py Tue Aug 20 23:15:37 2013 @@ -990,16 +990,19 @@ # The R20 index. r20a_index = frq_index + spin_index*self.num_frq + # Convert dw from ppm to rad/s. + dw_frq = dw[spin_index] * self.frqs[spin_index, frq_index] + # Back calculate the R2eff values. - r2eff_TSMFK01(r20a=R20A[r20a_index], dw=phi_ex_scaled, kA=kA, cpmg_frqs=self.cpmg_frqs, back_calc=self.back_calc[spin_index, frq_index], num_points=self.num_disp_points) - - # 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): - 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]) - - # Return the total chi-squared value. - return chi2_sum + r2eff_TSMFK01(r20a=R20A[r20a_index], dw=dw_frq, kA=kA, cpmg_frqs=self.cpmg_frqs, back_calc=self.back_calc[spin_index, frq_index], num_points=self.num_disp_points) + + # 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): + 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]) + + # Return the total chi-squared value. + return chi2_sum