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

Source Code for Module user_functions.dasha

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2005-2012 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 dasha user function definitions for controlling the Dasha model-free software.""" 
 24   
 25  # relax module imports. 
 26  from generic_fns import dasha 
 27  from graphics import WIZARD_IMAGE_PATH 
 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('dasha') 
 34  uf_class.title = "Class for interfacing with the program Dasha." 
 35  uf_class.menu_text = "&dasha" 
 36   
 37   
 38  # The dasha.create user function. 
 39  uf = uf_info.add_uf('dasha.create') 
 40  uf.title = "Create the Dasha script." 
 41  uf.title_short = "Script creation." 
 42  uf.add_keyarg( 
 43      name = "algor", 
 44      default = "LM", 
 45      py_type = "str", 
 46      desc_short = "optimisation algorithm", 
 47      desc = "The minimisation algorithm.", 
 48      wiz_element_type = "combo", 
 49      wiz_combo_choices = ["Levenberg-Marquardt", "Newton-Raphson"], 
 50      wiz_combo_data = ["LM", "NR"], 
 51      wiz_read_only = True 
 52  ) 
 53  uf.add_keyarg( 
 54      name = "dir", 
 55      py_type = "str", 
 56      arg_type = "dir sel", 
 57      desc_short = "directory name", 
 58      desc = "The directory to place the files.", 
 59      can_be_none = True 
 60  ) 
 61  uf.add_keyarg( 
 62      name = "force", 
 63      default = False, 
 64      py_type = "bool", 
 65      desc_short = "force flag", 
 66      desc = "A flag which if set to True will cause the results file to be overwritten if it already exists." 
 67  ) 
 68  # Description. 
 69  uf.desc.append(Desc_container()) 
 70  uf.desc[-1].add_paragraph("The script file created is called 'dir/dasha_script'.") 
 71  # Optimisation algorithms. 
 72  uf.desc.append(Desc_container("Optimisation algorithms")) 
 73  uf.desc[-1].add_paragraph("The two minimisation algorithms within Dasha are accessible through the algorithm which can be set to:") 
 74  uf.desc[-1].add_item_list_element("'LM'", "The Levenberg-Marquardt algorithm,") 
 75  uf.desc[-1].add_item_list_element("'NR'", "Newton-Raphson algorithm.") 
 76  uf.desc[-1].add_paragraph("For Levenberg-Marquardt minimisation, the function 'lmin' will be called, while for Newton-Raphson, the function 'min' will be executed.") 
 77  uf.backend = dasha.create 
 78  uf.menu_text = "&create" 
 79  uf.gui_icon = "oxygen.actions.list-add-relax-blue" 
 80  uf.wizard_height_desc = 400 
 81  uf.wizard_size = (800, 700) 
 82  uf.wizard_apply_button = False 
 83   
 84   
 85  # The dasha.execute user function. 
 86  uf = uf_info.add_uf('dasha.execute') 
 87  uf.title = "Perform a model-free optimisation using Dasha." 
 88  uf.title_short = "Dasha execution." 
 89  uf.add_keyarg( 
 90      name = "dir", 
 91      py_type = "str", 
 92      arg_type = "dir sel", 
 93      desc_short = "directory name", 
 94      desc = "The directory to place the files.", 
 95      can_be_none = True 
 96  ) 
 97  uf.add_keyarg( 
 98      name = "force", 
 99      default = False, 
100      py_type = "bool", 
101      desc_short = "force flag", 
102      desc = "A flag which if set to True will cause the results file to be overwritten if it already exists." 
103  ) 
104  uf.add_keyarg( 
105      name = "binary", 
106      default = "dasha", 
107      py_type = "str", 
108      desc_short = "Dasha executable file", 
109      desc = "The name of the executable Dasha program file." 
110  ) 
111  # Description. 
112  uf.desc.append(Desc_container()) 
113  uf.desc[-1].add_paragraph("Dasha will be executed as") 
114  uf.desc[-1].add_prompt("$ dasha < dasha_script | tee dasha_results") 
115  uf.desc[-1].add_paragraph("If you would like to use a different Dasha executable file, change the binary name to the appropriate file name.  If the file is not located within the environment's path, include the full path in front of the binary file name.") 
116  uf.backend = dasha.execute 
117  uf.gui_icon = "oxygen.categories.applications-education" 
118  uf.menu_text = "&execute" 
119  uf.wizard_size = (700, 500) 
120  uf.wizard_apply_button = False 
121   
122   
123  # The dasha.extract user function. 
124  uf = uf_info.add_uf('dasha.extract') 
125  uf.title = "Extract data from the Dasha results file." 
126  uf.title_short = "Dasha data extraction." 
127  uf.add_keyarg( 
128      name = "dir", 
129      py_type = "str", 
130      arg_type = "dir sel", 
131      desc_short = "directory name", 
132      desc = "The directory where the file 'dasha_results' is found.", 
133      can_be_none = True 
134  ) 
135  # Description. 
136  uf.desc.append(Desc_container()) 
137  uf.desc[-1].add_paragraph("The model-free results will be extracted from the Dasha results file 'dasha_results' located in the given directory.") 
138  uf.backend = dasha.extract 
139  uf.menu_text = "ex&tract" 
140  uf.gui_icon = "oxygen.actions.archive-extract" 
141  uf.wizard_apply_button = False 
142