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 relaxation curve fitting."""
33
34
35 self.__relax_help__ = self.__relax_help__ + "\n" + help.relax_class_help
36
37
38 self.__relax__ = relax
39
40
41 - def read(self, run=None, file=None, dir=None, relax_time=0.0, fit_type='exp', format='sparky', heteronuc='N', proton='HN', int_col=None):
42 """Function for reading peak intensities from a file.
43
44 Keyword Arguments
45 ~~~~~~~~~~~~~~~~~
46
47 run: The name of the run.
48
49 file: The name of the file containing the sequence data.
50
51 dir: The directory where the file is located.
52
53 relax_time: The time, in seconds, of the relaxation period.
54
55 fit_type: The type of relaxation curve to fit.
56
57 format: The type of file containing peak intensities.
58
59 heteronuc: The name of the heteronucleus as specified in the peak intensity file.
60
61 proton: The name of the proton as specified in the peak intensity file.
62
63 int_col: The column containing the peak intensity data (for a non-standard formatted file).
64
65
66 Description
67 ~~~~~~~~~~~
68
69 The peak intensity can either be from peak heights or peak volumes.
70
71
72 The supported relaxation experiments include the default two parameter exponential fit,
73 selected by setting the 'fit_type' argument to 'exp', and the three parameter inversion
74 recovery experiment in which the peak intensity limit is a non-zero value, selected by
75 setting the argument to 'inv'.
76
77
78 The format argument can currently be set to:
79 'sparky'
80 'xeasy'
81
82 If the format argument is set to 'sparky', the file should be a Sparky peak list saved after
83 typing the command 'lt'. The default is to assume that columns 0, 1, 2, and 3 (1st, 2nd,
84 3rd, and 4th) contain the Sparky assignment, w1, w2, and peak intensity data respectively.
85 The frequency data w1 and w2 are ignored while the peak intensity data can either be the
86 peak height or volume displayed by changing the window options. If the peak intensity data
87 is not within column 3, set the argument int_col to the appropriate value (column numbering
88 starts from 0 rather than 1).
89
90 If the format argument is set to 'xeasy', the file should be the saved XEasy text window
91 output of the list peak entries command, 'tw' followed by 'le'. As the columns are fixed,
92 the peak intensity column is hardwired to number 10 (the 11th column) which contains either
93 the peak height or peak volume data. Because the columns are fixed, the int_col argument
94 will be ignored.
95
96
97 The heteronuc and proton arguments should be set respectively to the name of the
98 heteronucleus and proton in the file. Only those lines which match these labels will be
99 used.
100
101
102 """
103
104
105 if self.__relax__.interpreter.intro:
106 text = sys.ps3 + "relax_fit.read("
107 text = text + "run=" + `run`
108 text = text + ", file=" + `file`
109 text = text + ", dir=" + `dir`
110 text = text + ", relax_time=" + `relax_time`
111 text = text + ", fit_type=" + `fit_type`
112 text = text + ", format=" + `format`
113 text = text + ", heteronuc=" + `heteronuc`
114 text = text + ", proton=" + `proton`
115 text = text + ", int_col=" + `int_col` + ")"
116 print text
117
118
119 if type(run) != str:
120 raise RelaxStrError, ('run', run)
121
122
123 if type(file) != str:
124 raise RelaxStrError, ('file name', file)
125
126
127 if dir != None and type(dir) != str:
128 raise RelaxNoneStrError, ('directory name', dir)
129
130
131 if type(relax_time) != float:
132 raise RelaxFloatError, ('relaxation time', relax_time)
133
134
135 if type(fit_type) != str:
136 raise RelaxStrError, ('fit type', fit_type)
137
138
139 if type(format) != str:
140 raise RelaxStrError, ('format', format)
141
142
143 if type(heteronuc) != str:
144 raise RelaxStrError, ('heteronucleus name', heteronuc)
145
146
147 if type(proton) != str:
148 raise RelaxStrError, ('proton name', proton)
149
150
151 if int_col and type(int_col) != int:
152 raise RelaxNoneIntError, ('intensity column', int_col)
153
154
155 self.__relax__.specific.relax_fit.read(run=run, file=file, dir=dir, relax_time=relax_time, fit_type=fit_type, format=format, heteronuc=heteronuc, proton=proton, int_col=int_col)
156