Author: bugman Date: Mon Jun 3 19:53:30 2013 New Revision: 19851 URL: http://svn.gna.org/viewcvs/relax?rev=19851&view=rev Log: Created the lib.dispersion.equations.calc_two_point_r2eff_err() function. This complements the lib.dispersion.equations.calc_two_point_r2eff() function and is used by the dispersion calculate() method to abstract the mathematics. Modified: branches/relax_disp/lib/dispersion/equations.py branches/relax_disp/specific_analyses/relax_disp/__init__.py Modified: branches/relax_disp/lib/dispersion/equations.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/dispersion/equations.py?rev=19851&r1=19850&r2=19851&view=diff ============================================================================== --- branches/relax_disp/lib/dispersion/equations.py (original) +++ branches/relax_disp/lib/dispersion/equations.py Mon Jun 3 19:53:30 2013 @@ -24,7 +24,7 @@ """The relaxation dispersion equations.""" # Python module imports. -from math import log +from math import log, sqrt def calc_two_point_r2eff(relax_time=None, I_ref=None, I=None): @@ -49,3 +49,31 @@ # Calculate and return the value (avoiding integer division problems). return -1.0 / relax_time * log(float(I) / I_ref) + + +def calc_two_point_r2eff_err(relax_time=None, I_ref=None, I=None, I_ref_err=None, I_err=None): + """Calculate the R2eff/R1rho error for the fixed relaxation time data. + + The formula is: + + -1 / I1 \ + R2eff = ------- * ln | -- | , + relax_T \ I0 / + + where relax_T is the fixed delay time, I0 is the reference peak intensity when relax_T is zero, and I1 is the peak intensity in a spectrum of interest. + + + @keyword relax_time: The fixed relaxation delay time in seconds. + @type relax_time: float + @keyword I_ref: The peak intensity in the reference spectrum. + @type I_ref: float + @keyword I: The peak intensity of interest. + @type I: float + @keyword I_ref_err: The peak intensity error in the reference spectrum. + @type I_ref_err: float + @keyword I_err: The peak intensity error of interest. + @type I_err: float + """ + + # Calculate and return the value (avoiding integer division problems). + return sqrt((ref_intensity_err / ref_intensity)**2 + (intensity_err / intensity)**2) / relax_time Modified: branches/relax_disp/specific_analyses/relax_disp/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/__init__.py?rev=19851&r1=19850&r2=19851&view=diff ============================================================================== --- branches/relax_disp/specific_analyses/relax_disp/__init__.py (original) +++ branches/relax_disp/specific_analyses/relax_disp/__init__.py Mon Jun 3 19:53:30 2013 @@ -33,7 +33,6 @@ # Python module imports. from copy import deepcopy -from math import sqrt from minfx.generic import generic_minimise from minfx.grid import grid from numpy import array, average, dot, float64, identity, log, ones, zeros @@ -973,8 +972,8 @@ # Calculate the R2eff value. spin.r2eff[param_key] = calc_two_point_r2eff(relax_time=time, I_ref=ref_intensity, I=intensity) - # The R2eff error. - spin.r2eff_err[param_key] = sqrt((ref_intensity_err / ref_intensity)**2 + (intensity_err / intensity)**2) / time + # Calculate the R2eff error. + spin.r2eff_err[param_key] = calc_two_point_r2eff_err(relax_time=time, I_ref=ref_intensity, I=intensity, I_ref_err=ref_intensity_err, I_err=intensity_err) def constraint_algorithm(self):