Package prompt :: Module relax_fit
[hide private]
[frames] | no frames]

Source Code for Module prompt.relax_fit

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2004-2011 Edward d'Auvergne                                   # 
 4  #                                                                             # 
 5  # This file is part of the program relax.                                     # 
 6  #                                                                             # 
 7  # relax 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 2 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # relax 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 relax; if not, write to the Free Software                        # 
19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
20  #                                                                             # 
21  ############################################################################### 
22   
23  # Module docstring. 
24  """Module containing the 'relax_fit' user function class.""" 
25  __docformat__ = 'plaintext' 
26   
27  # relax module imports. 
28  from base_class import User_fn_class, _build_doc 
29  import arg_check 
30  from specific_fns.setup import relax_fit_obj 
31   
32   
33 -class Relax_fit(User_fn_class):
34 """Class for relaxation curve fitting.""" 35
36 - def relax_time(self, time=0.0, spectrum_id=None):
37 # Function intro text. 38 if self._exec_info.intro: 39 text = self._exec_info.ps3 + "relax_fit.relax_time(" 40 text = text + "time=" + repr(time) 41 text = text + ", spectrum_id=" + repr(spectrum_id) + ")" 42 print(text) 43 44 # The argument checks. 45 arg_check.is_num(time, 'relaxation time') 46 arg_check.is_str(spectrum_id, 'spectrum identification string') 47 48 # Execute the functional code. 49 relax_fit_obj._relax_time(time=time, spectrum_id=spectrum_id)
50 51 # The function doc info. 52 relax_time._doc_title = "Set the relaxation delay time associated with each spectrum." 53 relax_time._doc_title_short = "Relaxation delay time setting." 54 relax_time._doc_args = [ 55 ["time", "The time, in seconds, of the relaxation period."], 56 ["spectrum_id", "The spectrum identification string."] 57 ] 58 relax_time._doc_desc = """ 59 Peak intensities should be loaded before calling this user function via the spectrum.read_intensities user function. The intensity values will then be associated with a spectrum identifier. To associate each spectrum identifier with a time point in the relaxation curve prior to optimisation, this user function should be called. 60 """ 61 _build_doc(relax_time) 62 63
64 - def select_model(self, model='exp'):
65 # Function intro text. 66 if self._exec_info.intro: 67 text = self._exec_info.ps3 + "relax_fit.select_model(" 68 text = text + "model=" + repr(model) + ")" 69 print(text) 70 71 # The argument checks. 72 arg_check.is_str(model, 'model') 73 74 # Execute the functional code. 75 relax_fit_obj._select_model(model=model)
76 77 # The function doc info. 78 select_model._doc_title = "Select the relaxation curve type." 79 select_model._doc_title_short = "Relaxation curve type selection." 80 select_model._doc_args = [ 81 ["model", "The type of relaxation curve to fit."] 82 ] 83 select_model._doc_desc = """ 84 The supported relaxation experiments include the default two parameter exponential fit, selected by setting the 'fit_type' argument to 'exp', and the three parameter inversion recovery experiment in which the peak intensity limit is a non-zero value, selected by setting the argument to 'inv'. 85 86 The parameters of these two models are 87 'exp': [Rx, I0], 88 'inv': [Rx, I0, Iinf]. 89 """ 90 _build_doc(select_model)
91