Package lib :: Package dispersion :: Module two_point
[hide private]
[frames] | no frames]

Source Code for Module lib.dispersion.two_point

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2009 Sebastien Morin                                          # 
 4  # Copyright (C) 2013 Edward d'Auvergne                                        # 
 5  #                                                                             # 
 6  # This file is part of the program relax (http://www.nmr-relax.com).          # 
 7  #                                                                             # 
 8  # This program is free software: you can redistribute it and/or modify        # 
 9  # it under the terms of the GNU General Public License as published by        # 
10  # the Free Software Foundation, either version 3 of the License, or           # 
11  # (at your option) any later version.                                         # 
12  #                                                                             # 
13  # This program is distributed in the hope that it will be useful,             # 
14  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
16  # GNU General Public License for more details.                                # 
17  #                                                                             # 
18  # You should have received a copy of the GNU General Public License           # 
19  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
20  #                                                                             # 
21  ############################################################################### 
22   
23  # Module docstring. 
24  """The relaxation dispersion equations.""" 
25   
26  # Python module imports. 
27  from math import log, sqrt 
28   
29   
30 -def calc_two_point_r2eff(relax_time=None, I_ref=None, I=None):
31 """Calculate the R2eff/R1rho value for the fixed relaxation time data. 32 33 The formula is:: 34 35 -1 / I1 \ 36 R2eff = ------- * ln | -- | , 37 relax_T \ I0 / 38 39 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. 40 41 42 @keyword relax_time: The fixed relaxation delay time in seconds. 43 @type relax_time: float 44 @keyword I_ref: The peak intensity in the reference spectrum. 45 @type I_ref: float 46 @keyword I: The peak intensity of interest. 47 @type I: float 48 """ 49 50 # Calculate and return the value (avoiding integer division problems). 51 return -1.0 / relax_time * log(float(I) / I_ref)
52 53
54 -def calc_two_point_r2eff_err(relax_time=None, I_ref=None, I=None, I_ref_err=None, I_err=None):
55 """Calculate the R2eff/R1rho error for the fixed relaxation time data. 56 57 The formula is:: 58 59 __________________________________ 60 1 / / sigma_I1 \ 2 / sigma_I0 \ 2 61 sigma_R2 = ------- / | -------- | + | -------- | 62 relax_T \/ \ I1(nu1) / \ I0 / 63 64 where relax_T is the fixed delay time, I0 and sigma_I0 are the reference peak intensity and error when relax_T is zero, and I1 and sigma_I1 are the peak intensity and error in the spectrum of interest. 65 66 67 @keyword relax_time: The fixed relaxation delay time in seconds. 68 @type relax_time: float 69 @keyword I_ref: The peak intensity in the reference spectrum. 70 @type I_ref: float 71 @keyword I: The peak intensity of interest. 72 @type I: float 73 @keyword I_ref_err: The peak intensity error in the reference spectrum. 74 @type I_ref_err: float 75 @keyword I_err: The peak intensity error of interest. 76 @type I_err: float 77 """ 78 79 # Calculate and return the value (avoiding integer division problems). 80 return sqrt((I_ref_err / I_ref)**2 + (I_err / I)**2) / relax_time
81