1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """The dasha user function definitions for controlling the Dasha model-free software."""
24
25
26 import dep_check
27 if dep_check.wx_module:
28 from wx import FD_OPEN
29 else:
30 FD_OPEN = -1
31
32
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
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
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
75 uf.desc.append(Desc_container())
76 uf.desc[-1].add_paragraph("The script file created is called 'dir/dasha_script'.")
77
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
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
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
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
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