1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """The dx user function definitions for controlling the OpenDX visualisation software."""
24
25
26 from generic_fns import diffusion_tensor
27 from graphics import WIZARD_IMAGE_PATH
28 import opendx.main
29 from prompt.doc_string import regexp_doc
30 from specific_fns.model_free import Model_free
31 from user_functions.data import Uf_info; uf_info = Uf_info()
32 from user_functions.data import Uf_tables; uf_tables = Uf_tables()
33 from user_functions.objects import Desc_container
34
35
36
37 uf_class = uf_info.add_class("dx")
38 uf_class.title = "Class for interfacing with OpenDX."
39 uf_class.menu_text = "&dx"
40 uf_class.gui_icon = "relax.opendx"
41
42
43
44 uf = uf_info.add_uf("dx.execute")
45 uf.title = "Execute an OpenDX program."
46 uf.title_short = "OpenDX execution."
47 uf.add_keyarg(
48 name = "file_prefix",
49 default = "map",
50 py_type = "str",
51 desc_short = "file name",
52 desc = "The file name prefix. For example if file is set to 'temp', then the OpenDX program temp.net will be loaded."
53 )
54 uf.add_keyarg(
55 name = "dir",
56 default = "dx",
57 py_type = "str",
58 arg_type = "dir sel",
59 desc_short = "directory name",
60 desc = "The directory to change to for running OpenDX. If this is set to None, OpenDX will be run in the current directory.",
61 can_be_none = True
62 )
63 uf.add_keyarg(
64 name = "dx_exe",
65 default = "dx",
66 py_type = "str",
67 desc_short = "OpenDX executable file name",
68 desc = "The OpenDX executable file."
69 )
70 uf.add_keyarg(
71 name = "vp_exec",
72 default = True,
73 py_type = "bool",
74 desc_short = "visual program execution flag",
75 desc = "A flag specifying whether to execute the visual program automatically at start-up. The default of True causes the program to be executed."
76 )
77
78 uf.desc.append(Desc_container())
79 uf.desc[-1].add_paragraph("This will execute OpenDX to display the space maps created previously by the dx.map user function. This will work for any type of OpenDX map.")
80 uf.backend = opendx.main.run
81 uf.menu_text = "&execute"
82 uf.gui_icon = "oxygen.categories.applications-education"
83 uf.wizard_size = (700, 500)
84 uf.wizard_apply_button = False
85 uf.wizard_image = WIZARD_IMAGE_PATH + 'opendx.png'
86
87
88
89 uf = uf_info.add_uf("dx.map")
90 uf.title = "Create a map of the given space in OpenDX format."
91 uf.title_short = "OpenDX map creation."
92 uf.display = True
93 uf.add_keyarg(
94 name = "params",
95 py_type = "str_list",
96 desc_short = "parameters",
97 desc = "The parameters to be mapped. This should be an array of strings, the meanings of which are described below."
98 )
99 uf.add_keyarg(
100 name = "map_type",
101 default = "Iso3D",
102 py_type = "str",
103 desc_short = "map type",
104 desc = "The type of map to create. For example the default, a 3D isosurface, the type is 'Iso3D'. See below for more details.",
105 wiz_element_type = "combo",
106 wiz_combo_choices = ["Iso3D"],
107 wiz_read_only = True,
108 )
109 uf.add_keyarg(
110 name = "spin_id",
111 py_type = "str",
112 desc_short = "spin ID string",
113 desc = "The spin ID string.",
114 can_be_none = True
115 )
116 uf.add_keyarg(
117 name = "inc",
118 default = 20,
119 py_type = "int",
120 desc_short = "number of increments",
121 desc = "The number of increments to map in each dimension. This value controls the resolution of the map.",
122 wiz_element_type = "spin"
123 )
124 uf.add_keyarg(
125 name = "lower",
126 py_type = "num_list",
127 desc_short = "lower bounds",
128 desc = "The lower bounds of the space. If you wish to change the lower bounds of the map then supply an array of length equal to the number of parameters in the model. A lower bound for each parameter must be supplied. If nothing is supplied then the defaults will be used.",
129 can_be_none = True
130 )
131 uf.add_keyarg(
132 name = "upper",
133 py_type = "num_list",
134 desc_short = "upper bounds",
135 desc = "The upper bounds of the space. If you wish to change the upper bounds of the map then supply an array of length equal to the number of parameters in the model. A upper bound for each parameter must be supplied. If nothing is supplied then the defaults will be used.",
136 can_be_none = True
137 )
138 uf.add_keyarg(
139 name = "axis_incs",
140 default = 5,
141 py_type = "int",
142 desc_short = "axis increments",
143 desc = "The number of increments or ticks displaying parameter values along the axes of the OpenDX plot.",
144 wiz_element_type = "spin"
145 )
146 uf.add_keyarg(
147 name = "file_prefix",
148 default = "map",
149 py_type = "str",
150 desc_short = "file prefix",
151 desc = "The file name. All the output files are prefixed with this name. The main file containing the data points will be called the value of 'file'. The OpenDX program will be called 'file.net' and the OpenDX import file will be called 'file.general'."
152 )
153 uf.add_keyarg(
154 name = "dir",
155 default = "dx",
156 py_type = "str",
157 arg_type = "dir sel",
158 desc_short = "directory name",
159 desc = "The directory to output files to. Set this to 'None' if you do not want the files to be placed in subdirectory. If the directory does not exist, it will be created.",
160 can_be_none = True
161 )
162 uf.add_keyarg(
163 name = "point",
164 py_type = "num_list",
165 desc_short = "point",
166 desc = "An array of parameter values where a point in the map, shown as a red sphere, will be placed. The length must be equal to the number of parameters.",
167 can_be_none = True
168 )
169 uf.add_keyarg(
170 name = "point_file",
171 default = "point",
172 py_type = "str",
173 desc_short = "point file name prefix",
174 desc = "The name of that the point output files will be prefixed with.",
175 can_be_none = True
176 )
177 uf.add_keyarg(
178 name = "remap",
179 py_type = "func",
180 arg_type = "func",
181 desc_short = "remap function",
182 desc = "A user supplied remapping function. This function will receive the parameter array and must return an array of equal length.",
183 can_be_none = True
184 )
185
186 uf.desc.append(Desc_container())
187 uf.desc[-1].add_paragraph("This will map the space corresponding to the spin identifier and create the OpenDX files. The map type can be changed to one of the following supported map types:")
188 table = uf_tables.add_table(label="table: opendx map", caption="OpenDx mapping types.")
189 table.add_headings(["Surface type", "Name"])
190 table.add_row(["3D isosurface", "'Iso3D'"])
191 uf.desc[-1].add_table(table.label)
192
193 uf.desc.append(regexp_doc)
194 uf.desc.append(diffusion_tensor.__return_data_name_doc__)
195 uf.desc.append(Model_free.return_data_name_doc)
196
197 uf.desc.append(Desc_container("Prompt examples"))
198 uf.desc[-1].add_paragraph("The following commands will generate a map of the extended model-free space for model 'm5' consisting of the parameters {S2, S2f, ts}. Files will be output into the directory 'dx' and will be prefixed by 'map'. In this case, the system is a protein and residue number 6 will be mapped.")
199 uf.desc[-1].add_prompt("relax> dx.map(['s2', 's2f', 'ts'], spin_id=':6')")
200 uf.desc[-1].add_prompt("relax> dx.map(['s2', 's2f', 'ts'], spin_id=':6', file_prefix='map', dir='dx')")
201 uf.desc[-1].add_prompt("relax> dx.map(params=['s2', 's2f', 'ts'], spin_id=':6', inc=20, file_prefix='map', dir='dx')")
202 uf.desc[-1].add_prompt("relax> dx.map(params=['s2', 's2f', 'ts'], spin_id=':6', map_type='Iso3D', inc=20, file_prefix='map', dir='dx')")
203 uf.desc[-1].add_paragraph("To map the model-free space 'm4' for residue 2, spin N6 defined by the parameters {S2, te, Rex}, name the results 'test', and to place the files in the current directory, use one of the following commands:")
204 uf.desc[-1].add_prompt("relax> dx.map(['s2', 'te', 'rex'], spin_id=':2@N6', file_prefix='test', dir=None)")
205 uf.desc[-1].add_prompt("relax> dx.map(params=['s2', 'te', 'rex'], spin_id=':2@N6', inc=100, file_prefix='test', dir=None)")
206 uf.backend = opendx.main.map
207 uf.menu_text = "&map"
208 uf.gui_icon = "relax.grid_search"
209 uf.wizard_height_desc = 280
210 uf.wizard_size = (1000, 750)
211 uf.wizard_image = WIZARD_IMAGE_PATH + 'opendx.png'
212