1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """The j_coupling user function definitions."""
24
25
26 from graphics import WIZARD_IMAGE_PATH
27 from pipe_control import pipes, j_coupling
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('j_coupling')
34 uf_class.title = "Class for handling scalar couplings."
35 uf_class.menu_text = "&j_coupling"
36 uf_class.gui_icon = "relax.j_coupling"
37
38
39
40 uf = uf_info.add_uf('j_coupling.copy')
41 uf.title = "Copy J coupling data from one data pipe to another."
42 uf.title_short = "J coupling copying."
43 uf.add_keyarg(
44 name = "pipe_from",
45 basic_types = ["str"],
46 desc_short = "source pipe",
47 desc = "The name of the pipe to copy the J coupling data from.",
48 wiz_element_type = 'combo',
49 wiz_combo_iter = pipes.pipe_names,
50 can_be_none = True
51 )
52 uf.add_keyarg(
53 name = "pipe_to",
54 basic_types = ["str"],
55 desc_short = "destination pipe",
56 desc = "The name of the pipe to copy the J coupling data to.",
57 wiz_element_type = 'combo',
58 wiz_combo_iter = pipes.pipe_names,
59 can_be_none = True
60 )
61
62 uf.desc.append(Desc_container())
63 uf.desc[-1].add_paragraph("This function will copy J coupling data from one pipe to another.")
64
65 uf.desc.append(Desc_container("Prompt examples"))
66 uf.desc[-1].add_paragraph("To copy all J coupling data from pipe 'DMSO' to pipe 'CDCl3', type one of:")
67 uf.desc[-1].add_prompt("relax> j_coupling.copy('DMSO', 'CDCl3')")
68 uf.desc[-1].add_prompt("relax> j_coupling.copy(pipe_from='DMSO', pipe_to='CDCl3')")
69 uf.backend = j_coupling.copy
70 uf.menu_text = "cop&y"
71 uf.gui_icon = "oxygen.actions.list-add"
72 uf.wizard_size = (750, 450)
73 uf.wizard_image = WIZARD_IMAGE_PATH + 'j_coupling.png'
74
75
76
77 uf = uf_info.add_uf('j_coupling.delete')
78 uf.title = "Delete the J coupling values."
79 uf.title_short = "J coupling deletion."
80
81 uf.desc.append(Desc_container())
82 uf.desc[-1].add_paragraph("This will delete all J coupling data in the current data pipe.")
83
84 uf.desc.append(Desc_container("Prompt examples"))
85 uf.desc[-1].add_paragraph("To delete all J coupling data, type:")
86 uf.desc[-1].add_prompt("relax> j_coupling.delete()")
87 uf.backend = j_coupling.delete
88 uf.menu_text = "&delete"
89 uf.gui_icon = "oxygen.actions.list-remove"
90 uf.wizard_size = (750, 450)
91 uf.wizard_image = WIZARD_IMAGE_PATH + 'j_coupling.png'
92
93
94
95 uf = uf_info.add_uf('j_coupling.display')
96 uf.title = "Display the J coupling data in the current data pipe."
97 uf.title_short = "J coupling display."
98 uf.display = True
99
100 uf.desc.append(Desc_container())
101 uf.desc[-1].add_paragraph("This will display all of the J coupling data in the current data pipe.")
102
103 uf.desc.append(Desc_container("Prompt examples"))
104 uf.desc[-1].add_paragraph("To display all J coupling data, type:")
105 uf.desc[-1].add_prompt("relax> j_coupling.display()")
106 uf.backend = j_coupling.display
107 uf.menu_text = "di&splay"
108 uf.gui_icon = "oxygen.actions.document-preview"
109 uf.wizard_size = (750, 450)
110 uf.wizard_image = WIZARD_IMAGE_PATH + 'j_coupling.png'
111
112
113
114 uf = uf_info.add_uf('j_coupling.read')
115 uf.title = "Read the J coupling data from file."
116 uf.title_short = "J coupling data reading."
117 uf.add_keyarg(
118 name = "file",
119 arg_type = "file sel read",
120 desc_short = "file name",
121 desc = "The name of the file containing the J coupling data.",
122 )
123 uf.add_keyarg(
124 name = "dir",
125 arg_type = "dir",
126 desc_short = "directory name",
127 desc = "The directory where the file is located.",
128 can_be_none = True
129 )
130 uf.add_keyarg(
131 name = "spin_id1_col",
132 default = 1,
133 basic_types = ["int"],
134 min = 1,
135 desc_short = "first spin ID column",
136 desc = "The spin ID string column for the first spin."
137 )
138 uf.add_keyarg(
139 name = "spin_id2_col",
140 default = 2,
141 basic_types = ["int"],
142 min = 1,
143 desc_short = "second spin ID column",
144 desc = "The spin ID string column for the second spin."
145 )
146 uf.add_keyarg(
147 name = "data_col",
148 basic_types = ["int"],
149 desc_short = "data column",
150 desc = "The J coupling data column.",
151 can_be_none = True
152 )
153 uf.add_keyarg(
154 name = "error_col",
155 basic_types = ["int"],
156 desc_short = "error column",
157 desc = "The experimental error column.",
158 can_be_none = True
159 )
160 uf.add_keyarg(
161 name = "sign_col",
162 basic_types = ["int"],
163 desc_short = "sign column",
164 desc = "A special column holding the sign of the J coupling, being either 1 or -1, in case this data is obtained separately.",
165 can_be_none = True
166 )
167 uf.add_keyarg(
168 name = "sep",
169 basic_types = ["str"],
170 desc_short = "column separator",
171 desc = "The column separator (the default is white space).",
172 wiz_element_type = "combo",
173 wiz_combo_choices = ["white space", ",", ";", ":"],
174 wiz_combo_data = [None, ",", ";", ":"],
175 wiz_read_only = False,
176 can_be_none = True
177 )
178
179 uf.desc.append(Desc_container())
180 uf.desc[-1].add_paragraph("This will read J coupling data from a file. If the sign of the J coupling has been determined by a different experiment, this information can be present in a different column having either the value of 1 or -1.")
181
182 uf.desc.append(Desc_container("Prompt examples"))
183 uf.desc[-1].add_paragraph("The following commands will read the J coupling data out of the file 'J.txt' where the columns are separated by the symbol ',':")
184 uf.desc[-1].add_prompt("relax> j_coupling.read('J.txt', sep=',')")
185 uf.desc[-1].add_paragraph("If the individual spin J coupling errors are located in the file 'j_err.txt' in column number 5 then, to read these values into relax, type one of:")
186 uf.desc[-1].add_prompt("relax> j_coupling.read('j_err.txt', error_col=5)")
187 uf.desc[-1].add_prompt("relax> j_coupling.read(file='j_err.txt', error_col=5)")
188 uf.backend = j_coupling.read
189 uf.menu_text = "&read"
190 uf.gui_icon = "oxygen.actions.document-open"
191 uf.wizard_height_desc = 300
192 uf.wizard_size = (1000, 750)
193 uf.wizard_image = WIZARD_IMAGE_PATH + 'j_coupling.png'
194
195
196
197 uf = uf_info.add_uf('j_coupling.write')
198 uf.title = "Write the J coupling data to file."
199 uf.title_short = "J coupling writing."
200 uf.add_keyarg(
201 name = "file",
202 arg_type = "file sel write",
203 desc_short = "file name",
204 desc = "The name of the file.",
205 )
206 uf.add_keyarg(
207 name = "dir",
208 arg_type = "dir",
209 desc_short = "directory name",
210 desc = "The directory name.",
211 can_be_none = True
212 )
213 uf.add_keyarg(
214 name = "force",
215 default = False,
216 basic_types = ["bool"],
217 desc_short = "force flag",
218 desc = "A flag which if True will cause the file to be overwritten."
219 )
220
221 uf.desc.append(Desc_container())
222 uf.desc[-1].add_paragraph("This will write the J coupling values to file. If no directory name is given, the file will be placed in the current working directory.")
223 uf.backend = j_coupling.write
224 uf.menu_text = "&write"
225 uf.gui_icon = "oxygen.actions.document-save"
226 uf.wizard_size = (800, 500)
227 uf.wizard_image = WIZARD_IMAGE_PATH + 'j_coupling.png'
228