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 pipe_control import dasha
28 from user_functions.data import Uf_info; uf_info = Uf_info()
29 from user_functions.objects import Desc_container
30
31
32
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
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 basic_types = ["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 arg_type = "dir sel",
56 desc_short = "directory name",
57 desc = "The directory to place the files.",
58 can_be_none = True
59 )
60 uf.add_keyarg(
61 name = "force",
62 default = False,
63 basic_types = ["bool"],
64 desc_short = "force flag",
65 desc = "A flag which if set to True will cause the results file to be overwritten if it already exists."
66 )
67
68 uf.desc.append(Desc_container())
69 uf.desc[-1].add_paragraph("The script file created is called 'dir/dasha_script'.")
70
71 uf.desc.append(Desc_container("Optimisation algorithms"))
72 uf.desc[-1].add_paragraph("The two minimisation algorithms within Dasha are accessible through the algorithm which can be set to:")
73 uf.desc[-1].add_item_list_element("'LM'", "The Levenberg-Marquardt algorithm,")
74 uf.desc[-1].add_item_list_element("'NR'", "Newton-Raphson algorithm.")
75 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.")
76 uf.backend = dasha.create
77 uf.menu_text = "&create"
78 uf.gui_icon = "oxygen.actions.list-add-relax-blue"
79 uf.wizard_height_desc = 400
80 uf.wizard_size = (800, 700)
81 uf.wizard_apply_button = False
82
83
84
85 uf = uf_info.add_uf('dasha.execute')
86 uf.title = "Perform a model-free optimisation using Dasha."
87 uf.title_short = "Dasha execution."
88 uf.add_keyarg(
89 name = "dir",
90 arg_type = "dir sel",
91 desc_short = "directory name",
92 desc = "The directory to place the files.",
93 can_be_none = True
94 )
95 uf.add_keyarg(
96 name = "force",
97 default = False,
98 basic_types = ["bool"],
99 desc_short = "force flag",
100 desc = "A flag which if set to True will cause the results file to be overwritten if it already exists."
101 )
102 uf.add_keyarg(
103 name = "binary",
104 default = "dasha",
105 arg_type = "file sel read",
106 desc_short = "Dasha executable file",
107 desc = "The name of the executable Dasha program file.",
108 wiz_filesel_preview = False
109 )
110
111 uf.desc.append(Desc_container())
112 uf.desc[-1].add_paragraph("Dasha will be executed as")
113 uf.desc[-1].add_prompt("$ dasha < dasha_script | tee dasha_results")
114 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.")
115 uf.backend = dasha.execute
116 uf.gui_icon = "oxygen.categories.applications-education"
117 uf.menu_text = "&execute"
118 uf.wizard_size = (700, 500)
119 uf.wizard_apply_button = False
120
121
122
123 uf = uf_info.add_uf('dasha.extract')
124 uf.title = "Extract data from the Dasha results file."
125 uf.title_short = "Dasha data extraction."
126 uf.add_keyarg(
127 name = "dir",
128 arg_type = "dir sel",
129 desc_short = "directory name",
130 desc = "The directory where the file 'dasha_results' is found.",
131 can_be_none = True
132 )
133
134 uf.desc.append(Desc_container())
135 uf.desc[-1].add_paragraph("The model-free results will be extracted from the Dasha results file 'dasha_results' located in the given directory.")
136 uf.backend = dasha.extract
137 uf.menu_text = "ex&tract"
138 uf.gui_icon = "oxygen.actions.archive-extract"
139 uf.wizard_apply_button = False
140