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

Source Code for Module user_functions.dasha

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