1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 """The dasha user function definitions for controlling the Dasha model-free software."""
25
26
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
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
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
70 uf.desc.append(Desc_container())
71 uf.desc[-1].add_paragraph("The script file created is called 'dir/dasha_script'.")
72
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
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
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
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
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