1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 import sys
24
25 import help
26
27
30
31 self.__relax_help__ = \
32 """Class for manipulating R1, R2, and NOE relaxation data."""
33
34
35 self.__relax_help__ = self.__relax_help__ + "\n" + help.relax_class_help
36
37
38 self.__relax__ = relax
39
40
41 - def back_calc(self, run=None, ri_label=None, frq_label=None, frq=None):
42 """Function for back calculating relaxation data.
43
44 Keyword Arguments
45 ~~~~~~~~~~~~~~~~~
46
47 run: The name of the run.
48
49 ri_label: The relaxation data type, ie 'R1', 'R2', or 'NOE'.
50
51 frq_label: The field strength label.
52
53 frq: The spectrometer frequency in Hz.
54
55 """
56
57
58 if self.__relax__.interpreter.intro:
59 text = sys.ps3 + "relax_data.back_calc("
60 text = text + "run=" + `run`
61 text = text + ", ri_label=" + `ri_label`
62 text = text + ", frq_label=" + `frq_label`
63 text = text + ", frq=" + `frq` + ")"
64 print text
65
66
67 if type(run) != str:
68 raise RelaxStrError, ('run', run)
69
70
71 if type(ri_label) != str:
72 raise RelaxStrError, ('relaxation label', ri_label)
73
74
75 if type(frq_label) != str:
76 raise RelaxStrError, ('frequency label', frq_label)
77
78
79 if type(frq) != float:
80 raise RelaxFloatError, ('frequency', frq)
81
82
83 self.__relax__.specific.relax_data.back_calc(run=run, ri_label=ri_label, frq_label=frq_label, frq=frq)
84
85
86 - def copy(self, run1=None, run2=None, ri_label=None, frq_label=None):
87 """Function for copying relaxation data from run1 to run2.
88
89 Keyword Arguments
90 ~~~~~~~~~~~~~~~~~
91
92 run1: The name of the run to copy the sequence from.
93
94 run2: The name of the run to copy the sequence to.
95
96 ri_label: The relaxation data type, ie 'R1', 'R2', or 'NOE'.
97
98 frq_label: The field strength label.
99
100
101 Description
102 ~~~~~~~~~~~
103
104 This function will copy relaxation data from 'run1' to 'run2'. If ri_label and frq_label
105 are not given then all relaxation data will be copied, otherwise only a specific data set
106 will be copied.
107
108
109 Examples
110 ~~~~~~~~
111
112 To copy all relaxation data from run 'm1' to run 'm9', type one of:
113
114 relax> relax_data.copy('m1', 'm9')
115 relax> relax_data.copy(run1='m1', run2='m9')
116 relax> relax_data.copy('m1', 'm9', None, None)
117 relax> relax_data.copy(run1='m1', run2='m9', ri_label=None, frq_label=None)
118
119 To copy only the NOE relaxation data with the frq_label of '800' from 'm3' to 'm6', type one
120 of:
121
122 relax> relax_data.copy('m3', 'm6', 'NOE', '800')
123 relax> relax_data.copy(run1='m3', run2='m6', ri_label='NOE', frq_label='800')
124 """
125
126
127 if self.__relax__.interpreter.intro:
128 text = sys.ps3 + "relax_data.copy("
129 text = text + "run1=" + `run1`
130 text = text + ", run2=" + `run2`
131 text = text + ", ri_label=" + `ri_label`
132 text = text + ", frq_label=" + `frq_label` + ")"
133 print text
134
135
136 if type(run1) != str:
137 raise RelaxStrError, ('run1', run1)
138
139
140 if type(run2) != str:
141 raise RelaxStrError, ('run2', run2)
142
143
144 if ri_label != None and type(ri_label) != str:
145 raise RelaxNoneStrError, ('relaxation label', ri_label)
146
147
148 if frq_label != None and type(frq_label) != str:
149 raise RelaxNoneStrError, ('frequency label', frq_label)
150
151
152 self.__relax__.specific.relax_data.copy(run1=run1, run2=run2, ri_label=ri_label, frq_label=frq_label)
153
154
155 - def delete(self, run=None, ri_label=None, frq_label=None):
156 """Function for deleting the relaxation data corresponding to ri_label and frq_label.
157
158 Keyword Arguments
159 ~~~~~~~~~~~~~~~~~
160
161 run: The name of the run.
162
163 ri_label: The relaxation data type, ie 'R1', 'R2', or 'NOE'.
164
165 frq_label: The field strength label.
166
167
168 Examples
169 ~~~~~~~~
170
171 To delete the relaxation data corresponding to ri_label='NOE', frq_label='600', and the run
172 'm4', type:
173
174 relax> relax_data.delete('m4', 'NOE', '600')
175 """
176
177
178 if self.__relax__.interpreter.intro:
179 text = sys.ps3 + "relax_data.delete("
180 text = text + "run=" + `run`
181 text = text + ", ri_label=" + `ri_label`
182 text = text + ", frq_label=" + `frq_label` + ")"
183 print text
184
185
186 if type(run) != str:
187 raise RelaxStrError, ('run', run)
188
189
190 if type(ri_label) != str:
191 raise RelaxStrError, ('relaxation label', ri_label)
192
193
194 if type(frq_label) != str:
195 raise RelaxStrError, ('frequency label', frq_label)
196
197
198 self.__relax__.specific.relax_data.delete(run=run, ri_label=ri_label, frq_label=frq_label)
199
200
201 - def display(self, run=None, ri_label=None, frq_label=None):
202 """Function for displaying the relaxation data corresponding to ri_label and frq_label.
203
204 Keyword Arguments
205 ~~~~~~~~~~~~~~~~~
206
207 run: The name of the run.
208
209 ri_label: The relaxation data type, ie 'R1', 'R2', or 'NOE'.
210
211 frq_label: The field strength label.
212
213
214 Examples
215 ~~~~~~~~
216
217 To display the NOE relaxation data at 600 MHz from the run 'm4', type
218
219 relax> relax_data.display('m4', 'NOE', '600')
220 """
221
222
223 if self.__relax__.interpreter.intro:
224 text = sys.ps3 + "relax_data.display("
225 text = text + "run=" + `run`
226 text = text + ", ri_label=" + `ri_label`
227 text = text + ", frq_label=" + `frq_label` + ")"
228 print text
229
230
231 if type(run) != str:
232 raise RelaxStrError, ('run', run)
233
234
235 if type(ri_label) != str:
236 raise RelaxStrError, ('relaxation label', ri_label)
237
238
239 if type(frq_label) != str:
240 raise RelaxStrError, ('frequency label', frq_label)
241
242
243 self.__relax__.specific.relax_data.display(run=run, ri_label=ri_label, frq_label=frq_label)
244
245
246 - def read(self, run=None, ri_label=None, frq_label=None, frq=None, file=None, dir=None, num_col=0, name_col=1, data_col=2, error_col=3, sep=None):
247 """Function for reading R1, R2, or NOE relaxation data from a file.
248
249 Keyword Arguments
250 ~~~~~~~~~~~~~~~~~
251
252 run: The name of the run.
253
254 ri_label: The relaxation data type, ie 'R1', 'R2', or 'NOE'.
255
256 frq_label: The field strength label.
257
258 frq: The spectrometer frequency in Hz.
259
260 file: The name of the file containing the relaxation data.
261
262 dir: The directory where the file is located.
263
264 num_col: The residue number column (the default is 0, ie the first column).
265
266 name_col: The residue name column (the default is 1).
267
268 data_col: The relaxation data column (the default is 2).
269
270 error_col: The experimental error column (the default is 3).
271
272 sep: The column separator (the default is white space).
273
274
275 Description
276 ~~~~~~~~~~~
277
278 The frequency label argument can be anything as long as data collected at the same field
279 strength have the same label.
280
281
282 Examples
283 ~~~~~~~~
284
285 The following commands will read the NOE relaxation data collected at 600 MHz out of a file
286 called 'noe.600.out' where the residue numbers, residue names, data, errors are in the
287 first, second, third, and forth columns respectively.
288
289 relax> relax_data.read('m1', 'NOE', '600', 599.7 * 1e6, 'noe.600.out')
290 relax> relax_data.read('m1', ri_label='NOE', frq_label='600', frq=600.0 * 1e6,
291 file='noe.600.out')
292
293
294 The following commands will read the R2 data out of the file 'r2.out' where the residue
295 numbers, residue names, data, errors are in the second, third, fifth, and sixth columns
296 respectively. The columns are separated by commas.
297
298 relax> relax_data.read('m1', 'R2', '800 MHz', 8.0 * 1e8, 'r2.out', 1, 2, 4, 5, ',')
299 relax> relax_data.read('m1', ri_label='R2', frq_label='800 MHz', frq=8.0*1e8,
300 file='r2.out', num_col=1, name_col=2, data_col=4, error_col=5,
301 sep=',')
302
303
304 The following commands will read the R1 data out of the file 'r1.out' where the columns are
305 separated by the symbol '%'
306
307 relax> relax_data.read('m1', 'R1', '300', 300.1 * 1e6, 'r1.out', sep='%')
308 """
309
310
311 if self.__relax__.interpreter.intro:
312 text = sys.ps3 + "relax_data.read("
313 text = text + "run=" + `run`
314 text = text + ", ri_label=" + `ri_label`
315 text = text + ", frq_label=" + `frq_label`
316 text = text + ", frq=" + `frq`
317 text = text + ", file=" + `file`
318 text = text + ", dir=" + `dir`
319 text = text + ", num_col=" + `num_col`
320 text = text + ", name_col=" + `name_col`
321 text = text + ", data_col=" + `data_col`
322 text = text + ", error_col=" + `error_col`
323 text = text + ", sep=" + `sep` + ")"
324 print text
325
326
327 if type(run) != str:
328 raise RelaxStrError, ('run', run)
329
330
331 if type(ri_label) != str:
332 raise RelaxStrError, ('relaxation label', ri_label)
333
334
335 if type(frq_label) != str:
336 raise RelaxStrError, ('frequency label', frq_label)
337
338
339 if type(frq) != float:
340 raise RelaxFloatError, ('frequency', frq)
341
342
343 if type(file) != str:
344 raise RelaxStrError, ('file', file)
345
346
347 if dir != None and type(dir) != str:
348 raise RelaxNoneStrError, ('directory name', dir)
349
350
351 if type(num_col) != int:
352 raise RelaxIntError, ('residue number column', num_col)
353
354
355 if type(name_col) != int:
356 raise RelaxIntError, ('residue name column', name_col)
357
358
359 if type(data_col) != int:
360 raise RelaxIntError, ('data column', data_col)
361
362
363 if type(error_col) != int:
364 raise RelaxIntError, ('error column', error_col)
365
366
367 if sep != None and type(sep) != str:
368 raise RelaxNoneStrError, ('column separator', sep)
369
370
371 self.__relax__.specific.relax_data.read(run=run, ri_label=ri_label, frq_label=frq_label, frq=frq, file=file, dir=dir, num_col=num_col, name_col=name_col, data_col=data_col, error_col=error_col, sep=sep)
372
373
374 - def write(self, run=None, ri_label=None, frq_label=None, file=None, dir=None, force=0):
375 """Function for writing R1, R2, or NOE relaxation data to a file.
376
377 Keyword Arguments
378 ~~~~~~~~~~~~~~~~~
379
380 run: The name of the run.
381
382 ri_label: The relaxation data type, ie 'R1', 'R2', or 'NOE'.
383
384 frq_label: The field strength label.
385
386 file: The name of the file.
387
388 dir: The directory name.
389
390 force: A flag which, if set to 1, will cause the file to be overwritten.
391
392
393 Description
394 ~~~~~~~~~~~
395
396 If no directory name is given, the file will be placed in the current working directory.
397 The 'ri_label' and 'frq_label' arguments are required for selecting which relaxation data
398 to write to file.
399 """
400
401
402 if self.__relax__.interpreter.intro:
403 text = sys.ps3 + "relax_data.write("
404 text = text + "run=" + `run`
405 text = text + ", ri_label=" + `ri_label`
406 text = text + ", frq_label=" + `frq_label`
407 text = text + ", file=" + `file`
408 text = text + ", dir=" + `dir`
409 text = text + ", force=" + `force` + ")"
410 print text
411
412
413 if type(run) != str:
414 raise RelaxStrError, ('run', run)
415
416
417 if type(ri_label) != str:
418 raise RelaxStrError, ('relaxation label', ri_label)
419
420
421 if type(frq_label) != str:
422 raise RelaxStrError, ('frequency label', frq_label)
423
424
425 if file != None and type(file) != str:
426 raise RelaxNoneStrError, ('file name', file)
427
428
429 if dir != None and type(dir) != str:
430 raise RelaxNoneStrError, ('directory name', dir)
431
432
433 if type(force) != int or (force != 0 and force != 1):
434 raise RelaxBinError, ('force flag', force)
435
436
437 self.__relax__.specific.relax_data.write(run=run, ri_label=ri_label, frq_label=frq_label, file=file, dir=dir, force=force)
438