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

Source Code for Module user_functions.fix

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2003-2013 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 fix user function definitions.""" 
24   
25  # relax module imports. 
26  from graphics import WIZARD_IMAGE_PATH 
27  from pipe_control import fix 
28  from user_functions.data import Uf_info; uf_info = Uf_info() 
29  from user_functions.objects import Desc_container 
30   
31   
32  # The fix user function. 
33  uf = uf_info.add_uf('fix') 
34  uf.title = "Fix or allow parameter values to change during optimisation." 
35  uf.title_short = "Fixing of parameters." 
36  uf.display = True 
37  uf.add_keyarg( 
38      name = "element", 
39      py_type = "str", 
40      desc_short = "element", 
41      desc = "Which element to fix.", 
42      wiz_element_type = "combo", 
43      wiz_combo_choices = [ 
44          "Diffusion tensor parameters", 
45          "All parameters from all spins", 
46          "All parameters (diffusion and spin)"], 
47      wiz_combo_data = [ 
48          "diff", 
49          "all_spins", 
50          "all"], 
51      wiz_read_only = True, 
52  ) 
53  uf.add_keyarg( 
54      name = "fixed", 
55      default = True, 
56      py_type = "bool", 
57      desc_short = "fixed", 
58      desc = "A flag specifying if the parameters should be fixed or allowed to change." 
59  ) 
60  # Description. 
61  uf.desc.append(Desc_container()) 
62  uf.desc[-1].add_paragraph("The element can be any of the following:") 
63  uf.desc[-1].add_item_list_element("'diff'", "The diffusion tensor parameters.  This will allow all diffusion tensor parameters to be toggled.") 
64  uf.desc[-1].add_item_list_element("'all_spins'", "Using this keyword, all parameters from all spins will be toggled.") 
65  uf.desc[-1].add_item_list_element("'all'", "All parameters will be toggled.  This is equivalent to combining both 'diff' and 'all_spins'.") 
66  uf.desc[-1].add_paragraph("The flag 'fixed', if set to True, will fix parameters during optimisation whereas a value of False will allow parameters to vary.") 
67  uf.backend = fix.fix 
68  uf.menu_text = "&fix" 
69  uf.gui_icon = "oxygen.status.object-locked" 
70  uf.wizard_height_desc = 400 
71  uf.wizard_size = (800, 600) 
72  uf.wizard_apply_button = False 
73  uf.wizard_image = WIZARD_IMAGE_PATH + 'object-locked-unlocked.png' 
74