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