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