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

Source Code for Module user_functions.relax_fit

  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 relax_fit user function definitions.""" 
 24   
 25  # relax module imports. 
 26  from pipe_control import spectrum 
 27  from specific_analyses.relax_fit.uf import relax_time, select_model 
 28  from user_functions.data import Uf_info; uf_info = Uf_info() 
 29  from user_functions.objects import Desc_container 
 30   
 31   
 32  # The user function class. 
 33  uf_class = uf_info.add_class('relax_fit') 
 34  uf_class.title = "Class for relaxation curve fitting." 
 35  uf_class.menu_text = "&relax_fit" 
 36  uf_class.gui_icon = "relax.relax_fit" 
 37   
 38   
 39  # The relax_fit.relax_time user function. 
 40  uf = uf_info.add_uf('relax_fit.relax_time') 
 41  uf.title = "Set the relaxation delay time associated with each spectrum." 
 42  uf.title_short = "Relaxation delay time setting." 
 43  uf.add_keyarg( 
 44      name = "time", 
 45      default = 0.0, 
 46      py_type = "num", 
 47      desc_short = "relaxation time", 
 48      desc = "The time, in seconds, of the relaxation period." 
 49  ) 
 50  uf.add_keyarg( 
 51      name = "spectrum_id", 
 52      py_type = "str", 
 53      desc_short = "spectrum identification string", 
 54      desc = "The spectrum identification string.", 
 55      wiz_element_type = 'combo', 
 56      wiz_combo_iter = spectrum.get_ids, 
 57      wiz_read_only = True 
 58  ) 
 59  # Description. 
 60  uf.desc.append(Desc_container()) 
 61  uf.desc[-1].add_paragraph("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.") 
 62  uf.backend = relax_time 
 63  uf.menu_text = "&relax_time" 
 64  uf.gui_icon = "oxygen.actions.chronometer" 
 65  uf.wizard_size = (700, 500) 
 66   
 67   
 68  # The relax_fit.select_model user function. 
 69  uf = uf_info.add_uf('relax_fit.select_model') 
 70  uf.title = "Select the relaxation curve type." 
 71  uf.title_short = "Relaxation curve type selection." 
 72  uf.display = True 
 73  uf.add_keyarg( 
 74      name = "model", 
 75      default = "exp", 
 76      py_type = "str", 
 77      desc_short = "model", 
 78      desc = "The type of relaxation curve to fit.", 
 79      wiz_element_type = "combo", 
 80      wiz_combo_choices = [ 
 81          "exp: [Rx, I0]", 
 82          "inv: [Rx, I0, Iinf]" 
 83      ], 
 84      wiz_combo_data = [ 
 85          "exp", 
 86          "inv" 
 87      ], 
 88      wiz_read_only = True 
 89  ) 
 90  # Description. 
 91  uf.desc.append(Desc_container()) 
 92  uf.desc[-1].add_paragraph("The supported relaxation experiments include the default two parameter exponential fit, selected by setting the model type to 'exp', and the three parameter inversion recovery experiment in which the peak intensity limit is a non-zero value, selected by setting the model to 'inv'.") 
 93  uf.desc[-1].add_paragraph("The parameters of these two models are") 
 94  uf.desc[-1].add_item_list_element("'exp'", "[Rx, I0],") 
 95  uf.desc[-1].add_item_list_element("'inv'", "[Rx, I0, Iinf].") 
 96  uf.backend = select_model 
 97  uf.menu_text = "&select_model" 
 98  uf.gui_icon = "oxygen.actions.list-add" 
 99  uf.wizard_height_desc = 300 
100  uf.wizard_size = (800, 500) 
101  uf.wizard_apply_button = False 
102