Package user_functions :: Module error_analysis
[hide private]
[frames] | no frames]

Source Code for Module user_functions.error_analysis

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2004-2014 Edward d'Auvergne                                   # 
 4  #                                                                             # 
 5  # This file is part of the program relax (http://www.nmr-relax.com).          # 
 6  #                                                                             # 
 7  # This program is free software: you can redistribute it and/or modify        # 
 8  # it under the terms of the GNU General Public License as published by        # 
 9  # the Free Software Foundation, either version 3 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # This program is distributed in the hope that it will be useful,             # 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
15  # GNU General Public License for more details.                                # 
16  #                                                                             # 
17  # You should have received a copy of the GNU General Public License           # 
18  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
19  #                                                                             # 
20  ############################################################################### 
21   
22  # Module docstring. 
23  """The error_analysis user function definitions.""" 
24   
25  # Python module imports. 
26  from os import sep 
27   
28  # relax module imports. 
29  from graphics import ANALYSIS_IMAGE_PATH 
30  from pipe_control.error_analysis import covariance_matrix 
31  from user_functions.data import Uf_info; uf_info = Uf_info() 
32  from user_functions.objects import Desc_container 
33   
34   
35  # The user function class. 
36  uf_class = uf_info.add_class('error_analysis') 
37  uf_class.title = "Class for relaxation curve fitting." 
38  uf_class.menu_text = "&error_analysis" 
39   
40   
41  # The error_analysis.covariance_matrix user function. 
42  uf = uf_info.add_uf('error_analysis.covariance_matrix') 
43  uf.title = "Parameter error estimation via the covariance matrix." 
44  uf.title_short = "Covariance matrix parameter error estimation." 
45  uf.add_keyarg( 
46      name = "epsrel", 
47      py_type = "float", 
48      default = 0.0, 
49      desc_short = "parameter to remove linear-dependent columns.", 
50      desc = "The parameter to remove linear-dependent columns when J is rank deficient.", 
51      can_be_none = False 
52  ) 
53  uf.add_keyarg( 
54      name = "verbosity", 
55      default = 1, 
56      py_type = "int", 
57      desc_short = "amount of information to print.", 
58      desc = "The higher the value, the greater the verbosity.", 
59      can_be_none = False 
60  ) 
61  # Description. 
62  uf.desc.append(Desc_container()) 
63  uf.desc[-1].add_paragraph("This is a new experimental feature from version 3.3.") 
64  uf.desc[-1].add_paragraph("This will estimate parameter errors by using the exponential decay Jacobian matrix 'J' to compute the covariance matrix of the best-fit parameters.") 
65  uf.desc[-1].add_paragraph("This can be used to for comparison to Monte-Carlo simulations.") 
66  uf.desc[-1].add_paragraph("This method is inspired from the GNU Scientific Library (GSL).") 
67  uf.desc[-1].add_paragraph("The covariance matrix is given by: covar = Qxx = (J^T.W.J)^-1, where the weight matrix W is constructed by the multiplication of an Identity matrix I and a weight array w.  The weight array is 1/errors^2, which then gives W = I.w = I x 1/errors^2.") 
68  uf.desc[-1].add_paragraph("Qxx is computed by QR decomposition, J^T.W.J=QR, Qxx=R^-1. Q^T.  The columns of R which satisfy: |R_{kk}| <= epsrel |R_{11}| are considered linearly-dependent and are excluded from the covariance matrix (the corresponding rows and columns of the covariance matrix are set to zero).") 
69  uf.desc[-1].add_paragraph("The parameter 'epsrel' is used to remove linear-dependent columns when J is rank deficient.") 
70  uf.backend = covariance_matrix 
71  uf.menu_text = "&covariance_matrix" 
72  uf.wizard_size = (800, 800) 
73  uf.wizard_image = ANALYSIS_IMAGE_PATH + sep + 'blank_150x150.png' 
74