@@ -1,355 +1,362 | |||||
|
1 | ''' | |||
|
2 | Created on Feb 7, 2012 | |||
|
3 | ||||
|
4 | @author $Author$ | |||
|
5 | @version $Id$ | |||
|
6 | ''' | |||
|
7 | ||||
1 | import numpy |
|
8 | import numpy | |
2 | import plplot |
|
9 | import plplot | |
3 |
|
10 | |||
4 | def cmap1_init(colormap="gray"): |
|
11 | def cmap1_init(colormap="gray"): | |
5 |
|
12 | |||
6 | ncolor = None |
|
13 | ncolor = None | |
7 | rgb_lvl = None |
|
14 | rgb_lvl = None | |
8 |
|
15 | |||
9 | # Routine for defining a specific color map 1 in HLS space. |
|
16 | # Routine for defining a specific color map 1 in HLS space. | |
10 | # if gray is true, use basic grayscale variation from half-dark to light. |
|
17 | # if gray is true, use basic grayscale variation from half-dark to light. | |
11 | # otherwise use false color variation from blue (240 deg) to red (360 deg). |
|
18 | # otherwise use false color variation from blue (240 deg) to red (360 deg). | |
12 |
|
19 | |||
13 | # Independent variable of control points. |
|
20 | # Independent variable of control points. | |
14 | i = numpy.array((0., 1.)) |
|
21 | i = numpy.array((0., 1.)) | |
15 | if colormap=="gray": |
|
22 | if colormap=="gray": | |
16 | ncolor = 256 |
|
23 | ncolor = 256 | |
17 | # Hue for control points. Doesn't matter since saturation is zero. |
|
24 | # Hue for control points. Doesn't matter since saturation is zero. | |
18 | h = numpy.array((0., 0.)) |
|
25 | h = numpy.array((0., 0.)) | |
19 | # Lightness ranging from half-dark (for interest) to light. |
|
26 | # Lightness ranging from half-dark (for interest) to light. | |
20 | l = numpy.array((0.5, 1.)) |
|
27 | l = numpy.array((0.5, 1.)) | |
21 | # Gray scale has zero saturation |
|
28 | # Gray scale has zero saturation | |
22 | s = numpy.array((0., 0.)) |
|
29 | s = numpy.array((0., 0.)) | |
23 |
|
30 | |||
24 | # number of cmap1 colours is 256 in this case. |
|
31 | # number of cmap1 colours is 256 in this case. | |
25 | plplot.plscmap1n(ncolor) |
|
32 | plplot.plscmap1n(ncolor) | |
26 | # Interpolate between control points to set up cmap1. |
|
33 | # Interpolate between control points to set up cmap1. | |
27 | plplot.plscmap1l(0, i, h, l, s) |
|
34 | plplot.plscmap1l(0, i, h, l, s) | |
28 |
|
35 | |||
29 | return None |
|
36 | return None | |
30 |
|
37 | |||
31 | if colormap=="br_green": |
|
38 | if colormap=="br_green": | |
32 | ncolor = 256 |
|
39 | ncolor = 256 | |
33 | # Hue ranges from blue (240 deg) to red (0 or 360 deg) |
|
40 | # Hue ranges from blue (240 deg) to red (0 or 360 deg) | |
34 | h = numpy.array((240., 0.)) |
|
41 | h = numpy.array((240., 0.)) | |
35 | # Lightness and saturation are constant (values taken from C example). |
|
42 | # Lightness and saturation are constant (values taken from C example). | |
36 | l = numpy.array((0.6, 0.6)) |
|
43 | l = numpy.array((0.6, 0.6)) | |
37 | s = numpy.array((0.8, 0.8)) |
|
44 | s = numpy.array((0.8, 0.8)) | |
38 |
|
45 | |||
39 | # number of cmap1 colours is 256 in this case. |
|
46 | # number of cmap1 colours is 256 in this case. | |
40 | plplot.plscmap1n(ncolor) |
|
47 | plplot.plscmap1n(ncolor) | |
41 | # Interpolate between control points to set up cmap1. |
|
48 | # Interpolate between control points to set up cmap1. | |
42 | plplot.plscmap1l(0, i, h, l, s) |
|
49 | plplot.plscmap1l(0, i, h, l, s) | |
43 |
|
50 | |||
44 | return None |
|
51 | return None | |
45 |
|
52 | |||
46 | if colormap=="tricolor": |
|
53 | if colormap=="tricolor": | |
47 | ncolor = 3 |
|
54 | ncolor = 3 | |
48 | # Hue ranges from blue (240 deg) to red (0 or 360 deg) |
|
55 | # Hue ranges from blue (240 deg) to red (0 or 360 deg) | |
49 | h = numpy.array((240., 0.)) |
|
56 | h = numpy.array((240., 0.)) | |
50 | # Lightness and saturation are constant (values taken from C example). |
|
57 | # Lightness and saturation are constant (values taken from C example). | |
51 | l = numpy.array((0.6, 0.6)) |
|
58 | l = numpy.array((0.6, 0.6)) | |
52 | s = numpy.array((0.8, 0.8)) |
|
59 | s = numpy.array((0.8, 0.8)) | |
53 |
|
60 | |||
54 | # number of cmap1 colours is 256 in this case. |
|
61 | # number of cmap1 colours is 256 in this case. | |
55 | plplot.plscmap1n(ncolor) |
|
62 | plplot.plscmap1n(ncolor) | |
56 | # Interpolate between control points to set up cmap1. |
|
63 | # Interpolate between control points to set up cmap1. | |
57 | plplot.plscmap1l(0, i, h, l, s) |
|
64 | plplot.plscmap1l(0, i, h, l, s) | |
58 |
|
65 | |||
59 | return None |
|
66 | return None | |
60 |
|
67 | |||
61 | if colormap == 'rgb' or colormap == 'rgb666': |
|
68 | if colormap == 'rgb' or colormap == 'rgb666': | |
62 |
|
69 | |||
63 | color_sz = 6 |
|
70 | color_sz = 6 | |
64 | ncolor = color_sz*color_sz*color_sz |
|
71 | ncolor = color_sz*color_sz*color_sz | |
65 | pos = numpy.zeros((ncolor)) |
|
72 | pos = numpy.zeros((ncolor)) | |
66 | r = numpy.zeros((ncolor)) |
|
73 | r = numpy.zeros((ncolor)) | |
67 | g = numpy.zeros((ncolor)) |
|
74 | g = numpy.zeros((ncolor)) | |
68 | b = numpy.zeros((ncolor)) |
|
75 | b = numpy.zeros((ncolor)) | |
69 | ind = 0 |
|
76 | ind = 0 | |
70 | for ri in range(color_sz): |
|
77 | for ri in range(color_sz): | |
71 | for gi in range(color_sz): |
|
78 | for gi in range(color_sz): | |
72 | for bi in range(color_sz): |
|
79 | for bi in range(color_sz): | |
73 | r[ind] = ri/(color_sz-1.0) |
|
80 | r[ind] = ri/(color_sz-1.0) | |
74 | g[ind] = gi/(color_sz-1.0) |
|
81 | g[ind] = gi/(color_sz-1.0) | |
75 | b[ind] = bi/(color_sz-1.0) |
|
82 | b[ind] = bi/(color_sz-1.0) | |
76 | pos[ind] = ind/(ncolor-1.0) |
|
83 | pos[ind] = ind/(ncolor-1.0) | |
77 | ind += 1 |
|
84 | ind += 1 | |
78 | rgb_lvl = [6,6,6] #Levels for RGB colors |
|
85 | rgb_lvl = [6,6,6] #Levels for RGB colors | |
79 |
|
86 | |||
80 | if colormap == 'rgb676': |
|
87 | if colormap == 'rgb676': | |
81 | ncolor = 6*7*6 |
|
88 | ncolor = 6*7*6 | |
82 | pos = numpy.zeros((ncolor)) |
|
89 | pos = numpy.zeros((ncolor)) | |
83 | r = numpy.zeros((ncolor)) |
|
90 | r = numpy.zeros((ncolor)) | |
84 | g = numpy.zeros((ncolor)) |
|
91 | g = numpy.zeros((ncolor)) | |
85 | b = numpy.zeros((ncolor)) |
|
92 | b = numpy.zeros((ncolor)) | |
86 | ind = 0 |
|
93 | ind = 0 | |
87 | for ri in range(8): |
|
94 | for ri in range(8): | |
88 | for gi in range(8): |
|
95 | for gi in range(8): | |
89 | for bi in range(4): |
|
96 | for bi in range(4): | |
90 | r[ind] = ri/(6-1.0) |
|
97 | r[ind] = ri/(6-1.0) | |
91 | g[ind] = gi/(7-1.0) |
|
98 | g[ind] = gi/(7-1.0) | |
92 | b[ind] = bi/(6-1.0) |
|
99 | b[ind] = bi/(6-1.0) | |
93 | pos[ind] = ind/(ncolor-1.0) |
|
100 | pos[ind] = ind/(ncolor-1.0) | |
94 | ind += 1 |
|
101 | ind += 1 | |
95 | rgb_lvl = [6,7,6] #Levels for RGB colors |
|
102 | rgb_lvl = [6,7,6] #Levels for RGB colors | |
96 |
|
103 | |||
97 | if colormap == 'rgb685': |
|
104 | if colormap == 'rgb685': | |
98 | ncolor = 6*8*5 |
|
105 | ncolor = 6*8*5 | |
99 | pos = numpy.zeros((ncolor)) |
|
106 | pos = numpy.zeros((ncolor)) | |
100 | r = numpy.zeros((ncolor)) |
|
107 | r = numpy.zeros((ncolor)) | |
101 | g = numpy.zeros((ncolor)) |
|
108 | g = numpy.zeros((ncolor)) | |
102 | b = numpy.zeros((ncolor)) |
|
109 | b = numpy.zeros((ncolor)) | |
103 | ind = 0 |
|
110 | ind = 0 | |
104 | for ri in range(8): |
|
111 | for ri in range(8): | |
105 | for gi in range(8): |
|
112 | for gi in range(8): | |
106 | for bi in range(4): |
|
113 | for bi in range(4): | |
107 | r[ind] = ri/(6-1.0) |
|
114 | r[ind] = ri/(6-1.0) | |
108 | g[ind] = gi/(8-1.0) |
|
115 | g[ind] = gi/(8-1.0) | |
109 | b[ind] = bi/(5-1.0) |
|
116 | b[ind] = bi/(5-1.0) | |
110 | pos[ind] = ind/(ncolor-1.0) |
|
117 | pos[ind] = ind/(ncolor-1.0) | |
111 | ind += 1 |
|
118 | ind += 1 | |
112 | rgb_lvl = [6,8,5] #Levels for RGB colors |
|
119 | rgb_lvl = [6,8,5] #Levels for RGB colors | |
113 |
|
120 | |||
114 | if colormap == 'rgb884': |
|
121 | if colormap == 'rgb884': | |
115 | ncolor = 8*8*4 |
|
122 | ncolor = 8*8*4 | |
116 | pos = numpy.zeros((ncolor)) |
|
123 | pos = numpy.zeros((ncolor)) | |
117 | r = numpy.zeros((ncolor)) |
|
124 | r = numpy.zeros((ncolor)) | |
118 | g = numpy.zeros((ncolor)) |
|
125 | g = numpy.zeros((ncolor)) | |
119 | b = numpy.zeros((ncolor)) |
|
126 | b = numpy.zeros((ncolor)) | |
120 | ind = 0 |
|
127 | ind = 0 | |
121 | for ri in range(8): |
|
128 | for ri in range(8): | |
122 | for gi in range(8): |
|
129 | for gi in range(8): | |
123 | for bi in range(4): |
|
130 | for bi in range(4): | |
124 | r[ind] = ri/(8-1.0) |
|
131 | r[ind] = ri/(8-1.0) | |
125 | g[ind] = gi/(8-1.0) |
|
132 | g[ind] = gi/(8-1.0) | |
126 | b[ind] = bi/(4-1.0) |
|
133 | b[ind] = bi/(4-1.0) | |
127 | pos[ind] = ind/(ncolor-1.0) |
|
134 | pos[ind] = ind/(ncolor-1.0) | |
128 | ind += 1 |
|
135 | ind += 1 | |
129 | rgb_lvl = [8,8,4] #Levels for RGB colors |
|
136 | rgb_lvl = [8,8,4] #Levels for RGB colors | |
130 |
|
137 | |||
131 | if ncolor == None: |
|
138 | if ncolor == None: | |
132 | raise ValueError, "The colormap selected is not valid" |
|
139 | raise ValueError, "The colormap selected is not valid" | |
133 |
|
140 | |||
134 | plplot.plscmap1n(ncolor) |
|
141 | plplot.plscmap1n(ncolor) | |
135 | plplot.plscmap1l(1, pos, r, g, b) |
|
142 | plplot.plscmap1l(1, pos, r, g, b) | |
136 |
|
143 | |||
137 | return rgb_lvl |
|
144 | return rgb_lvl | |
138 |
|
145 | |||
139 | class BasicGraph: |
|
146 | class BasicGraph: | |
140 | """ |
|
147 | """ | |
141 |
|
148 | |||
142 | """ |
|
149 | """ | |
143 |
|
150 | |||
144 | hasRange = False |
|
151 | hasRange = False | |
145 |
|
152 | |||
146 | xrange = None |
|
153 | xrange = None | |
147 | yrange = None |
|
154 | yrange = None | |
148 | zrange = None |
|
155 | zrange = None | |
149 |
|
156 | |||
150 | xlabel = None |
|
157 | xlabel = None | |
151 | ylabel = None |
|
158 | ylabel = None | |
152 | title = None |
|
159 | title = None | |
153 |
|
160 | |||
154 | legends = None |
|
161 | legends = None | |
155 |
|
162 | |||
156 | __name = None |
|
163 | __name = None | |
157 | __subpage = None |
|
164 | __subpage = None | |
158 | __szchar = None |
|
165 | __szchar = None | |
159 |
|
166 | |||
160 | __colormap = None |
|
167 | __colormap = None | |
161 | __colbox = None |
|
168 | __colbox = None | |
162 | __colleg = None |
|
169 | __colleg = None | |
163 |
|
170 | |||
164 | __xpos = None |
|
171 | __xpos = None | |
165 | __ypos = None |
|
172 | __ypos = None | |
166 |
|
173 | |||
167 | __xopt = None #"bcnst" |
|
174 | __xopt = None #"bcnst" | |
168 | __yopt = None #"bcnstv" |
|
175 | __yopt = None #"bcnstv" | |
169 |
|
176 | |||
170 | __xlpos = None |
|
177 | __xlpos = None | |
171 | __ylpos = None |
|
178 | __ylpos = None | |
172 |
|
179 | |||
173 | __xrangeIsTime = None |
|
180 | __xrangeIsTime = None | |
174 |
|
181 | |||
175 | #Advanced |
|
182 | #Advanced | |
176 | __xg = None |
|
183 | __xg = None | |
177 | __yg = None |
|
184 | __yg = None | |
178 |
|
185 | |||
179 | def __init__(self): |
|
186 | def __init__(self): | |
180 | """ |
|
187 | """ | |
181 |
|
188 | |||
182 | """ |
|
189 | """ | |
183 | pass |
|
190 | pass | |
184 |
|
191 | |||
185 | def hasNotXrange(self): |
|
192 | def hasNotXrange(self): | |
186 |
|
193 | |||
187 | if self.xrange == None: |
|
194 | if self.xrange == None: | |
188 | return 1 |
|
195 | return 1 | |
189 |
|
196 | |||
190 | return 0 |
|
197 | return 0 | |
191 |
|
198 | |||
192 | def hasNotYrange(self): |
|
199 | def hasNotYrange(self): | |
193 |
|
200 | |||
194 | if self.yrange == None: |
|
201 | if self.yrange == None: | |
195 | return 1 |
|
202 | return 1 | |
196 |
|
203 | |||
197 | return 0 |
|
204 | return 0 | |
198 |
|
205 | |||
199 | def hasNotZrange(self): |
|
206 | def hasNotZrange(self): | |
200 |
|
207 | |||
201 | if self.zrange == None: |
|
208 | if self.zrange == None: | |
202 | return 1 |
|
209 | return 1 | |
203 |
|
210 | |||
204 | return 0 |
|
211 | return 0 | |
205 | def setName(self, name): |
|
212 | def setName(self, name): | |
206 | self.__name = name |
|
213 | self.__name = name | |
207 |
|
214 | |||
208 | def setScreenPos(self, xpos, ypos): |
|
215 | def setScreenPos(self, xpos, ypos): | |
209 | self.__xpos = xpos |
|
216 | self.__xpos = xpos | |
210 | self.__ypos = ypos |
|
217 | self.__ypos = ypos | |
211 |
|
218 | |||
212 | def setScreenPosbyWidth(self, xoff, yoff, xw, yw): |
|
219 | def setScreenPosbyWidth(self, xoff, yoff, xw, yw): | |
213 | self.__xpos = [xoff, xoff + xw] |
|
220 | self.__xpos = [xoff, xoff + xw] | |
214 | self.__ypos = [yoff, yoff + yw] |
|
221 | self.__ypos = [yoff, yoff + yw] | |
215 |
|
222 | |||
216 | def setSubpage(self, subpage): |
|
223 | def setSubpage(self, subpage): | |
217 | self.__subpage = subpage |
|
224 | self.__subpage = subpage | |
218 |
|
225 | |||
219 | def setSzchar(self, szchar): |
|
226 | def setSzchar(self, szchar): | |
220 | self.__szchar = szchar |
|
227 | self.__szchar = szchar | |
221 |
|
228 | |||
222 | def setOpt(self, xopt, yopt): |
|
229 | def setOpt(self, xopt, yopt): | |
223 | self.__xopt = xopt |
|
230 | self.__xopt = xopt | |
224 | self.__yopt = yopt |
|
231 | self.__yopt = yopt | |
225 |
|
232 | |||
226 | def setRanges(self, xrange, yrange, zrange=None): |
|
233 | def setRanges(self, xrange, yrange, zrange=None): | |
227 | """ |
|
234 | """ | |
228 | """ |
|
235 | """ | |
229 | self.xrange = xrange |
|
236 | self.xrange = xrange | |
230 |
|
237 | |||
231 | self.yrange = yrange |
|
238 | self.yrange = yrange | |
232 |
|
239 | |||
233 | if zrange != None: |
|
240 | if zrange != None: | |
234 | self.zrange = zrange |
|
241 | self.zrange = zrange | |
235 |
|
242 | |||
236 | def setColormap(self, colormap=None): |
|
243 | def setColormap(self, colormap=None): | |
237 |
|
244 | |||
238 | if colormap == None: |
|
245 | if colormap == None: | |
239 | colormap = self.__colormap |
|
246 | colormap = self.__colormap | |
240 |
|
247 | |||
241 | cmap1_init(colormap) |
|
248 | cmap1_init(colormap) | |
242 |
|
249 | |||
243 | def plotBox(self): |
|
250 | def plotBox(self): | |
244 | """ |
|
251 | """ | |
245 |
|
252 | |||
246 | """ |
|
253 | """ | |
247 | plplot.plvpor(self.__xpos[0], self.__xpos[1], self.__ypos[0], self.__ypos[1]) |
|
254 | plplot.plvpor(self.__xpos[0], self.__xpos[1], self.__ypos[0], self.__ypos[1]) | |
248 | plplot.plwind(self.xrange[0], self.xrange[1], self.yrange[0], self.yrange[1]) |
|
255 | plplot.plwind(self.xrange[0], self.xrange[1], self.yrange[0], self.yrange[1]) | |
249 | plplot.plbox(self.__xopt, 0.0, 0, self.__yopt, 0.0, 0) |
|
256 | plplot.plbox(self.__xopt, 0.0, 0, self.__yopt, 0.0, 0) | |
250 | plplot.pllab(self.xlabel, self.ylabel, self.title) |
|
257 | plplot.pllab(self.xlabel, self.ylabel, self.title) | |
251 |
|
258 | |||
252 | def setup(self, title=None, xlabel=None, ylabel=None, colormap=None): |
|
259 | def setup(self, title=None, xlabel=None, ylabel=None, colormap=None): | |
253 | """ |
|
260 | """ | |
254 | """ |
|
261 | """ | |
255 | self.title = title |
|
262 | self.title = title | |
256 | self.xlabel = xlabel |
|
263 | self.xlabel = xlabel | |
257 | self.ylabel = ylabel |
|
264 | self.ylabel = ylabel | |
258 | self.__colormap = colormap |
|
265 | self.__colormap = colormap | |
259 |
|
266 | |||
260 | def initSubpage(self): |
|
267 | def initSubpage(self): | |
261 |
|
268 | |||
262 | if plplot.plgdev() == '': |
|
269 | if plplot.plgdev() == '': | |
263 | raise ValueError, "Plot device has not been initialize" |
|
270 | raise ValueError, "Plot device has not been initialize" | |
264 |
|
271 | |||
265 | plplot.pladv(self.__subpage) |
|
272 | plplot.pladv(self.__subpage) | |
266 | plplot.plschr(0.0, self.__szchar) |
|
273 | plplot.plschr(0.0, self.__szchar) | |
267 |
|
274 | |||
268 | if self.__xrangeIsTime: |
|
275 | if self.__xrangeIsTime: | |
269 | plplot.pltimefmt("%H:%M") |
|
276 | plplot.pltimefmt("%H:%M") | |
270 |
|
277 | |||
271 | self.setColormap() |
|
278 | self.setColormap() | |
272 | self.initPlot() |
|
279 | self.initPlot() | |
273 |
|
280 | |||
274 | def initPlot(self): |
|
281 | def initPlot(self): | |
275 | """ |
|
282 | """ | |
276 |
|
283 | |||
277 | """ |
|
284 | """ | |
278 | if plplot.plgdev() == '': |
|
285 | if plplot.plgdev() == '': | |
279 | raise ValueError, "Plot device has not been initialize" |
|
286 | raise ValueError, "Plot device has not been initialize" | |
280 |
|
287 | |||
281 | xrange = self.xrange |
|
288 | xrange = self.xrange | |
282 | if xrange == None: |
|
289 | if xrange == None: | |
283 | xrange = [0., 1.] |
|
290 | xrange = [0., 1.] | |
284 |
|
291 | |||
285 | yrange = self.yrange |
|
292 | yrange = self.yrange | |
286 | if yrange == None: |
|
293 | if yrange == None: | |
287 | yrange = [0., 1.] |
|
294 | yrange = [0., 1.] | |
288 |
|
295 | |||
289 | plplot.plvpor(self.__xpos[0], self.__xpos[1], self.__ypos[0], self.__ypos[1]) |
|
296 | plplot.plvpor(self.__xpos[0], self.__xpos[1], self.__ypos[0], self.__ypos[1]) | |
290 | plplot.plwind(xrange[0], xrange[1], yrange[0], yrange[1]) |
|
297 | plplot.plwind(xrange[0], xrange[1], yrange[0], yrange[1]) | |
291 | plplot.plbox(self.__xopt, 0.0, 0, self.__yopt, 0.0, 0) |
|
298 | plplot.plbox(self.__xopt, 0.0, 0, self.__yopt, 0.0, 0) | |
292 | plplot.pllab(self.xlabel, self.ylabel, self.title) |
|
299 | plplot.pllab(self.xlabel, self.ylabel, self.title) | |
293 |
|
300 | |||
294 | def colorbarPlot(self): |
|
301 | def colorbarPlot(self): | |
295 | data = numpy.arange(256) |
|
302 | data = numpy.arange(256) | |
296 | data = numpy.reshape(data, (1,-1)) |
|
303 | data = numpy.reshape(data, (1,-1)) | |
297 |
|
304 | |||
298 | self.plotBox() |
|
305 | self.plotBox() | |
299 | plplot.plimage(data, |
|
306 | plplot.plimage(data, | |
300 | self.xrange[0], |
|
307 | self.xrange[0], | |
301 | self.xrange[1], |
|
308 | self.xrange[1], | |
302 | self.yrange[0], |
|
309 | self.yrange[0], | |
303 | self.yrange[1], |
|
310 | self.yrange[1], | |
304 | 0., |
|
311 | 0., | |
305 | 255., |
|
312 | 255., | |
306 | self.xrange[0], |
|
313 | self.xrange[0], | |
307 | self.xrange[1], |
|
314 | self.xrange[1], | |
308 | self.yrange[0], |
|
315 | self.yrange[0], | |
309 | self.yrange[1],) |
|
316 | self.yrange[1],) | |
310 |
|
317 | |||
311 | def basicXYPlot(self, x, y): |
|
318 | def basicXYPlot(self, x, y): | |
312 | self.plotBox() |
|
319 | self.plotBox() | |
313 | plplot.plline(x, y) |
|
320 | plplot.plline(x, y) | |
314 |
|
321 | |||
315 | def basicXYwithErrorPlot(self): |
|
322 | def basicXYwithErrorPlot(self): | |
316 | pass |
|
323 | pass | |
317 |
|
324 | |||
318 | def basicLineTimePlot(self): |
|
325 | def basicLineTimePlot(self): | |
319 | pass |
|
326 | pass | |
320 |
|
327 | |||
321 | def basicPcolorPlot(self, data, xmin, xmax, ymin, ymax, zmin, zmax): |
|
328 | def basicPcolorPlot(self, data, xmin, xmax, ymin, ymax, zmin, zmax): | |
322 | """ |
|
329 | """ | |
323 | """ |
|
330 | """ | |
324 |
|
331 | |||
325 | self.plotBox() |
|
332 | self.plotBox() | |
326 | plplot.plimage(data, xmin, xmax, ymin, ymax, zmin, zmax, xmin, xmax, ymin, ymax) |
|
333 | plplot.plimage(data, xmin, xmax, ymin, ymax, zmin, zmax, xmin, xmax, ymin, ymax) | |
327 |
|
334 | |||
328 |
|
335 | |||
329 | def __getBoxpltr(self, x, y, deltax=None, deltay=None): |
|
336 | def __getBoxpltr(self, x, y, deltax=None, deltay=None): | |
330 |
|
337 | |||
331 | if not(len(x)>1 and len(y)>1): |
|
338 | if not(len(x)>1 and len(y)>1): | |
332 | raise ValueError, "x axis and y axis are empty" |
|
339 | raise ValueError, "x axis and y axis are empty" | |
333 |
|
340 | |||
334 | if deltax == None: deltax = x[-1] - x[-2] |
|
341 | if deltax == None: deltax = x[-1] - x[-2] | |
335 | if deltay == None: deltay = y[-1] - y[-2] |
|
342 | if deltay == None: deltay = y[-1] - y[-2] | |
336 |
|
343 | |||
337 | x1 = numpy.append(x, x[-1] + deltax) |
|
344 | x1 = numpy.append(x, x[-1] + deltax) | |
338 | y1 = numpy.append(y, y[-1] + deltay) |
|
345 | y1 = numpy.append(y, y[-1] + deltay) | |
339 |
|
346 | |||
340 | xg = (numpy.multiply.outer(x1, numpy.ones(len(y1)))) |
|
347 | xg = (numpy.multiply.outer(x1, numpy.ones(len(y1)))) | |
341 | yg = (numpy.multiply.outer(numpy.ones(len(x1)), y1)) |
|
348 | yg = (numpy.multiply.outer(numpy.ones(len(x1)), y1)) | |
342 |
|
349 | |||
343 | self.__xg = xg |
|
350 | self.__xg = xg | |
344 | self.__yg = yg |
|
351 | self.__yg = yg | |
345 |
|
352 | |||
346 | def advPcolorPlot(self, data, x, y, zmin=0., zmax=0.): |
|
353 | def advPcolorPlot(self, data, x, y, zmin=0., zmax=0.): | |
347 | """ |
|
354 | """ | |
348 | """ |
|
355 | """ | |
349 |
|
356 | |||
350 | if self.__xg == None and self.__yg == None: |
|
357 | if self.__xg == None and self.__yg == None: | |
351 | self.__getBoxpltr(x, y) |
|
358 | self.__getBoxpltr(x, y) | |
352 |
|
359 | |||
353 | plplot.plimagefr(data, x[0], x[-1], y[0], y[-1], 0., 0., zmin, zmax, plplot.pltr2, self.__xg, self.__yg) |
|
360 | plplot.plimagefr(data, x[0], x[-1], y[0], y[-1], 0., 0., zmin, zmax, plplot.pltr2, self.__xg, self.__yg) | |
354 |
|
361 | |||
355 |
|
362 |
@@ -1,227 +1,234 | |||||
|
1 | ''' | |||
|
2 | Created on Feb 7, 2012 | |||
|
3 | ||||
|
4 | @author $Author$ | |||
|
5 | @version $Id$ | |||
|
6 | ''' | |||
|
7 | ||||
1 | import numpy |
|
8 | import numpy | |
2 | import plplot |
|
9 | import plplot | |
3 |
|
10 | |||
4 | from BasicGraph import * |
|
11 | from BasicGraph import * | |
5 |
|
12 | |||
6 | class Spectrum: |
|
13 | class Spectrum: | |
7 |
|
14 | |||
8 | graphObjDict = {} |
|
15 | graphObjDict = {} | |
9 | showColorbar = False |
|
16 | showColorbar = False | |
10 | showPowerProfile = True |
|
17 | showPowerProfile = True | |
11 |
|
18 | |||
12 | __szchar = 0.7 |
|
19 | __szchar = 0.7 | |
13 | __xrange = None |
|
20 | __xrange = None | |
14 | __yrange = None |
|
21 | __yrange = None | |
15 | __zrange = None |
|
22 | __zrange = None | |
16 | specObj = BasicGraph() |
|
23 | specObj = BasicGraph() | |
17 |
|
24 | |||
18 |
|
25 | |||
19 | def __init__(self): |
|
26 | def __init__(self): | |
20 |
|
27 | |||
21 | key = "spec" |
|
28 | key = "spec" | |
22 |
|
29 | |||
23 | specObj = BasicGraph() |
|
30 | specObj = BasicGraph() | |
24 | specObj.setName(key) |
|
31 | specObj.setName(key) | |
25 |
|
32 | |||
26 | self.graphObjDict[key] = specObj |
|
33 | self.graphObjDict[key] = specObj | |
27 |
|
34 | |||
28 |
|
35 | |||
29 | def setup(self, subpage, title="", xlabel="", ylabel="", colormap="jet", showColorbar=False, showPowerProfile=False): |
|
36 | def setup(self, subpage, title="", xlabel="", ylabel="", colormap="jet", showColorbar=False, showPowerProfile=False): | |
30 | """ |
|
37 | """ | |
31 | """ |
|
38 | """ | |
32 |
|
39 | |||
33 | xi = 0.12; xw = 0.78; xf = xi + xw |
|
40 | xi = 0.12; xw = 0.78; xf = xi + xw | |
34 | yi = 0.14; yw = 0.80; yf = yi + yw |
|
41 | yi = 0.14; yw = 0.80; yf = yi + yw | |
35 |
|
42 | |||
36 | xcmapi = xcmapf = 0.; xpowi = xpowf = 0. |
|
43 | xcmapi = xcmapf = 0.; xpowi = xpowf = 0. | |
37 |
|
44 | |||
38 | key = "spec" |
|
45 | key = "spec" | |
39 | specObj = self.graphObjDict[key] |
|
46 | specObj = self.graphObjDict[key] | |
40 | specObj.setSubpage(subpage) |
|
47 | specObj.setSubpage(subpage) | |
41 | specObj.setSzchar(self.__szchar) |
|
48 | specObj.setSzchar(self.__szchar) | |
42 | specObj.setOpt("bcnts","bcnts") |
|
49 | specObj.setOpt("bcnts","bcnts") | |
43 | specObj.setup(title, |
|
50 | specObj.setup(title, | |
44 | xlabel, |
|
51 | xlabel, | |
45 | ylabel, |
|
52 | ylabel, | |
46 | colormap) |
|
53 | colormap) | |
47 |
|
54 | |||
48 | if showColorbar: |
|
55 | if showColorbar: | |
49 | key = "colorbar" |
|
56 | key = "colorbar" | |
50 |
|
57 | |||
51 | cmapObj = BasicGraph() |
|
58 | cmapObj = BasicGraph() | |
52 | cmapObj.setName(key) |
|
59 | cmapObj.setName(key) | |
53 | cmapObj.setSubpage(subpage) |
|
60 | cmapObj.setSubpage(subpage) | |
54 | cmapObj.setSzchar(self.__szchar) |
|
61 | cmapObj.setSzchar(self.__szchar) | |
55 | cmapObj.setOpt("bc","bcmt") |
|
62 | cmapObj.setOpt("bc","bcmt") | |
56 | cmapObj.setup(title="dBs", |
|
63 | cmapObj.setup(title="dBs", | |
57 | xlabel="", |
|
64 | xlabel="", | |
58 | ylabel="", |
|
65 | ylabel="", | |
59 | colormap=colormap) |
|
66 | colormap=colormap) | |
60 |
|
67 | |||
61 | self.graphObjDict[key] = cmapObj |
|
68 | self.graphObjDict[key] = cmapObj | |
62 |
|
69 | |||
63 | xcmapi = 0. |
|
70 | xcmapi = 0. | |
64 | xcmapw = 0.05 |
|
71 | xcmapw = 0.05 | |
65 | xw -= xcmapw |
|
72 | xw -= xcmapw | |
66 |
|
73 | |||
67 | if showPowerProfile: |
|
74 | if showPowerProfile: | |
68 | key = "powerprof" |
|
75 | key = "powerprof" | |
69 |
|
76 | |||
70 | powObj = BasicGraph() |
|
77 | powObj = BasicGraph() | |
71 | powObj.setName(key) |
|
78 | powObj.setName(key) | |
72 | powObj.setSubpage(subpage) |
|
79 | powObj.setSubpage(subpage) | |
73 | powObj.setSzchar(self.__szchar) |
|
80 | powObj.setSzchar(self.__szchar) | |
74 | plplot.pllsty(2) |
|
81 | plplot.pllsty(2) | |
75 | powObj.setOpt("bcntg","bc") |
|
82 | powObj.setOpt("bcntg","bc") | |
76 | plplot.pllsty(1) |
|
83 | plplot.pllsty(1) | |
77 | powObj.setup(title="Power Profile", |
|
84 | powObj.setup(title="Power Profile", | |
78 | xlabel="dBs", |
|
85 | xlabel="dBs", | |
79 | ylabel="") |
|
86 | ylabel="") | |
80 |
|
87 | |||
81 | self.graphObjDict[key] = powObj |
|
88 | self.graphObjDict[key] = powObj | |
82 |
|
89 | |||
83 | xpowi = 0. |
|
90 | xpowi = 0. | |
84 | xpoww = 0.24 |
|
91 | xpoww = 0.24 | |
85 | xw -= xpoww |
|
92 | xw -= xpoww | |
86 |
|
93 | |||
87 | xf = xi + xw |
|
94 | xf = xi + xw | |
88 | yf = yi + yw |
|
95 | yf = yi + yw | |
89 | xcmapf = xf |
|
96 | xcmapf = xf | |
90 |
|
97 | |||
91 | specObj.setScreenPos([xi, xf], [yi, yf]) |
|
98 | specObj.setScreenPos([xi, xf], [yi, yf]) | |
92 |
|
99 | |||
93 | if showColorbar: |
|
100 | if showColorbar: | |
94 | xcmapi = xf + 0.02 |
|
101 | xcmapi = xf + 0.02 | |
95 | xcmapf = xcmapi + xcmapw |
|
102 | xcmapf = xcmapi + xcmapw | |
96 | cmapObj.setScreenPos([xcmapi, xcmapf], [yi, yf]) |
|
103 | cmapObj.setScreenPos([xcmapi, xcmapf], [yi, yf]) | |
97 |
|
104 | |||
98 | if showPowerProfile: |
|
105 | if showPowerProfile: | |
99 | xpowi = xcmapf + 0.06 |
|
106 | xpowi = xcmapf + 0.06 | |
100 | xpowf = xpowi + xpoww |
|
107 | xpowf = xpowi + xpoww | |
101 | powObj.setScreenPos([xpowi, xpowf], [yi, yf]) |
|
108 | powObj.setScreenPos([xpowi, xpowf], [yi, yf]) | |
102 |
|
109 | |||
103 |
|
110 | |||
104 | # specObj.initSubpage() |
|
111 | # specObj.initSubpage() | |
105 | # |
|
112 | # | |
106 | # if showColorbar: |
|
113 | # if showColorbar: | |
107 | # cmapObj.initPlot() |
|
114 | # cmapObj.initPlot() | |
108 | # |
|
115 | # | |
109 | # if showPowerProfile: |
|
116 | # if showPowerProfile: | |
110 | # powObj.initPlot() |
|
117 | # powObj.initPlot() | |
111 |
|
118 | |||
112 | self.showColorbar = showColorbar |
|
119 | self.showColorbar = showColorbar | |
113 | self.showPowerProfile = showPowerProfile |
|
120 | self.showPowerProfile = showPowerProfile | |
114 |
|
121 | |||
115 | def setRanges(self, xrange, yrange, zrange): |
|
122 | def setRanges(self, xrange, yrange, zrange): | |
116 |
|
123 | |||
117 | key = "spec" |
|
124 | key = "spec" | |
118 | specObj = self.graphObjDict[key] |
|
125 | specObj = self.graphObjDict[key] | |
119 | specObj.setRanges(xrange, yrange, zrange) |
|
126 | specObj.setRanges(xrange, yrange, zrange) | |
120 |
|
127 | |||
121 | keyList = self.graphObjDict.keys() |
|
128 | keyList = self.graphObjDict.keys() | |
122 |
|
129 | |||
123 | key = "colorbar" |
|
130 | key = "colorbar" | |
124 | if key in keyList: |
|
131 | if key in keyList: | |
125 | cmapObj = self.graphObjDict[key] |
|
132 | cmapObj = self.graphObjDict[key] | |
126 | cmapObj.setRanges([0., 1.], zrange) |
|
133 | cmapObj.setRanges([0., 1.], zrange) | |
127 |
|
134 | |||
128 | key = "powerprof" |
|
135 | key = "powerprof" | |
129 | if key in keyList: |
|
136 | if key in keyList: | |
130 | powObj = self.graphObjDict[key] |
|
137 | powObj = self.graphObjDict[key] | |
131 | powObj.setRanges(zrange, yrange) |
|
138 | powObj.setRanges(zrange, yrange) | |
132 |
|
139 | |||
133 | def plotData(self, data , xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None): |
|
140 | def plotData(self, data , xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None): | |
134 |
|
141 | |||
135 | key = "spec" |
|
142 | key = "spec" | |
136 | specObj = self.graphObjDict[key] |
|
143 | specObj = self.graphObjDict[key] | |
137 | specObj.initSubpage() |
|
144 | specObj.initSubpage() | |
138 |
|
145 | |||
139 | if xmin == None: |
|
146 | if xmin == None: | |
140 | xmin = 0. |
|
147 | xmin = 0. | |
141 |
|
148 | |||
142 | if xmax == None: |
|
149 | if xmax == None: | |
143 | xmax = 1. |
|
150 | xmax = 1. | |
144 |
|
151 | |||
145 | if ymin == None: |
|
152 | if ymin == None: | |
146 | ymin = 0. |
|
153 | ymin = 0. | |
147 |
|
154 | |||
148 | if ymax == None: |
|
155 | if ymax == None: | |
149 | ymax = 1. |
|
156 | ymax = 1. | |
150 |
|
157 | |||
151 | if zmin == None: |
|
158 | if zmin == None: | |
152 | zmin = numpy.nanmin(data) |
|
159 | zmin = numpy.nanmin(data) | |
153 |
|
160 | |||
154 | if zmax == None: |
|
161 | if zmax == None: | |
155 | zmax = numpy.nanmax(data) |
|
162 | zmax = numpy.nanmax(data) | |
156 |
|
163 | |||
157 | if not(specObj.hasRange): |
|
164 | if not(specObj.hasRange): | |
158 | self.setRanges([xmin, xmax], [ymin,ymax], [zmin,zmax]) |
|
165 | self.setRanges([xmin, xmax], [ymin,ymax], [zmin,zmax]) | |
159 |
|
166 | |||
160 | specObj.basicPcolorPlot(data, xmin, xmax, ymin, ymax, specObj.zrange[0], specObj.zrange[1]) |
|
167 | specObj.basicPcolorPlot(data, xmin, xmax, ymin, ymax, specObj.zrange[0], specObj.zrange[1]) | |
161 |
|
168 | |||
162 | if self.showColorbar: |
|
169 | if self.showColorbar: | |
163 | key = "colorbar" |
|
170 | key = "colorbar" | |
164 | cmapObj = self.graphObjDict[key] |
|
171 | cmapObj = self.graphObjDict[key] | |
165 | cmapObj.colorbarPlot() |
|
172 | cmapObj.colorbarPlot() | |
166 |
|
173 | |||
167 | if self.showPowerProfile: |
|
174 | if self.showPowerProfile: | |
168 | power = numpy.average(data, axis=1) |
|
175 | power = numpy.average(data, axis=1) | |
169 |
|
176 | |||
170 | step = (ymax - ymin)/(power.shape[0]-1) |
|
177 | step = (ymax - ymin)/(power.shape[0]-1) | |
171 | heis = numpy.arange(ymin, ymax + step, step) |
|
178 | heis = numpy.arange(ymin, ymax + step, step) | |
172 |
|
179 | |||
173 | key = "powerprof" |
|
180 | key = "powerprof" | |
174 | powObj = self.graphObjDict[key] |
|
181 | powObj = self.graphObjDict[key] | |
175 | powObj.basicXYPlot(power, heis) |
|
182 | powObj.basicXYPlot(power, heis) | |
176 |
|
183 | |||
177 | class CrossSpectrum: |
|
184 | class CrossSpectrum: | |
178 | graphObjDict = {} |
|
185 | graphObjDict = {} | |
179 | showColorbar = False |
|
186 | showColorbar = False | |
180 | showPowerProfile = True |
|
187 | showPowerProfile = True | |
181 |
|
188 | |||
182 | __szchar = 0.7 |
|
189 | __szchar = 0.7 | |
183 | __showPhase = False |
|
190 | __showPhase = False | |
184 | __xrange = None |
|
191 | __xrange = None | |
185 | __yrange = None |
|
192 | __yrange = None | |
186 | __zrange = None |
|
193 | __zrange = None | |
187 | m_BasicGraph= BasicGraph() |
|
194 | m_BasicGraph= BasicGraph() | |
188 |
|
195 | |||
189 | def __init__(self): |
|
196 | def __init__(self): | |
190 | pass |
|
197 | pass | |
191 |
|
198 | |||
192 | def setup(self, subpage, title, xlabel, ylabel, colormap, showColorbar, showPowerProfile): |
|
199 | def setup(self, subpage, title, xlabel, ylabel, colormap, showColorbar, showPowerProfile): | |
193 | pass |
|
200 | pass | |
194 |
|
201 | |||
195 | def setRanges(self, xrange, yrange, zrange): |
|
202 | def setRanges(self, xrange, yrange, zrange): | |
196 | pass |
|
203 | pass | |
197 |
|
204 | |||
198 | def plotData(self, data, xmin, xmax, ymin, ymax, zmin, zmax): |
|
205 | def plotData(self, data, xmin, xmax, ymin, ymax, zmin, zmax): | |
199 | pass |
|
206 | pass | |
200 |
|
207 | |||
201 | if __name__ == '__main__': |
|
208 | if __name__ == '__main__': | |
202 |
|
209 | |||
203 | import numpy |
|
210 | import numpy | |
204 | plplot.plsetopt("geometry", "%dx%d" %(350*2, 300*2)) |
|
211 | plplot.plsetopt("geometry", "%dx%d" %(350*2, 300*2)) | |
205 | plplot.plsdev("xcairo") |
|
212 | plplot.plsdev("xcairo") | |
206 | plplot.plscolbg(255,255,255) |
|
213 | plplot.plscolbg(255,255,255) | |
207 | plplot.plscol0(1,0,0,0) |
|
214 | plplot.plscol0(1,0,0,0) | |
208 | plplot.plinit() |
|
215 | plplot.plinit() | |
209 | plplot.plssub(2, 2) |
|
216 | plplot.plssub(2, 2) | |
210 |
|
217 | |||
211 | nx = 64 |
|
218 | nx = 64 | |
212 | ny = 100 |
|
219 | ny = 100 | |
213 |
|
220 | |||
214 | data = numpy.random.uniform(-50,50,(nx,ny)) |
|
221 | data = numpy.random.uniform(-50,50,(nx,ny)) | |
215 |
|
222 | |||
216 | specObj = Spectrum() |
|
223 | specObj = Spectrum() | |
217 | specObj.setup(1, "Spectrum", "Frequency", "Range", "br_green", False, False) |
|
224 | specObj.setup(1, "Spectrum", "Frequency", "Range", "br_green", False, False) | |
218 | specObj.plotData(data) |
|
225 | specObj.plotData(data) | |
219 |
|
226 | |||
220 | data = numpy.random.uniform(-50,50,(nx,ny)) |
|
227 | data = numpy.random.uniform(-50,50,(nx,ny)) | |
221 |
|
228 | |||
222 | spec2Obj = Spectrum() |
|
229 | spec2Obj = Spectrum() | |
223 | spec2Obj.setup(2, "Spectrum", "Frequency", "Range", "br_green", True, True) |
|
230 | spec2Obj.setup(2, "Spectrum", "Frequency", "Range", "br_green", True, True) | |
224 | spec2Obj.plotData(data) |
|
231 | spec2Obj.plotData(data) | |
225 |
|
232 | |||
226 | plplot.plend() |
|
233 | plplot.plend() | |
227 | exit(0) No newline at end of file |
|
234 | exit(0) |
@@ -1,17 +1,18 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Feb 7, 2012 |
|
2 | Created on Feb 7, 2012 | |
3 |
|
3 | |||
4 | @author: roj-idl71 |
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |||
5 | ''' |
|
6 | ''' | |
6 |
|
7 | |||
7 | class VoltagePlot(object): |
|
8 | class VoltagePlot(object): | |
8 | ''' |
|
9 | ''' | |
9 | classdocs |
|
10 | classdocs | |
10 | ''' |
|
11 | ''' | |
11 |
|
12 | |||
12 |
|
13 | |||
13 | def __init__(self): |
|
14 | def __init__(self): | |
14 | ''' |
|
15 | ''' | |
15 | Constructor |
|
16 | Constructor | |
16 | ''' |
|
17 | ''' | |
17 | pass No newline at end of file |
|
18 | pass |
@@ -1,16 +1,17 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on 23/01/2012 |
|
2 | Created on 23/01/2012 | |
3 |
|
3 | |||
4 | @author: danielangelsuarezmunoz |
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |||
5 | ''' |
|
6 | ''' | |
6 |
|
7 | |||
7 | from Data import DataReader |
|
8 | from Data import DataReader | |
8 | from Data import DataWriter |
|
9 | from Data import DataWriter | |
9 |
|
10 | |||
10 | class CorrelationReader(DataReader): |
|
11 | class CorrelationReader(DataReader): | |
11 | def __init__(self): |
|
12 | def __init__(self): | |
12 | pass |
|
13 | pass | |
13 |
|
14 | |||
14 | class CorrelationWriter(DataWriter): |
|
15 | class CorrelationWriter(DataWriter): | |
15 | def __init__(self): |
|
16 | def __init__(self): | |
16 | pass No newline at end of file |
|
17 | pass |
@@ -1,18 +1,19 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on 23/01/2012 |
|
2 | Created on 23/01/2012 | |
3 |
|
3 | |||
4 | @author: danielangelsuarezmunoz |
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |||
5 | ''' |
|
6 | ''' | |
6 |
|
7 | |||
7 |
|
8 | |||
8 | class DataReader: |
|
9 | class DataReader: | |
9 | __buffer = 0 |
|
10 | __buffer = 0 | |
10 | __buffer_count = 0 |
|
11 | __buffer_count = 0 | |
11 | def __init__(self): |
|
12 | def __init__(self): | |
12 | pass |
|
13 | pass | |
13 |
|
14 | |||
14 | class DataWriter: |
|
15 | class DataWriter: | |
15 | __buffer = 0 |
|
16 | __buffer = 0 | |
16 | __buffer_count = 0 |
|
17 | __buffer_count = 0 | |
17 | def __init__(self): |
|
18 | def __init__(self): | |
18 | pass No newline at end of file |
|
19 | pass |
@@ -1,312 +1,319 | |||||
|
1 | ''' | |||
|
2 | Created on 23/01/2012 | |||
|
3 | ||||
|
4 | @author $Author$ | |||
|
5 | @version $Id$ | |||
|
6 | ''' | |||
|
7 | ||||
1 | import numpy |
|
8 | import numpy | |
2 |
|
9 | |||
3 | class PROCFLAG: |
|
10 | class PROCFLAG: | |
4 | COHERENT_INTEGRATION = numpy.uint32(0x00000001) |
|
11 | COHERENT_INTEGRATION = numpy.uint32(0x00000001) | |
5 | DECODE_DATA = numpy.uint32(0x00000002) |
|
12 | DECODE_DATA = numpy.uint32(0x00000002) | |
6 | SPECTRA_CALC = numpy.uint32(0x00000004) |
|
13 | SPECTRA_CALC = numpy.uint32(0x00000004) | |
7 | INCOHERENT_INTEGRATION = numpy.uint32(0x00000008) |
|
14 | INCOHERENT_INTEGRATION = numpy.uint32(0x00000008) | |
8 | POST_COHERENT_INTEGRATION = numpy.uint32(0x00000010) |
|
15 | POST_COHERENT_INTEGRATION = numpy.uint32(0x00000010) | |
9 | SHIFT_FFT_DATA = numpy.uint32(0x00000020) |
|
16 | SHIFT_FFT_DATA = numpy.uint32(0x00000020) | |
10 |
|
17 | |||
11 | DATATYPE_CHAR = numpy.uint32(0x00000040) |
|
18 | DATATYPE_CHAR = numpy.uint32(0x00000040) | |
12 | DATATYPE_SHORT = numpy.uint32(0x00000080) |
|
19 | DATATYPE_SHORT = numpy.uint32(0x00000080) | |
13 | DATATYPE_LONG = numpy.uint32(0x00000100) |
|
20 | DATATYPE_LONG = numpy.uint32(0x00000100) | |
14 | DATATYPE_INT64 = numpy.uint32(0x00000200) |
|
21 | DATATYPE_INT64 = numpy.uint32(0x00000200) | |
15 | DATATYPE_FLOAT = numpy.uint32(0x00000400) |
|
22 | DATATYPE_FLOAT = numpy.uint32(0x00000400) | |
16 | DATATYPE_DOUBLE = numpy.uint32(0x00000800) |
|
23 | DATATYPE_DOUBLE = numpy.uint32(0x00000800) | |
17 |
|
24 | |||
18 | DATAARRANGE_CONTIGUOUS_CH = numpy.uint32(0x00001000) |
|
25 | DATAARRANGE_CONTIGUOUS_CH = numpy.uint32(0x00001000) | |
19 | DATAARRANGE_CONTIGUOUS_H = numpy.uint32(0x00002000) |
|
26 | DATAARRANGE_CONTIGUOUS_H = numpy.uint32(0x00002000) | |
20 | DATAARRANGE_CONTIGUOUS_P = numpy.uint32(0x00004000) |
|
27 | DATAARRANGE_CONTIGUOUS_P = numpy.uint32(0x00004000) | |
21 |
|
28 | |||
22 | SAVE_CHANNELS_DC = numpy.uint32(0x00008000) |
|
29 | SAVE_CHANNELS_DC = numpy.uint32(0x00008000) | |
23 | DEFLIP_DATA = numpy.uint32(0x00010000) |
|
30 | DEFLIP_DATA = numpy.uint32(0x00010000) | |
24 | DEFINE_PROCESS_CODE = numpy.uint32(0x00020000) |
|
31 | DEFINE_PROCESS_CODE = numpy.uint32(0x00020000) | |
25 |
|
32 | |||
26 | ACQ_SYS_NATALIA = numpy.uint32(0x00040000) |
|
33 | ACQ_SYS_NATALIA = numpy.uint32(0x00040000) | |
27 | ACQ_SYS_ECHOTEK = numpy.uint32(0x00080000) |
|
34 | ACQ_SYS_ECHOTEK = numpy.uint32(0x00080000) | |
28 | ACQ_SYS_ADRXD = numpy.uint32(0x000C0000) |
|
35 | ACQ_SYS_ADRXD = numpy.uint32(0x000C0000) | |
29 | ACQ_SYS_JULIA = numpy.uint32(0x00100000) |
|
36 | ACQ_SYS_JULIA = numpy.uint32(0x00100000) | |
30 | ACQ_SYS_XXXXXX = numpy.uint32(0x00140000) |
|
37 | ACQ_SYS_XXXXXX = numpy.uint32(0x00140000) | |
31 |
|
38 | |||
32 | EXP_NAME_ESP = numpy.uint32(0x00200000) |
|
39 | EXP_NAME_ESP = numpy.uint32(0x00200000) | |
33 | CHANNEL_NAMES_ESP = numpy.uint32(0x00400000) |
|
40 | CHANNEL_NAMES_ESP = numpy.uint32(0x00400000) | |
34 |
|
41 | |||
35 | OPERATION_MASK = numpy.uint32(0x0000003F) |
|
42 | OPERATION_MASK = numpy.uint32(0x0000003F) | |
36 | DATATYPE_MASK = numpy.uint32(0x00000FC0) |
|
43 | DATATYPE_MASK = numpy.uint32(0x00000FC0) | |
37 | DATAARRANGE_MASK = numpy.uint32(0x00007000) |
|
44 | DATAARRANGE_MASK = numpy.uint32(0x00007000) | |
38 | ACQ_SYS_MASK = numpy.uint32(0x001C0000) |
|
45 | ACQ_SYS_MASK = numpy.uint32(0x001C0000) | |
39 |
|
46 | |||
40 | class BasicHeader: |
|
47 | class BasicHeader: | |
41 |
|
48 | |||
42 | size = 0 |
|
49 | size = 0 | |
43 | version = 0 |
|
50 | version = 0 | |
44 | dataBlock = 0 |
|
51 | dataBlock = 0 | |
45 | utc = 0 |
|
52 | utc = 0 | |
46 | miliSecond = 0 |
|
53 | miliSecond = 0 | |
47 | timeZone = 0 |
|
54 | timeZone = 0 | |
48 | dstFlag = 0 |
|
55 | dstFlag = 0 | |
49 | errorCount = 0 |
|
56 | errorCount = 0 | |
50 | struct = numpy.dtype([ |
|
57 | struct = numpy.dtype([ | |
51 | ('nSize','<u4'), |
|
58 | ('nSize','<u4'), | |
52 | ('nVersion','<u2'), |
|
59 | ('nVersion','<u2'), | |
53 | ('nDataBlockId','<u4'), |
|
60 | ('nDataBlockId','<u4'), | |
54 | ('nUtime','<u4'), |
|
61 | ('nUtime','<u4'), | |
55 | ('nMilsec','<u2'), |
|
62 | ('nMilsec','<u2'), | |
56 | ('nTimezone','<i2'), |
|
63 | ('nTimezone','<i2'), | |
57 | ('nDstflag','<i2'), |
|
64 | ('nDstflag','<i2'), | |
58 | ('nErrorCount','<u4') |
|
65 | ('nErrorCount','<u4') | |
59 | ]) |
|
66 | ]) | |
60 |
|
67 | |||
61 | def __init__(self): |
|
68 | def __init__(self): | |
62 | pass |
|
69 | pass | |
63 |
|
70 | |||
64 | def read(self, fp): |
|
71 | def read(self, fp): | |
65 |
|
72 | |||
66 | header = numpy.fromfile(fp, self.struct,1) |
|
73 | header = numpy.fromfile(fp, self.struct,1) | |
67 | self.size = header['nSize'][0] |
|
74 | self.size = header['nSize'][0] | |
68 | self.version = header['nVersion'][0] |
|
75 | self.version = header['nVersion'][0] | |
69 | self.dataBlock = header['nDataBlockId'][0] |
|
76 | self.dataBlock = header['nDataBlockId'][0] | |
70 | self.utc = header['nUtime'][0] |
|
77 | self.utc = header['nUtime'][0] | |
71 | self.miliSecond = header['nMilsec'][0] |
|
78 | self.miliSecond = header['nMilsec'][0] | |
72 | self.timeZone = header['nTimezone'][0] |
|
79 | self.timeZone = header['nTimezone'][0] | |
73 | self.dstFlag = header['nDstflag'][0] |
|
80 | self.dstFlag = header['nDstflag'][0] | |
74 | self.errorCount = header['nErrorCount'][0] |
|
81 | self.errorCount = header['nErrorCount'][0] | |
75 |
|
82 | |||
76 | return 1 |
|
83 | return 1 | |
77 |
|
84 | |||
78 | def copy(self): |
|
85 | def copy(self): | |
79 |
|
86 | |||
80 | obj = BasicHeader() |
|
87 | obj = BasicHeader() | |
81 | obj.size = self.size |
|
88 | obj.size = self.size | |
82 | obj.version = self.version |
|
89 | obj.version = self.version | |
83 | obj.dataBlock = self.dataBlock |
|
90 | obj.dataBlock = self.dataBlock | |
84 | obj.utc = self.utc |
|
91 | obj.utc = self.utc | |
85 | obj.miliSecond = self.miliSecond |
|
92 | obj.miliSecond = self.miliSecond | |
86 | obj.timeZone = self.timeZone |
|
93 | obj.timeZone = self.timeZone | |
87 | obj.dstFlag = self.dstFlag |
|
94 | obj.dstFlag = self.dstFlag | |
88 | obj.errorCount = self.errorCount |
|
95 | obj.errorCount = self.errorCount | |
89 |
|
96 | |||
90 | return obj |
|
97 | return obj | |
91 |
|
98 | |||
92 | class SystemHeader: |
|
99 | class SystemHeader: | |
93 | size = 0 |
|
100 | size = 0 | |
94 | numSamples = 0 |
|
101 | numSamples = 0 | |
95 | numProfiles = 0 |
|
102 | numProfiles = 0 | |
96 | numChannels = 0 |
|
103 | numChannels = 0 | |
97 | adcResolution = 0 |
|
104 | adcResolution = 0 | |
98 | pciDioBusWidth = 0 |
|
105 | pciDioBusWidth = 0 | |
99 | struct = numpy.dtype([ |
|
106 | struct = numpy.dtype([ | |
100 | ('nSize','<u4'), |
|
107 | ('nSize','<u4'), | |
101 | ('nNumSamples','<u4'), |
|
108 | ('nNumSamples','<u4'), | |
102 | ('nNumProfiles','<u4'), |
|
109 | ('nNumProfiles','<u4'), | |
103 | ('nNumChannels','<u4'), |
|
110 | ('nNumChannels','<u4'), | |
104 | ('nADCResolution','<u4'), |
|
111 | ('nADCResolution','<u4'), | |
105 | ('nPCDIOBusWidth','<u4'), |
|
112 | ('nPCDIOBusWidth','<u4'), | |
106 | ]) |
|
113 | ]) | |
107 |
|
114 | |||
108 | def __init__(self): |
|
115 | def __init__(self): | |
109 | pass |
|
116 | pass | |
110 |
|
117 | |||
111 | def read(self, fp): |
|
118 | def read(self, fp): | |
112 | header = numpy.fromfile(fp,self.struct,1) |
|
119 | header = numpy.fromfile(fp,self.struct,1) | |
113 | self.size = header['nSize'][0] |
|
120 | self.size = header['nSize'][0] | |
114 | self.numSamples = header['nNumSamples'][0] |
|
121 | self.numSamples = header['nNumSamples'][0] | |
115 | self.numProfiles = header['nNumProfiles'][0] |
|
122 | self.numProfiles = header['nNumProfiles'][0] | |
116 | self.numChannels = header['nNumChannels'][0] |
|
123 | self.numChannels = header['nNumChannels'][0] | |
117 | self.adcResolution = header['nADCResolution'][0] |
|
124 | self.adcResolution = header['nADCResolution'][0] | |
118 | self.pciDioBusWidth = header['nPCDIOBusWidth'][0] |
|
125 | self.pciDioBusWidth = header['nPCDIOBusWidth'][0] | |
119 |
|
126 | |||
120 |
|
127 | |||
121 | return 1 |
|
128 | return 1 | |
122 |
|
129 | |||
123 | def copy(self): |
|
130 | def copy(self): | |
124 |
|
131 | |||
125 | obj = SystemHeader() |
|
132 | obj = SystemHeader() | |
126 | obj.size = self.size |
|
133 | obj.size = self.size | |
127 | obj.numSamples = self.numSamples |
|
134 | obj.numSamples = self.numSamples | |
128 | obj.numProfiles = self.numProfiles |
|
135 | obj.numProfiles = self.numProfiles | |
129 | obj.numChannels = self.numChannels |
|
136 | obj.numChannels = self.numChannels | |
130 | obj.adcResolution = self.adcResolution |
|
137 | obj.adcResolution = self.adcResolution | |
131 | self.pciDioBusWidth = self.pciDioBusWidth |
|
138 | self.pciDioBusWidth = self.pciDioBusWidth | |
132 |
|
139 | |||
133 |
|
140 | |||
134 | return obj |
|
141 | return obj | |
135 |
|
142 | |||
136 | class RadarControllerHeader: |
|
143 | class RadarControllerHeader: | |
137 | size = 0 |
|
144 | size = 0 | |
138 | expType = 0 |
|
145 | expType = 0 | |
139 | nTx = 0 |
|
146 | nTx = 0 | |
140 | ipp = 0 |
|
147 | ipp = 0 | |
141 | txA = 0 |
|
148 | txA = 0 | |
142 | txB = 0 |
|
149 | txB = 0 | |
143 | numWindows = 0 |
|
150 | numWindows = 0 | |
144 | numTaus = 0 |
|
151 | numTaus = 0 | |
145 | codeType = 0 |
|
152 | codeType = 0 | |
146 | line6Function = 0 |
|
153 | line6Function = 0 | |
147 | line5Fuction = 0 |
|
154 | line5Fuction = 0 | |
148 | fClock = 0 |
|
155 | fClock = 0 | |
149 | prePulseBefore = 0 |
|
156 | prePulseBefore = 0 | |
150 | prePulserAfter = 0 |
|
157 | prePulserAfter = 0 | |
151 | rangeIpp = 0 |
|
158 | rangeIpp = 0 | |
152 | rangeTxA = 0 |
|
159 | rangeTxA = 0 | |
153 | rangeTxB = 0 |
|
160 | rangeTxB = 0 | |
154 | struct = numpy.dtype([ |
|
161 | struct = numpy.dtype([ | |
155 | ('nSize','<u4'), |
|
162 | ('nSize','<u4'), | |
156 | ('nExpType','<u4'), |
|
163 | ('nExpType','<u4'), | |
157 | ('nNTx','<u4'), |
|
164 | ('nNTx','<u4'), | |
158 | ('fIpp','<f4'), |
|
165 | ('fIpp','<f4'), | |
159 | ('fTxA','<f4'), |
|
166 | ('fTxA','<f4'), | |
160 | ('fTxB','<f4'), |
|
167 | ('fTxB','<f4'), | |
161 | ('nNumWindows','<u4'), |
|
168 | ('nNumWindows','<u4'), | |
162 | ('nNumTaus','<u4'), |
|
169 | ('nNumTaus','<u4'), | |
163 | ('nCodeType','<u4'), |
|
170 | ('nCodeType','<u4'), | |
164 | ('nLine6Function','<u4'), |
|
171 | ('nLine6Function','<u4'), | |
165 | ('nLine5Function','<u4'), |
|
172 | ('nLine5Function','<u4'), | |
166 | ('fClock','<f4'), |
|
173 | ('fClock','<f4'), | |
167 | ('nPrePulseBefore','<u4'), |
|
174 | ('nPrePulseBefore','<u4'), | |
168 | ('nPrePulseAfter','<u4'), |
|
175 | ('nPrePulseAfter','<u4'), | |
169 | ('sRangeIPP','<a20'), |
|
176 | ('sRangeIPP','<a20'), | |
170 | ('sRangeTxA','<a20'), |
|
177 | ('sRangeTxA','<a20'), | |
171 | ('sRangeTxB','<a20'), |
|
178 | ('sRangeTxB','<a20'), | |
172 | ]) |
|
179 | ]) | |
173 |
|
180 | |||
174 |
|
181 | |||
175 | def __init__(self): |
|
182 | def __init__(self): | |
176 | pass |
|
183 | pass | |
177 |
|
184 | |||
178 | def read(self, fp): |
|
185 | def read(self, fp): | |
179 | header = numpy.fromfile(fp,self.struct,1) |
|
186 | header = numpy.fromfile(fp,self.struct,1) | |
180 | self.size = header['nSize'][0] |
|
187 | self.size = header['nSize'][0] | |
181 | self.expType = header['nExpType'][0] |
|
188 | self.expType = header['nExpType'][0] | |
182 | self.nTx = header['nNTx'][0] |
|
189 | self.nTx = header['nNTx'][0] | |
183 | self.ipp = header['fIpp'][0] |
|
190 | self.ipp = header['fIpp'][0] | |
184 | self.txA = header['fTxA'][0] |
|
191 | self.txA = header['fTxA'][0] | |
185 | self.txB = header['fTxB'][0] |
|
192 | self.txB = header['fTxB'][0] | |
186 | self.numWindows = header['nNumWindows'][0] |
|
193 | self.numWindows = header['nNumWindows'][0] | |
187 | self.numTaus = header['nNumTaus'][0] |
|
194 | self.numTaus = header['nNumTaus'][0] | |
188 | self.codeType = header['nCodeType'][0] |
|
195 | self.codeType = header['nCodeType'][0] | |
189 | self.line6Function = header['nLine6Function'][0] |
|
196 | self.line6Function = header['nLine6Function'][0] | |
190 | self.line5Fuction = header['nLine5Function'][0] |
|
197 | self.line5Fuction = header['nLine5Function'][0] | |
191 | self.fClock = header['fClock'][0] |
|
198 | self.fClock = header['fClock'][0] | |
192 | self.prePulseBefore = header['nPrePulseBefore'][0] |
|
199 | self.prePulseBefore = header['nPrePulseBefore'][0] | |
193 | self.prePulserAfter = header['nPrePulseAfter'][0] |
|
200 | self.prePulserAfter = header['nPrePulseAfter'][0] | |
194 | self.rangeIpp = header['sRangeIPP'][0] |
|
201 | self.rangeIpp = header['sRangeIPP'][0] | |
195 | self.rangeTxA = header['sRangeTxA'][0] |
|
202 | self.rangeTxA = header['sRangeTxA'][0] | |
196 | self.rangeTxB = header['sRangeTxB'][0] |
|
203 | self.rangeTxB = header['sRangeTxB'][0] | |
197 | # jump Dynamic Radar Controller Header |
|
204 | # jump Dynamic Radar Controller Header | |
198 | jumpHeader = self.size - 116 |
|
205 | jumpHeader = self.size - 116 | |
199 | fp.seek(fp.tell() + jumpHeader) |
|
206 | fp.seek(fp.tell() + jumpHeader) | |
200 |
|
207 | |||
201 | return 1 |
|
208 | return 1 | |
202 |
|
209 | |||
203 | def copy(self): |
|
210 | def copy(self): | |
204 |
|
211 | |||
205 | obj = RadarControllerHeader() |
|
212 | obj = RadarControllerHeader() | |
206 | obj.size = self.size |
|
213 | obj.size = self.size | |
207 | obj.expType = self.expType |
|
214 | obj.expType = self.expType | |
208 | obj.nTx = self.nTx |
|
215 | obj.nTx = self.nTx | |
209 | obj.ipp = self.ipp |
|
216 | obj.ipp = self.ipp | |
210 | obj.txA = self.txA |
|
217 | obj.txA = self.txA | |
211 | obj.txB = self.txB |
|
218 | obj.txB = self.txB | |
212 | obj.numWindows = self.numWindows |
|
219 | obj.numWindows = self.numWindows | |
213 | obj.numTaus = self.numTaus |
|
220 | obj.numTaus = self.numTaus | |
214 | obj.codeType = self.codeType |
|
221 | obj.codeType = self.codeType | |
215 | obj.line6Function = self.line6Function |
|
222 | obj.line6Function = self.line6Function | |
216 | obj.line5Fuction = self.line5Fuction |
|
223 | obj.line5Fuction = self.line5Fuction | |
217 | obj.fClock = self.fClock |
|
224 | obj.fClock = self.fClock | |
218 | obj.prePulseBefore = self.prePulseBefore |
|
225 | obj.prePulseBefore = self.prePulseBefore | |
219 | obj.prePulserAfter = self.prePulserAfter |
|
226 | obj.prePulserAfter = self.prePulserAfter | |
220 | obj.rangeIpp = self.rangeIpp |
|
227 | obj.rangeIpp = self.rangeIpp | |
221 | obj.rangeTxA = self.rangeTxA |
|
228 | obj.rangeTxA = self.rangeTxA | |
222 | obj.rangeTxB = self.rangeTxB |
|
229 | obj.rangeTxB = self.rangeTxB | |
223 |
|
230 | |||
224 | return obj |
|
231 | return obj | |
225 |
|
232 | |||
226 | class ProcessingHeader: |
|
233 | class ProcessingHeader: | |
227 | size = 0 |
|
234 | size = 0 | |
228 | dataType = 0 |
|
235 | dataType = 0 | |
229 | blockSize = 0 |
|
236 | blockSize = 0 | |
230 | profilesPerBlock = 0 |
|
237 | profilesPerBlock = 0 | |
231 | dataBlocksPerFile = 0 |
|
238 | dataBlocksPerFile = 0 | |
232 | numWindows = 0 |
|
239 | numWindows = 0 | |
233 | processFlags = 0 |
|
240 | processFlags = 0 | |
234 | coherentInt = 0 |
|
241 | coherentInt = 0 | |
235 | incoherentInt = 0 |
|
242 | incoherentInt = 0 | |
236 | totalSpectra = 0 |
|
243 | totalSpectra = 0 | |
237 | struct = numpy.dtype([ |
|
244 | struct = numpy.dtype([ | |
238 | ('nSize','<u4'), |
|
245 | ('nSize','<u4'), | |
239 | ('nDataType','<u4'), |
|
246 | ('nDataType','<u4'), | |
240 | ('nSizeOfDataBlock','<u4'), |
|
247 | ('nSizeOfDataBlock','<u4'), | |
241 | ('nProfilesperBlock','<u4'), |
|
248 | ('nProfilesperBlock','<u4'), | |
242 | ('nDataBlocksperFile','<u4'), |
|
249 | ('nDataBlocksperFile','<u4'), | |
243 | ('nNumWindows','<u4'), |
|
250 | ('nNumWindows','<u4'), | |
244 | ('nProcessFlags','<u4'), |
|
251 | ('nProcessFlags','<u4'), | |
245 | ('nCoherentIntegrations','<u4'), |
|
252 | ('nCoherentIntegrations','<u4'), | |
246 | ('nIncoherentIntegrations','<u4'), |
|
253 | ('nIncoherentIntegrations','<u4'), | |
247 | ('nTotalSpectra','<u4') |
|
254 | ('nTotalSpectra','<u4') | |
248 | ]) |
|
255 | ]) | |
249 | samplingWindow = 0 |
|
256 | samplingWindow = 0 | |
250 | structSamplingWindow = numpy.dtype([('h0','<f4'),('dh','<f4'),('nsa','<u4')]) |
|
257 | structSamplingWindow = numpy.dtype([('h0','<f4'),('dh','<f4'),('nsa','<u4')]) | |
251 | numHeights = 0 |
|
258 | numHeights = 0 | |
252 | firstHeight = 0 |
|
259 | firstHeight = 0 | |
253 | deltaHeight = 0 |
|
260 | deltaHeight = 0 | |
254 | samplesWin = 0 |
|
261 | samplesWin = 0 | |
255 | spectraComb = 0 |
|
262 | spectraComb = 0 | |
256 | numCode = 0 |
|
263 | numCode = 0 | |
257 | codes = 0 |
|
264 | codes = 0 | |
258 | numBaud = 0 |
|
265 | numBaud = 0 | |
259 |
|
266 | |||
260 | def __init__(self): |
|
267 | def __init__(self): | |
261 | pass |
|
268 | pass | |
262 |
|
269 | |||
263 | def read(self, fp): |
|
270 | def read(self, fp): | |
264 | header = numpy.fromfile(fp,self.struct,1) |
|
271 | header = numpy.fromfile(fp,self.struct,1) | |
265 | self.size = header['nSize'][0] |
|
272 | self.size = header['nSize'][0] | |
266 | self.dataType = header['nDataType'][0] |
|
273 | self.dataType = header['nDataType'][0] | |
267 | self.blockSize = header['nSizeOfDataBlock'][0] |
|
274 | self.blockSize = header['nSizeOfDataBlock'][0] | |
268 | self.profilesPerBlock = header['nProfilesperBlock'][0] |
|
275 | self.profilesPerBlock = header['nProfilesperBlock'][0] | |
269 | self.dataBlocksPerFile = header['nDataBlocksperFile'][0] |
|
276 | self.dataBlocksPerFile = header['nDataBlocksperFile'][0] | |
270 | self.numWindows = header['nNumWindows'][0] |
|
277 | self.numWindows = header['nNumWindows'][0] | |
271 | self.processFlags = header['nProcessFlags'] |
|
278 | self.processFlags = header['nProcessFlags'] | |
272 | self.coherentInt = header['nCoherentIntegrations'][0] |
|
279 | self.coherentInt = header['nCoherentIntegrations'][0] | |
273 | self.incoherentInt = header['nIncoherentIntegrations'][0] |
|
280 | self.incoherentInt = header['nIncoherentIntegrations'][0] | |
274 | self.totalSpectra = header['nTotalSpectra'][0] |
|
281 | self.totalSpectra = header['nTotalSpectra'][0] | |
275 | self.samplingWindow = numpy.fromfile(fp,self.structSamplingWindow,self.numWindows) |
|
282 | self.samplingWindow = numpy.fromfile(fp,self.structSamplingWindow,self.numWindows) | |
276 | self.numHeights = numpy.sum(self.samplingWindow['nsa']) |
|
283 | self.numHeights = numpy.sum(self.samplingWindow['nsa']) | |
277 | self.firstHeight = self.samplingWindow['h0'] |
|
284 | self.firstHeight = self.samplingWindow['h0'] | |
278 | self.deltaHeight = self.samplingWindow['dh'] |
|
285 | self.deltaHeight = self.samplingWindow['dh'] | |
279 | self.samplesWin = self.samplingWindow['nsa'] |
|
286 | self.samplesWin = self.samplingWindow['nsa'] | |
280 | self.spectraComb = numpy.fromfile(fp,'u1',2*self.totalSpectra) |
|
287 | self.spectraComb = numpy.fromfile(fp,'u1',2*self.totalSpectra) | |
281 | if self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE == PROCFLAG.DEFINE_PROCESS_CODE: |
|
288 | if self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE == PROCFLAG.DEFINE_PROCESS_CODE: | |
282 | self.numCode = numpy.fromfile(fp,'<u4',1) |
|
289 | self.numCode = numpy.fromfile(fp,'<u4',1) | |
283 | self.numBaud = numpy.fromfile(fp,'<u4',1) |
|
290 | self.numBaud = numpy.fromfile(fp,'<u4',1) | |
284 | self.codes = numpy.fromfile(fp,'<f4',self.numCode*self.numBaud).reshape(self.numBaud,self.numCode) |
|
291 | self.codes = numpy.fromfile(fp,'<f4',self.numCode*self.numBaud).reshape(self.numBaud,self.numCode) | |
285 |
|
292 | |||
286 |
|
293 | |||
287 | return 1 |
|
294 | return 1 | |
288 |
|
295 | |||
289 | def copy(self): |
|
296 | def copy(self): | |
290 |
|
297 | |||
291 | obj = ProcessingHeader() |
|
298 | obj = ProcessingHeader() | |
292 | obj.size = self.size |
|
299 | obj.size = self.size | |
293 | obj.dataType = self.dataType |
|
300 | obj.dataType = self.dataType | |
294 | obj.blockSize = self.blockSize |
|
301 | obj.blockSize = self.blockSize | |
295 | obj.profilesPerBlock = self.profilesPerBlock |
|
302 | obj.profilesPerBlock = self.profilesPerBlock | |
296 | obj.dataBlocksPerFile = self.dataBlocksPerFile |
|
303 | obj.dataBlocksPerFile = self.dataBlocksPerFile | |
297 | obj.numWindows = self.numWindows |
|
304 | obj.numWindows = self.numWindows | |
298 | obj.processFlags = self.processFlags |
|
305 | obj.processFlags = self.processFlags | |
299 | obj.coherentInt = self.coherentInt |
|
306 | obj.coherentInt = self.coherentInt | |
300 | obj.incoherentInt = self.incoherentInt |
|
307 | obj.incoherentInt = self.incoherentInt | |
301 | obj.totalSpectra = self.totalSpectra |
|
308 | obj.totalSpectra = self.totalSpectra | |
302 | obj.samplingWindow = self.samplingWindow |
|
309 | obj.samplingWindow = self.samplingWindow | |
303 | obj.numHeights = self.numHeights |
|
310 | obj.numHeights = self.numHeights | |
304 | obj.firstHeight = self.firstHeight |
|
311 | obj.firstHeight = self.firstHeight | |
305 | obj.deltaHeight = self.deltaHeight |
|
312 | obj.deltaHeight = self.deltaHeight | |
306 | obj.samplesWin = self.samplesWin |
|
313 | obj.samplesWin = self.samplesWin | |
307 | obj.spectraComb = self.spectraComb |
|
314 | obj.spectraComb = self.spectraComb | |
308 | obj.numCode = self.numCode |
|
315 | obj.numCode = self.numCode | |
309 | obj.numBaud = self.numBaud |
|
316 | obj.numBaud = self.numBaud | |
310 | obj.codes = self.codes |
|
317 | obj.codes = self.codes | |
311 |
|
318 | |||
312 | return obj No newline at end of file |
|
319 | return obj |
@@ -1,19 +1,20 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on 23/01/2012 |
|
2 | Created on 23/01/2012 | |
3 |
|
3 | |||
4 | @author: danielangelsuarezmunoz |
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |||
5 | ''' |
|
6 | ''' | |
6 |
|
7 | |||
7 | from Header import * |
|
8 | from Header import * | |
8 | from Data import DataReader |
|
9 | from Data import DataReader | |
9 | from Data import DataWriter |
|
10 | from Data import DataWriter | |
10 |
|
11 | |||
11 |
|
12 | |||
12 | class SpectraReader(DataReader): |
|
13 | class SpectraReader(DataReader): | |
13 | def __init__(self): |
|
14 | def __init__(self): | |
14 | pass |
|
15 | pass | |
15 |
|
16 | |||
16 | class SpectraWriter(DataWriter): |
|
17 | class SpectraWriter(DataWriter): | |
17 | def __init__(self): |
|
18 | def __init__(self): | |
18 | pass |
|
19 | pass | |
19 |
|
20 |
@@ -1,49 +1,50 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on 23/01/2012 |
|
2 | Created on 23/01/2012 | |
3 |
|
3 | |||
4 | @author: danielangelsuarezmunoz |
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |||
5 | ''' |
|
6 | ''' | |
6 | import os |
|
7 | import os | |
7 | import sys |
|
8 | import sys | |
8 | import datetime |
|
9 | import datetime | |
9 | import time |
|
10 | import time | |
10 |
|
11 | |||
11 | class TestIO(): |
|
12 | class TestIO(): | |
12 |
|
13 | |||
13 | def __init__(self): |
|
14 | def __init__(self): | |
14 | self.setValues() |
|
15 | self.setValues() | |
15 | self.createVoltageObjects() |
|
16 | self.createVoltageObjects() | |
16 | self.testReadVoltage() |
|
17 | self.testReadVoltage() | |
17 | pass |
|
18 | pass | |
18 |
|
19 | |||
19 | def setValues(self): |
|
20 | def setValues(self): | |
20 |
|
21 | |||
21 |
|
22 | |||
22 | self.path = '/Users/danielangelsuarezmunoz/Documents/Projects' |
|
23 | self.path = '/Users/danielangelsuarezmunoz/Documents/Projects' | |
23 | self.startDateTime = datetime.datetime(2007,5,1,17,49,0) |
|
24 | self.startDateTime = datetime.datetime(2007,5,1,17,49,0) | |
24 | self.endDateTime = datetime.datetime(2007,5,1,18,10,0) |
|
25 | self.endDateTime = datetime.datetime(2007,5,1,18,10,0) | |
25 |
|
26 | |||
26 | def createVoltageObjects(self): |
|
27 | def createVoltageObjects(self): | |
27 | path = os.path.split(os.getcwd())[0] |
|
28 | path = os.path.split(os.getcwd())[0] | |
28 | sys.path.append(path) |
|
29 | sys.path.append(path) | |
29 |
|
30 | |||
30 | from IO.Voltage import VoltageReader |
|
31 | from IO.Voltage import VoltageReader | |
31 | from Model.Voltage import Voltage |
|
32 | from Model.Voltage import Voltage | |
32 |
|
33 | |||
33 | self.voltageModelObj = Voltage() |
|
34 | self.voltageModelObj = Voltage() | |
34 | self.voltageReaderObj = VoltageReader(self.voltageModelObj) |
|
35 | self.voltageReaderObj = VoltageReader(self.voltageModelObj) | |
35 | self.voltageReaderObj.setup(self.path, self.startDateTime, self.endDateTime) |
|
36 | self.voltageReaderObj.setup(self.path, self.startDateTime, self.endDateTime) | |
36 |
|
37 | |||
37 | def testReadVoltage(self): |
|
38 | def testReadVoltage(self): | |
38 | while(not(self.voltageReaderObj.noMoreFiles)): |
|
39 | while(not(self.voltageReaderObj.noMoreFiles)): | |
39 |
|
40 | |||
40 | self.voltageReaderObj.getData() |
|
41 | self.voltageReaderObj.getData() | |
41 | if self.voltageReaderObj.flagResetProcessing: |
|
42 | if self.voltageReaderObj.flagResetProcessing: | |
42 | print 'jump' |
|
43 | print 'jump' | |
43 |
|
44 | |||
44 | if self.voltageReaderObj.flagIsNewBlock: |
|
45 | if self.voltageReaderObj.flagIsNewBlock: | |
45 | print 'Block No %04d, Time: %s'%(self.voltageReaderObj.nReadBlocks, |
|
46 | print 'Block No %04d, Time: %s'%(self.voltageReaderObj.nReadBlocks, | |
46 | datetime.datetime.fromtimestamp(self.voltageReaderObj.m_BasicHeader.utc)) |
|
47 | datetime.datetime.fromtimestamp(self.voltageReaderObj.m_BasicHeader.utc)) | |
47 |
|
48 | |||
48 | if __name__ == '__main__': |
|
49 | if __name__ == '__main__': | |
49 | TestIO() No newline at end of file |
|
50 | TestIO() |
@@ -1,459 +1,459 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on 23/01/2012 |
|
2 | Created on 23/01/2012 | |
3 |
|
3 | |||
4 | @author: danielangelsuarezmunoz |
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |||
5 | ''' |
|
6 | ''' | |
6 |
|
7 | |||
7 |
|
||||
8 | import os, sys |
|
8 | import os, sys | |
9 | import numpy |
|
9 | import numpy | |
10 | import glob |
|
10 | import glob | |
11 | import fnmatch |
|
11 | import fnmatch | |
12 | import time |
|
12 | import time | |
13 | import datetime |
|
13 | import datetime | |
14 |
|
14 | |||
15 | from IO.Header import * |
|
15 | from IO.Header import * | |
16 | from IO.Data import DataReader |
|
16 | from IO.Data import DataReader | |
17 | from IO.Data import DataWriter |
|
17 | from IO.Data import DataWriter | |
18 |
|
18 | |||
19 | path = os.path.split(os.getcwd())[0] |
|
19 | path = os.path.split(os.getcwd())[0] | |
20 | sys.path.append(path) |
|
20 | sys.path.append(path) | |
21 |
|
21 | |||
22 | from Model.Voltage import Voltage |
|
22 | from Model.Voltage import Voltage | |
23 |
|
23 | |||
24 | class VoltageReader(DataReader): |
|
24 | class VoltageReader(DataReader): | |
25 |
|
25 | |||
26 | __idFile = None |
|
26 | __idFile = None | |
27 |
|
27 | |||
28 | __fp = None |
|
28 | __fp = None | |
29 |
|
29 | |||
30 | __startDateTime = None |
|
30 | __startDateTime = None | |
31 |
|
31 | |||
32 | __endDateTime = None |
|
32 | __endDateTime = None | |
33 |
|
33 | |||
34 | __dataType = None |
|
34 | __dataType = None | |
35 |
|
35 | |||
36 | __fileSizeByHeader = 0 |
|
36 | __fileSizeByHeader = 0 | |
37 |
|
37 | |||
38 | __pathList = [] |
|
38 | __pathList = [] | |
39 |
|
39 | |||
40 | filenameList = [] |
|
40 | filenameList = [] | |
41 |
|
41 | |||
42 | __lastUTTime = 0 |
|
42 | __lastUTTime = 0 | |
43 |
|
43 | |||
44 | __maxTimeStep = 5 |
|
44 | __maxTimeStep = 5 | |
45 |
|
45 | |||
46 | __flagIsNewFile = 0 |
|
46 | __flagIsNewFile = 0 | |
47 |
|
47 | |||
48 | __ippSeconds = 0 |
|
48 | __ippSeconds = 0 | |
49 |
|
49 | |||
50 | flagResetProcessing = 0 |
|
50 | flagResetProcessing = 0 | |
51 |
|
51 | |||
52 | flagIsNewBlock = 0 |
|
52 | flagIsNewBlock = 0 | |
53 |
|
53 | |||
54 | noMoreFiles = 0 |
|
54 | noMoreFiles = 0 | |
55 |
|
55 | |||
56 | nReadBlocks = 0 |
|
56 | nReadBlocks = 0 | |
57 |
|
57 | |||
58 | online = 0 |
|
58 | online = 0 | |
59 |
|
59 | |||
60 | filename = None |
|
60 | filename = None | |
61 |
|
61 | |||
62 | fileSize = None |
|
62 | fileSize = None | |
63 |
|
63 | |||
64 | firstHeaderSize = 0 |
|
64 | firstHeaderSize = 0 | |
65 |
|
65 | |||
66 | basicHeaderSize = 24 |
|
66 | basicHeaderSize = 24 | |
67 |
|
67 | |||
68 | m_BasicHeader = BasicHeader() |
|
68 | m_BasicHeader = BasicHeader() | |
69 |
|
69 | |||
70 | m_SystemHeader = SystemHeader() |
|
70 | m_SystemHeader = SystemHeader() | |
71 |
|
71 | |||
72 | m_RadarControllerHeader = RadarControllerHeader() |
|
72 | m_RadarControllerHeader = RadarControllerHeader() | |
73 |
|
73 | |||
74 | m_ProcessingHeader = ProcessingHeader() |
|
74 | m_ProcessingHeader = ProcessingHeader() | |
75 |
|
75 | |||
76 | m_Voltage = None |
|
76 | m_Voltage = None | |
77 |
|
77 | |||
78 | __buffer = 0 |
|
78 | __buffer = 0 | |
79 |
|
79 | |||
80 | __buffer_id = 9999 |
|
80 | __buffer_id = 9999 | |
81 |
|
81 | |||
82 | def __init__(self, m_Voltage = None): |
|
82 | def __init__(self, m_Voltage = None): | |
83 |
|
83 | |||
84 | if m_Voltage == None: |
|
84 | if m_Voltage == None: | |
85 | m_Voltage = Voltage() |
|
85 | m_Voltage = Voltage() | |
86 |
|
86 | |||
87 | self.m_Voltage = m_Voltage |
|
87 | self.m_Voltage = m_Voltage | |
88 |
|
88 | |||
89 | def __rdSystemHeader(self,fp=None): |
|
89 | def __rdSystemHeader(self,fp=None): | |
90 | if fp == None: |
|
90 | if fp == None: | |
91 | fp = self.__fp |
|
91 | fp = self.__fp | |
92 |
|
92 | |||
93 | self.m_SystemHeader.read(fp) |
|
93 | self.m_SystemHeader.read(fp) | |
94 |
|
94 | |||
95 | def __rdRadarControllerHeader(self,fp=None): |
|
95 | def __rdRadarControllerHeader(self,fp=None): | |
96 | if fp == None: |
|
96 | if fp == None: | |
97 | fp = self.__fp |
|
97 | fp = self.__fp | |
98 |
|
98 | |||
99 | self.m_RadarControllerHeader.read(fp) |
|
99 | self.m_RadarControllerHeader.read(fp) | |
100 |
|
100 | |||
101 | def __rdProcessingHeader(self,fp=None): |
|
101 | def __rdProcessingHeader(self,fp=None): | |
102 | if fp == None: |
|
102 | if fp == None: | |
103 | fp = self.__fp |
|
103 | fp = self.__fp | |
104 |
|
104 | |||
105 | self.m_ProcessingHeader.read(fp) |
|
105 | self.m_ProcessingHeader.read(fp) | |
106 |
|
106 | |||
107 | def __searchFiles(self,path, startDateTime, endDateTime, set=None, expLabel = "", ext = ".r"): |
|
107 | def __searchFiles(self,path, startDateTime, endDateTime, set=None, expLabel = "", ext = ".r"): | |
108 |
|
108 | |||
109 | print "Searching files ..." |
|
109 | print "Searching files ..." | |
110 |
|
110 | |||
111 | startUtSeconds = time.mktime(startDateTime.timetuple()) |
|
111 | startUtSeconds = time.mktime(startDateTime.timetuple()) | |
112 | endUtSeconds = time.mktime(endDateTime.timetuple()) |
|
112 | endUtSeconds = time.mktime(endDateTime.timetuple()) | |
113 |
|
113 | |||
114 | # startYear = startDateTime.timetuple().tm_year |
|
114 | # startYear = startDateTime.timetuple().tm_year | |
115 | # endYear = endDateTime.timetuple().tm_year |
|
115 | # endYear = endDateTime.timetuple().tm_year | |
116 | # |
|
116 | # | |
117 | # startDoy = startDateTime.timetuple().tm_yday |
|
117 | # startDoy = startDateTime.timetuple().tm_yday | |
118 | # endDoy = endDateTime.timetuple().tm_yday |
|
118 | # endDoy = endDateTime.timetuple().tm_yday | |
119 | # |
|
119 | # | |
120 | # yearRange = range(startYear,endYear+1) |
|
120 | # yearRange = range(startYear,endYear+1) | |
121 | # |
|
121 | # | |
122 | # doyDoubleList = [] |
|
122 | # doyDoubleList = [] | |
123 | # if startYear == endYear: |
|
123 | # if startYear == endYear: | |
124 | # doyList = range(startDoy,endDoy+1) |
|
124 | # doyList = range(startDoy,endDoy+1) | |
125 | # else: |
|
125 | # else: | |
126 | # for year in yearRange: |
|
126 | # for year in yearRange: | |
127 | # if (year == startYear): |
|
127 | # if (year == startYear): | |
128 | # doyDoubleList.append(range(startDoy,365+1)) |
|
128 | # doyDoubleList.append(range(startDoy,365+1)) | |
129 | # elif (year == endYear): |
|
129 | # elif (year == endYear): | |
130 | # doyDoubleList.append(range(1,endDoy+1)) |
|
130 | # doyDoubleList.append(range(1,endDoy+1)) | |
131 | # else: |
|
131 | # else: | |
132 | # doyDoubleList.append(range(1,365+1)) |
|
132 | # doyDoubleList.append(range(1,365+1)) | |
133 | # doyList = [] |
|
133 | # doyList = [] | |
134 | # for list in doyDoubleList: |
|
134 | # for list in doyDoubleList: | |
135 | # doyList = doyList + list |
|
135 | # doyList = doyList + list | |
136 | # |
|
136 | # | |
137 | # dirList = [] |
|
137 | # dirList = [] | |
138 | # for thisPath in os.listdir(path): |
|
138 | # for thisPath in os.listdir(path): | |
139 | # if os.path.isdir(os.path.join(path,thisPath)): |
|
139 | # if os.path.isdir(os.path.join(path,thisPath)): | |
140 | # #dirList.append(os.path.join(path,thisPath)) |
|
140 | # #dirList.append(os.path.join(path,thisPath)) | |
141 | # dirList.append(thisPath) |
|
141 | # dirList.append(thisPath) | |
142 | # |
|
142 | # | |
143 | # pathList = [] |
|
143 | # pathList = [] | |
144 | # pathDict = {} |
|
144 | # pathDict = {} | |
145 | # for year in yearRange: |
|
145 | # for year in yearRange: | |
146 | # for doy in doyList: |
|
146 | # for doy in doyList: | |
147 | # match = fnmatch.filter(dirList, 'D' + '%4.4d%3.3d' % (year,doy)) |
|
147 | # match = fnmatch.filter(dirList, 'D' + '%4.4d%3.3d' % (year,doy)) | |
148 | # if len(match) == 0: |
|
148 | # if len(match) == 0: | |
149 | # match = fnmatch.filter(dirList, 'd' + '%4.4d%3.3d' % (year,doy)) |
|
149 | # match = fnmatch.filter(dirList, 'd' + '%4.4d%3.3d' % (year,doy)) | |
150 | # if len(match) == 0: continue |
|
150 | # if len(match) == 0: continue | |
151 | # if expLabel == '': |
|
151 | # if expLabel == '': | |
152 | # pathList.append(os.path.join(path,match[0])) |
|
152 | # pathList.append(os.path.join(path,match[0])) | |
153 | # pathDict.setdefault(os.path.join(path,match[0])) |
|
153 | # pathDict.setdefault(os.path.join(path,match[0])) | |
154 | # pathDict[os.path.join(path,match[0])] = [] |
|
154 | # pathDict[os.path.join(path,match[0])] = [] | |
155 | # else: |
|
155 | # else: | |
156 | # pathList.append(os.path.join(path,os.path.join(match[0],expLabel))) |
|
156 | # pathList.append(os.path.join(path,os.path.join(match[0],expLabel))) | |
157 | # pathDict.setdefault(os.path.join(path,os.path.join(match[0],expLabel))) |
|
157 | # pathDict.setdefault(os.path.join(path,os.path.join(match[0],expLabel))) | |
158 | # pathDict[os.path.join(path,os.path.join(match[0],expLabel))] = [] |
|
158 | # pathDict[os.path.join(path,os.path.join(match[0],expLabel))] = [] | |
159 |
|
159 | |||
160 |
|
160 | |||
161 | dirList = [] |
|
161 | dirList = [] | |
162 | for thisPath in os.listdir(path): |
|
162 | for thisPath in os.listdir(path): | |
163 | if os.path.isdir(os.path.join(path,thisPath)): |
|
163 | if os.path.isdir(os.path.join(path,thisPath)): | |
164 | dirList.append(thisPath) |
|
164 | dirList.append(thisPath) | |
165 |
|
165 | |||
166 | pathList = [] |
|
166 | pathList = [] | |
167 |
|
167 | |||
168 | thisDateTime = startDateTime |
|
168 | thisDateTime = startDateTime | |
169 |
|
169 | |||
170 | while(thisDateTime <= endDateTime): |
|
170 | while(thisDateTime <= endDateTime): | |
171 | year = thisDateTime.timetuple().tm_year |
|
171 | year = thisDateTime.timetuple().tm_year | |
172 | doy = thisDateTime.timetuple().tm_yday |
|
172 | doy = thisDateTime.timetuple().tm_yday | |
173 |
|
173 | |||
174 | match = fnmatch.filter(dirList, '?' + '%4.4d%3.3d' % (year,doy)) |
|
174 | match = fnmatch.filter(dirList, '?' + '%4.4d%3.3d' % (year,doy)) | |
175 | if len(match) == 0: |
|
175 | if len(match) == 0: | |
176 | thisDateTime += datetime.timedelta(1) |
|
176 | thisDateTime += datetime.timedelta(1) | |
177 | continue |
|
177 | continue | |
178 |
|
178 | |||
179 | pathList.append(os.path.join(path,match[0],expLabel)) |
|
179 | pathList.append(os.path.join(path,match[0],expLabel)) | |
180 | thisDateTime += datetime.timedelta(1) |
|
180 | thisDateTime += datetime.timedelta(1) | |
181 |
|
181 | |||
182 | filenameList = [] |
|
182 | filenameList = [] | |
183 | for thisPath in pathList: |
|
183 | for thisPath in pathList: | |
184 | fileList = glob.glob1(thisPath, "*%s" %ext) |
|
184 | fileList = glob.glob1(thisPath, "*%s" %ext) | |
185 | #pathDict[thisPath].append(fileList) |
|
185 | #pathDict[thisPath].append(fileList) | |
186 | fileList.sort() |
|
186 | fileList.sort() | |
187 | for file in fileList: |
|
187 | for file in fileList: | |
188 | filename = os.path.join(thisPath,file) |
|
188 | filename = os.path.join(thisPath,file) | |
189 | if self.isThisFileinRange(filename, startUtSeconds, endUtSeconds): |
|
189 | if self.isThisFileinRange(filename, startUtSeconds, endUtSeconds): | |
190 | filenameList.append(filename) |
|
190 | filenameList.append(filename) | |
191 |
|
191 | |||
192 | self.filenameList = filenameList |
|
192 | self.filenameList = filenameList | |
193 |
|
193 | |||
194 | return pathList, filenameList |
|
194 | return pathList, filenameList | |
195 |
|
195 | |||
196 | def isThisFileinRange(self, filename, startUTSeconds=None, endUTSeconds=None): |
|
196 | def isThisFileinRange(self, filename, startUTSeconds=None, endUTSeconds=None): | |
197 |
|
197 | |||
198 | try: |
|
198 | try: | |
199 | fp = open(filename,'rb') |
|
199 | fp = open(filename,'rb') | |
200 | except: |
|
200 | except: | |
201 | raise IOError, "The file %s can't be opened" %(filename) |
|
201 | raise IOError, "The file %s can't be opened" %(filename) | |
202 |
|
202 | |||
203 | if startUTSeconds==None: |
|
203 | if startUTSeconds==None: | |
204 | startUTSeconds = self.startUTCSeconds |
|
204 | startUTSeconds = self.startUTCSeconds | |
205 |
|
205 | |||
206 | if endUTSeconds==None: |
|
206 | if endUTSeconds==None: | |
207 | endUTSeconds = self.endUTCSeconds |
|
207 | endUTSeconds = self.endUTCSeconds | |
208 |
|
208 | |||
209 | m_BasicHeader = BasicHeader() |
|
209 | m_BasicHeader = BasicHeader() | |
210 |
|
210 | |||
211 | if not(m_BasicHeader.read(fp)): |
|
211 | if not(m_BasicHeader.read(fp)): | |
212 | return 0 |
|
212 | return 0 | |
213 |
|
213 | |||
214 | fp.close() |
|
214 | fp.close() | |
215 |
|
215 | |||
216 | if not ((startUTSeconds <= m_BasicHeader.utc) and (endUTSeconds >= m_BasicHeader.utc)): |
|
216 | if not ((startUTSeconds <= m_BasicHeader.utc) and (endUTSeconds >= m_BasicHeader.utc)): | |
217 | return 0 |
|
217 | return 0 | |
218 |
|
218 | |||
219 | return 1 |
|
219 | return 1 | |
220 |
|
220 | |||
221 | def __readBasicHeader(self, fp=None): |
|
221 | def __readBasicHeader(self, fp=None): | |
222 |
|
222 | |||
223 | if fp == None: |
|
223 | if fp == None: | |
224 | fp = self.__fp |
|
224 | fp = self.__fp | |
225 |
|
225 | |||
226 | self.m_BasicHeader.read(fp) |
|
226 | self.m_BasicHeader.read(fp) | |
227 |
|
227 | |||
228 | def __readFirstHeader(self): |
|
228 | def __readFirstHeader(self): | |
229 |
|
229 | |||
230 | self.__readBasicHeader() |
|
230 | self.__readBasicHeader() | |
231 | self.__rdSystemHeader() |
|
231 | self.__rdSystemHeader() | |
232 | self.__rdRadarControllerHeader() |
|
232 | self.__rdRadarControllerHeader() | |
233 | self.__rdProcessingHeader() |
|
233 | self.__rdProcessingHeader() | |
234 | self.firstHeaderSize = self.m_BasicHeader.size |
|
234 | self.firstHeaderSize = self.m_BasicHeader.size | |
235 |
|
235 | |||
236 | data_type=int(numpy.log2((self.m_ProcessingHeader.processFlags & PROCFLAG.DATATYPE_MASK))-numpy.log2(PROCFLAG.DATATYPE_CHAR)) |
|
236 | data_type=int(numpy.log2((self.m_ProcessingHeader.processFlags & PROCFLAG.DATATYPE_MASK))-numpy.log2(PROCFLAG.DATATYPE_CHAR)) | |
237 | if data_type == 0: |
|
237 | if data_type == 0: | |
238 | tmp=numpy.dtype([('real','<i1'),('imag','<i1')]) |
|
238 | tmp=numpy.dtype([('real','<i1'),('imag','<i1')]) | |
239 | elif data_type == 1: |
|
239 | elif data_type == 1: | |
240 | tmp=numpy.dtype([('real','<i2'),('imag','<i2')]) |
|
240 | tmp=numpy.dtype([('real','<i2'),('imag','<i2')]) | |
241 | elif data_type == 2: |
|
241 | elif data_type == 2: | |
242 | tmp=numpy.dtype([('real','<i4'),('imag','<i4')]) |
|
242 | tmp=numpy.dtype([('real','<i4'),('imag','<i4')]) | |
243 | elif data_type == 3: |
|
243 | elif data_type == 3: | |
244 | tmp=numpy.dtype([('real','<i8'),('imag','<i8')]) |
|
244 | tmp=numpy.dtype([('real','<i8'),('imag','<i8')]) | |
245 | elif data_type == 4: |
|
245 | elif data_type == 4: | |
246 | tmp=numpy.dtype([('real','<f4'),('imag','<f4')]) |
|
246 | tmp=numpy.dtype([('real','<f4'),('imag','<f4')]) | |
247 | elif data_type == 5: |
|
247 | elif data_type == 5: | |
248 | tmp=numpy.dtype([('real','<f8'),('imag','<f8')]) |
|
248 | tmp=numpy.dtype([('real','<f8'),('imag','<f8')]) | |
249 | else: |
|
249 | else: | |
250 | raise ValueError, 'Data type was not defined' |
|
250 | raise ValueError, 'Data type was not defined' | |
251 |
|
251 | |||
252 | self.__dataType = tmp |
|
252 | self.__dataType = tmp | |
253 | self.__fileSizeByHeader = self.m_ProcessingHeader.dataBlocksPerFile * self.m_ProcessingHeader.blockSize + self.firstHeaderSize + self.basicHeaderSize*(self.m_ProcessingHeader.dataBlocksPerFile - 1) |
|
253 | self.__fileSizeByHeader = self.m_ProcessingHeader.dataBlocksPerFile * self.m_ProcessingHeader.blockSize + self.firstHeaderSize + self.basicHeaderSize*(self.m_ProcessingHeader.dataBlocksPerFile - 1) | |
254 | c=3E8 |
|
254 | c=3E8 | |
255 | self.__ippSeconds = 2*1000*self.m_RadarControllerHeader.ipp/c |
|
255 | self.__ippSeconds = 2*1000*self.m_RadarControllerHeader.ipp/c | |
256 |
|
256 | |||
257 | def __setNextFileOnline(self): |
|
257 | def __setNextFileOnline(self): | |
258 | return 0 |
|
258 | return 0 | |
259 |
|
259 | |||
260 | def __setNextFileOffline(self): |
|
260 | def __setNextFileOffline(self): | |
261 |
|
261 | |||
262 | idFile = self.__idFile |
|
262 | idFile = self.__idFile | |
263 | while(True): |
|
263 | while(True): | |
264 |
|
264 | |||
265 | idFile += 1 |
|
265 | idFile += 1 | |
266 |
|
266 | |||
267 | if not(idFile < len(self.filenameList)): |
|
267 | if not(idFile < len(self.filenameList)): | |
268 | self.noMoreFiles = 1 |
|
268 | self.noMoreFiles = 1 | |
269 | return 0 |
|
269 | return 0 | |
270 |
|
270 | |||
271 | filename = self.filenameList[idFile] |
|
271 | filename = self.filenameList[idFile] | |
272 | fileSize = os.path.getsize(filename) |
|
272 | fileSize = os.path.getsize(filename) | |
273 | fp = open(filename,'rb') |
|
273 | fp = open(filename,'rb') | |
274 |
|
274 | |||
275 | currentSize = fileSize - fp.tell() |
|
275 | currentSize = fileSize - fp.tell() | |
276 | neededSize = self.m_ProcessingHeader.blockSize + self.firstHeaderSize |
|
276 | neededSize = self.m_ProcessingHeader.blockSize + self.firstHeaderSize | |
277 |
|
277 | |||
278 | if (currentSize < neededSize): |
|
278 | if (currentSize < neededSize): | |
279 | continue |
|
279 | continue | |
280 |
|
280 | |||
281 | break |
|
281 | break | |
282 |
|
282 | |||
283 | self.__flagIsNewFile = 1 |
|
283 | self.__flagIsNewFile = 1 | |
284 | self.__idFile = idFile |
|
284 | self.__idFile = idFile | |
285 | self.filename = filename |
|
285 | self.filename = filename | |
286 | self.fileSize = fileSize |
|
286 | self.fileSize = fileSize | |
287 | self.__fp = fp |
|
287 | self.__fp = fp | |
288 |
|
288 | |||
289 | print 'Setting the file: %s'%self.filename |
|
289 | print 'Setting the file: %s'%self.filename | |
290 |
|
290 | |||
291 | return 1 |
|
291 | return 1 | |
292 |
|
292 | |||
293 | def __setNextFile(self): |
|
293 | def __setNextFile(self): | |
294 |
|
294 | |||
295 | if self.online: |
|
295 | if self.online: | |
296 | return self.__setNextFileOnline() |
|
296 | return self.__setNextFileOnline() | |
297 | else: |
|
297 | else: | |
298 | return self.__setNextFileOffline() |
|
298 | return self.__setNextFileOffline() | |
299 |
|
299 | |||
300 | def __setNewBlock(self): |
|
300 | def __setNewBlock(self): | |
301 |
|
301 | |||
302 | if self.__fp == None: |
|
302 | if self.__fp == None: | |
303 | return 0 |
|
303 | return 0 | |
304 |
|
304 | |||
305 | if self.__flagIsNewFile: |
|
305 | if self.__flagIsNewFile: | |
306 | return 1 |
|
306 | return 1 | |
307 |
|
307 | |||
308 | currentSize = self.fileSize - self.__fp.tell() |
|
308 | currentSize = self.fileSize - self.__fp.tell() | |
309 | neededSize = self.m_ProcessingHeader.blockSize + self.basicHeaderSize |
|
309 | neededSize = self.m_ProcessingHeader.blockSize + self.basicHeaderSize | |
310 |
|
310 | |||
311 | # Bloque Completo |
|
311 | # Bloque Completo | |
312 | if (currentSize >= neededSize): |
|
312 | if (currentSize >= neededSize): | |
313 | self.__readBasicHeader() |
|
313 | self.__readBasicHeader() | |
314 | return 1 |
|
314 | return 1 | |
315 |
|
315 | |||
316 | if not(self.__setNextFile()): |
|
316 | if not(self.__setNextFile()): | |
317 | return 0 |
|
317 | return 0 | |
318 |
|
318 | |||
319 | self.__readFirstHeader() |
|
319 | self.__readFirstHeader() | |
320 |
|
320 | |||
321 | deltaTime = self.m_BasicHeader.utc - self.__lastUTTime # check this |
|
321 | deltaTime = self.m_BasicHeader.utc - self.__lastUTTime # check this | |
322 |
|
322 | |||
323 | self.flagResetProcessing = 0 |
|
323 | self.flagResetProcessing = 0 | |
324 | if deltaTime > self.__maxTimeStep: |
|
324 | if deltaTime > self.__maxTimeStep: | |
325 | self.flagResetProcessing = 1 |
|
325 | self.flagResetProcessing = 1 | |
326 | self.nReadBlocks = 0 |
|
326 | self.nReadBlocks = 0 | |
327 |
|
327 | |||
328 | return 1 |
|
328 | return 1 | |
329 |
|
329 | |||
330 | def __readBlock(self): |
|
330 | def __readBlock(self): | |
331 | """Lee el bloque de datos desde la posicion actual del puntero del archivo y |
|
331 | """Lee el bloque de datos desde la posicion actual del puntero del archivo y | |
332 | actualiza todos los parametros relacionados al bloque de datos (data, time, |
|
332 | actualiza todos los parametros relacionados al bloque de datos (data, time, | |
333 | etc). La data leida es almacenada en el buffer y el contador de datos leidos es |
|
333 | etc). La data leida es almacenada en el buffer y el contador de datos leidos es | |
334 | seteado a 0 |
|
334 | seteado a 0 | |
335 | """ |
|
335 | """ | |
336 |
|
336 | |||
337 | pts2read = self.m_ProcessingHeader.profilesPerBlock*self.m_ProcessingHeader.numHeights*self.m_SystemHeader.numChannels |
|
337 | pts2read = self.m_ProcessingHeader.profilesPerBlock*self.m_ProcessingHeader.numHeights*self.m_SystemHeader.numChannels | |
338 |
|
338 | |||
339 | data = numpy.fromfile(self.__fp,self.__dataType,pts2read) |
|
339 | data = numpy.fromfile(self.__fp,self.__dataType,pts2read) | |
340 |
|
340 | |||
341 | data = data.reshape((self.m_ProcessingHeader.profilesPerBlock, self.m_ProcessingHeader.numHeights, self.m_SystemHeader.numChannels)) |
|
341 | data = data.reshape((self.m_ProcessingHeader.profilesPerBlock, self.m_ProcessingHeader.numHeights, self.m_SystemHeader.numChannels)) | |
342 |
|
342 | |||
343 | self.__flagIsNewFile = 0 |
|
343 | self.__flagIsNewFile = 0 | |
344 |
|
344 | |||
345 | self.flagIsNewBlock = 1 |
|
345 | self.flagIsNewBlock = 1 | |
346 |
|
346 | |||
347 | self.nReadBlocks += 1 |
|
347 | self.nReadBlocks += 1 | |
348 |
|
348 | |||
349 | self.__buffer = data |
|
349 | self.__buffer = data | |
350 |
|
350 | |||
351 | self.__buffer_id = 0 |
|
351 | self.__buffer_id = 0 | |
352 |
|
352 | |||
353 | def readNextBlock(self): |
|
353 | def readNextBlock(self): | |
354 |
|
354 | |||
355 | if not(self.__setNewBlock()): |
|
355 | if not(self.__setNewBlock()): | |
356 | return 0 |
|
356 | return 0 | |
357 |
|
357 | |||
358 | self.__readBlock() |
|
358 | self.__readBlock() | |
359 |
|
359 | |||
360 | self.__lastUTTime = self.m_BasicHeader.utc |
|
360 | self.__lastUTTime = self.m_BasicHeader.utc | |
361 |
|
361 | |||
362 | return 1 |
|
362 | return 1 | |
363 |
|
363 | |||
364 | def __hasNotDataInBuffer(self): |
|
364 | def __hasNotDataInBuffer(self): | |
365 | if self.__buffer_id >= self.m_ProcessingHeader.profilesPerBlock: |
|
365 | if self.__buffer_id >= self.m_ProcessingHeader.profilesPerBlock: | |
366 | return 1 |
|
366 | return 1 | |
367 |
|
367 | |||
368 | return 0 |
|
368 | return 0 | |
369 |
|
369 | |||
370 | def getData(self): |
|
370 | def getData(self): | |
371 | """Obtiene un unidad de datos del buffer de lectura y es copiada a la clase "Voltage" |
|
371 | """Obtiene un unidad de datos del buffer de lectura y es copiada a la clase "Voltage" | |
372 | con todos los parametros asociados a este. cuando no hay datos en el buffer de |
|
372 | con todos los parametros asociados a este. cuando no hay datos en el buffer de | |
373 | lectura es necesario hacer una nueva lectura de los bloques de datos usando "readNextBlock" |
|
373 | lectura es necesario hacer una nueva lectura de los bloques de datos usando "readNextBlock" | |
374 | """ |
|
374 | """ | |
375 | self.flagResetProcessing = 0 |
|
375 | self.flagResetProcessing = 0 | |
376 | self.flagIsNewBlock = 0 |
|
376 | self.flagIsNewBlock = 0 | |
377 |
|
377 | |||
378 | if self.__hasNotDataInBuffer(): |
|
378 | if self.__hasNotDataInBuffer(): | |
379 | self.readNextBlock() |
|
379 | self.readNextBlock() | |
380 |
|
380 | |||
381 | if self.noMoreFiles == 1: |
|
381 | if self.noMoreFiles == 1: | |
382 | print 'Process finished' |
|
382 | print 'Process finished' | |
383 | return None |
|
383 | return None | |
384 |
|
384 | |||
385 | data = self.__buffer[self.__buffer_id,:,:] |
|
385 | data = self.__buffer[self.__buffer_id,:,:] | |
386 |
|
386 | |||
387 | time = self.m_BasicHeader.utc + self.__buffer_id*self.__ippSeconds |
|
387 | time = self.m_BasicHeader.utc + self.__buffer_id*self.__ippSeconds | |
388 |
|
388 | |||
389 | self.m_Voltage.m_BasicHeader = self.m_BasicHeader.copy() |
|
389 | self.m_Voltage.m_BasicHeader = self.m_BasicHeader.copy() | |
390 | self.m_Voltage.m_ProcessingHeader = self.m_ProcessingHeader.copy() |
|
390 | self.m_Voltage.m_ProcessingHeader = self.m_ProcessingHeader.copy() | |
391 | self.m_Voltage.m_RadarControllerHeader = self.m_RadarControllerHeader.copy() |
|
391 | self.m_Voltage.m_RadarControllerHeader = self.m_RadarControllerHeader.copy() | |
392 | self.m_Voltage.m_SystemHeader = self.m_SystemHeader.copy() |
|
392 | self.m_Voltage.m_SystemHeader = self.m_SystemHeader.copy() | |
393 | self.m_Voltage.m_BasicHeader.utc = time |
|
393 | self.m_Voltage.m_BasicHeader.utc = time | |
394 | self.m_Voltage.data = data |
|
394 | self.m_Voltage.data = data | |
395 |
|
395 | |||
396 | self.__buffer_id += 1 |
|
396 | self.__buffer_id += 1 | |
397 |
|
397 | |||
398 | #call setData - to Data Object |
|
398 | #call setData - to Data Object | |
399 |
|
399 | |||
400 | return data |
|
400 | return data | |
401 |
|
401 | |||
402 |
|
402 | |||
403 | def setup(self, path, startDateTime, endDateTime, set=None, expLabel = "", ext = ".r", online = 0): |
|
403 | def setup(self, path, startDateTime, endDateTime, set=None, expLabel = "", ext = ".r", online = 0): | |
404 |
|
404 | |||
405 | if online == 0: |
|
405 | if online == 0: | |
406 | pathList, filenameList = self.__searchFiles(path, startDateTime, endDateTime, set, expLabel, ext) |
|
406 | pathList, filenameList = self.__searchFiles(path, startDateTime, endDateTime, set, expLabel, ext) | |
407 |
|
407 | |||
408 | if len(filenameList) == 0: |
|
408 | if len(filenameList) == 0: | |
409 | self.__fp = None |
|
409 | self.__fp = None | |
410 | self.noMoreFiles = 1 |
|
410 | self.noMoreFiles = 1 | |
411 | print 'Do not exist files in range: %s - %s'%(startDateTime.ctime(), endDateTime.ctime()) |
|
411 | print 'Do not exist files in range: %s - %s'%(startDateTime.ctime(), endDateTime.ctime()) | |
412 | return 0 |
|
412 | return 0 | |
413 |
|
413 | |||
414 | # for thisFile in filenameList: |
|
414 | # for thisFile in filenameList: | |
415 | # print thisFile |
|
415 | # print thisFile | |
416 |
|
416 | |||
417 | self.__idFile = -1 |
|
417 | self.__idFile = -1 | |
418 |
|
418 | |||
419 | if not(self.__setNextFile()): |
|
419 | if not(self.__setNextFile()): | |
420 | print "No more files" |
|
420 | print "No more files" | |
421 | return 0 |
|
421 | return 0 | |
422 |
|
422 | |||
423 | self.__readFirstHeader() |
|
423 | self.__readFirstHeader() | |
424 |
|
424 | |||
425 | self.startUTCSeconds = time.mktime(startDateTime.timetuple()) |
|
425 | self.startUTCSeconds = time.mktime(startDateTime.timetuple()) | |
426 | self.endUTCSeconds = time.mktime(endDateTime.timetuple()) |
|
426 | self.endUTCSeconds = time.mktime(endDateTime.timetuple()) | |
427 |
|
427 | |||
428 | self.startYear = startDateTime.timetuple().tm_year |
|
428 | self.startYear = startDateTime.timetuple().tm_year | |
429 | self.endYear = endDateTime.timetuple().tm_year |
|
429 | self.endYear = endDateTime.timetuple().tm_year | |
430 |
|
430 | |||
431 | self.startDoy = startDateTime.timetuple().tm_yday |
|
431 | self.startDoy = startDateTime.timetuple().tm_yday | |
432 | self.endDoy = endDateTime.timetuple().tm_yday |
|
432 | self.endDoy = endDateTime.timetuple().tm_yday | |
433 | #call fillHeaderValues() - to Data Object |
|
433 | #call fillHeaderValues() - to Data Object | |
434 |
|
434 | |||
435 | self.__pathList = pathList |
|
435 | self.__pathList = pathList | |
436 | self.filenameList = filenameList |
|
436 | self.filenameList = filenameList | |
437 | self.online = online |
|
437 | self.online = online | |
438 |
|
438 | |||
439 | class VoltageWriter(DataWriter): |
|
439 | class VoltageWriter(DataWriter): | |
440 |
|
440 | |||
441 | m_BasicHeader= BasicHeader() |
|
441 | m_BasicHeader= BasicHeader() | |
442 |
|
442 | |||
443 |
|
443 | |||
444 | m_SystemHeader = SystemHeader() |
|
444 | m_SystemHeader = SystemHeader() | |
445 |
|
445 | |||
446 |
|
446 | |||
447 | m_RadarControllerHeader = RadarControllerHeader() |
|
447 | m_RadarControllerHeader = RadarControllerHeader() | |
448 |
|
448 | |||
449 |
|
449 | |||
450 | m_ProcessingHeader = ProcessingHeader() |
|
450 | m_ProcessingHeader = ProcessingHeader() | |
451 |
|
451 | |||
452 | m_Voltage = None |
|
452 | m_Voltage = None | |
453 |
|
453 | |||
454 | def __init__(self, m_Voltage): |
|
454 | def __init__(self, m_Voltage): | |
455 |
|
455 | |||
456 | self.m_Voltage = m_Voltage |
|
456 | self.m_Voltage = m_Voltage | |
457 |
|
457 | |||
458 |
|
458 | |||
459 | No newline at end of file |
|
459 |
@@ -1,20 +1,21 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Feb 7, 2012 |
|
2 | Created on Feb 7, 2012 | |
3 |
|
3 | |||
4 | @author: roj-idl71 |
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |||
5 | ''' |
|
6 | ''' | |
6 |
|
7 | |||
7 | class Correlation(Data): |
|
8 | class Correlation(Data): | |
8 | ''' |
|
9 | ''' | |
9 | classdocs |
|
10 | classdocs | |
10 | ''' |
|
11 | ''' | |
11 |
|
12 | |||
12 |
|
13 | |||
13 | def __init__(self): |
|
14 | def __init__(self): | |
14 | ''' |
|
15 | ''' | |
15 | Constructor |
|
16 | Constructor | |
16 | ''' |
|
17 | ''' | |
17 | pass |
|
18 | pass | |
18 |
|
19 | |||
19 | def copy(self): |
|
20 | def copy(self): | |
20 | pass No newline at end of file |
|
21 | pass |
@@ -1,21 +1,22 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Feb 7, 2012 |
|
2 | Created on Feb 7, 2012 | |
3 |
|
3 | |||
4 | @author: roj-idl71 |
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |||
5 | ''' |
|
6 | ''' | |
6 |
|
7 | |||
7 | class Data: |
|
8 | class Data: | |
8 | ''' |
|
9 | ''' | |
9 | classdocs |
|
10 | classdocs | |
10 | ''' |
|
11 | ''' | |
11 |
|
12 | |||
12 |
|
13 | |||
13 | def __init__(self): |
|
14 | def __init__(self): | |
14 | ''' |
|
15 | ''' | |
15 | Constructor |
|
16 | Constructor | |
16 | ''' |
|
17 | ''' | |
17 | pass |
|
18 | pass | |
18 |
|
19 | |||
19 | def copy(self): |
|
20 | def copy(self): | |
20 | pass |
|
21 | pass | |
21 | No newline at end of file |
|
22 |
@@ -1,18 +1,19 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Feb 7, 2012 |
|
2 | Created on Feb 7, 2012 | |
3 |
|
3 | |||
4 | @author: roj-idl71 |
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |||
5 | ''' |
|
6 | ''' | |
6 |
|
7 | |||
7 | class Noise: |
|
8 | class Noise: | |
8 | ''' |
|
9 | ''' | |
9 | classdocs |
|
10 | classdocs | |
10 | ''' |
|
11 | ''' | |
11 |
|
12 | |||
12 |
|
13 | |||
13 | def __init__(self): |
|
14 | def __init__(self): | |
14 | ''' |
|
15 | ''' | |
15 | Constructor |
|
16 | Constructor | |
16 | ''' |
|
17 | ''' | |
17 | pass |
|
18 | pass | |
18 | No newline at end of file |
|
19 |
@@ -1,21 +1,22 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Feb 7, 2012 |
|
2 | Created on Feb 7, 2012 | |
3 |
|
3 | |||
4 | @author: roj-idl71 |
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |||
5 | ''' |
|
6 | ''' | |
6 |
|
7 | |||
7 | class Spectra(Data): |
|
8 | class Spectra(Data): | |
8 | ''' |
|
9 | ''' | |
9 | classdocs |
|
10 | classdocs | |
10 | ''' |
|
11 | ''' | |
11 |
|
12 | |||
12 |
|
13 | |||
13 | def __init__(self): |
|
14 | def __init__(self): | |
14 | ''' |
|
15 | ''' | |
15 | Constructor |
|
16 | Constructor | |
16 | ''' |
|
17 | ''' | |
17 | pass |
|
18 | pass | |
18 |
|
19 | |||
19 | def copy(self): |
|
20 | def copy(self): | |
20 | pass |
|
21 | pass | |
21 | No newline at end of file |
|
22 |
@@ -1,47 +1,48 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Feb 7, 2012 |
|
2 | Created on Feb 7, 2012 | |
3 |
|
3 | |||
4 | @author: roj-idl71 |
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |||
5 | ''' |
|
6 | ''' | |
6 | import os, sys |
|
7 | import os, sys | |
7 |
|
8 | |||
8 | path = os.path.split(os.getcwd())[0] |
|
9 | path = os.path.split(os.getcwd())[0] | |
9 | sys.path.append(path) |
|
10 | sys.path.append(path) | |
10 |
|
11 | |||
11 | from Model.Data import Data |
|
12 | from Model.Data import Data | |
12 | from IO.Header import * |
|
13 | from IO.Header import * | |
13 |
|
14 | |||
14 | class Voltage(Data): |
|
15 | class Voltage(Data): | |
15 | ''' |
|
16 | ''' | |
16 | classdocs |
|
17 | classdocs | |
17 | ''' |
|
18 | ''' | |
18 |
|
19 | |||
19 |
|
20 | |||
20 | m_RadarControllerHeader= RadarControllerHeader() |
|
21 | m_RadarControllerHeader= RadarControllerHeader() | |
21 |
|
22 | |||
22 | m_ProcessingHeader= ProcessingHeader() |
|
23 | m_ProcessingHeader= ProcessingHeader() | |
23 |
|
24 | |||
24 | m_SystemHeader= SystemHeader() |
|
25 | m_SystemHeader= SystemHeader() | |
25 |
|
26 | |||
26 | m_BasicHeader= BasicHeader() |
|
27 | m_BasicHeader= BasicHeader() | |
27 |
|
28 | |||
28 | data = None |
|
29 | data = None | |
29 |
|
30 | |||
30 | noData = True |
|
31 | noData = True | |
31 |
|
32 | |||
32 |
|
33 | |||
33 | def __init__(self): |
|
34 | def __init__(self): | |
34 | ''' |
|
35 | ''' | |
35 | Constructor |
|
36 | Constructor | |
36 | ''' |
|
37 | ''' | |
37 | pass |
|
38 | pass | |
38 |
|
39 | |||
39 | def copy(self): |
|
40 | def copy(self): | |
40 | obj = Voltage() |
|
41 | obj = Voltage() | |
41 | obj.m_BasicHeader = self.m_BasicHeader.copy() |
|
42 | obj.m_BasicHeader = self.m_BasicHeader.copy() | |
42 | obj.m_SystemHeader = self.m_SystemHeader.copy() |
|
43 | obj.m_SystemHeader = self.m_SystemHeader.copy() | |
43 | obj.m_RadarControllerHeader = self.m_RadarControllerHeader.copy() |
|
44 | obj.m_RadarControllerHeader = self.m_RadarControllerHeader.copy() | |
44 | obj.m_ProcessingHeader = self.m_ProcessingHeader.copy() |
|
45 | obj.m_ProcessingHeader = self.m_ProcessingHeader.copy() | |
45 |
|
46 | |||
46 | return obj |
|
47 | return obj | |
47 | No newline at end of file |
|
48 |
@@ -0,0 +1,6 | |||||
|
1 | ''' | |||
|
2 | Created on Feb 7, 2012 | |||
|
3 | ||||
|
4 | @author $Author$ | |||
|
5 | @version $Id$ | |||
|
6 | ''' No newline at end of file |
@@ -1,17 +1,18 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Feb 7, 2012 |
|
2 | Created on Feb 7, 2012 | |
3 |
|
3 | |||
4 | @author: roj-idl71 |
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |||
5 | ''' |
|
6 | ''' | |
6 |
|
7 | |||
7 | class CorrelationProcessor: |
|
8 | class CorrelationProcessor: | |
8 | ''' |
|
9 | ''' | |
9 | classdocs |
|
10 | classdocs | |
10 | ''' |
|
11 | ''' | |
11 |
|
12 | |||
12 |
|
13 | |||
13 | def __init__(self): |
|
14 | def __init__(self): | |
14 | ''' |
|
15 | ''' | |
15 | Constructor |
|
16 | Constructor | |
16 | ''' |
|
17 | ''' | |
17 | pass No newline at end of file |
|
18 | pass |
@@ -1,17 +1,18 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Feb 7, 2012 |
|
2 | Created on Feb 7, 2012 | |
3 |
|
3 | |||
4 | @author: roj-idl71 |
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |||
5 | ''' |
|
6 | ''' | |
6 |
|
7 | |||
7 | class SpectraProcessor: |
|
8 | class SpectraProcessor: | |
8 | ''' |
|
9 | ''' | |
9 | classdocs |
|
10 | classdocs | |
10 | ''' |
|
11 | ''' | |
11 |
|
12 | |||
12 |
|
13 | |||
13 | def __init__(self): |
|
14 | def __init__(self): | |
14 | ''' |
|
15 | ''' | |
15 | Constructor |
|
16 | Constructor | |
16 | ''' |
|
17 | ''' | |
17 | pass No newline at end of file |
|
18 | pass |
@@ -1,17 +1,18 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Feb 7, 2012 |
|
2 | Created on Feb 7, 2012 | |
3 |
|
3 | |||
4 | @author: roj-idl71 |
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |||
5 | ''' |
|
6 | ''' | |
6 |
|
7 | |||
7 | class VoltageProcessor: |
|
8 | class VoltageProcessor: | |
8 | ''' |
|
9 | ''' | |
9 | classdocs |
|
10 | classdocs | |
10 | ''' |
|
11 | ''' | |
11 |
|
12 | |||
12 |
|
13 | |||
13 | def __init__(self): |
|
14 | def __init__(self): | |
14 | ''' |
|
15 | ''' | |
15 | Constructor |
|
16 | Constructor | |
16 | ''' |
|
17 | ''' | |
17 | pass No newline at end of file |
|
18 | pass |
@@ -0,0 +1,6 | |||||
|
1 | ''' | |||
|
2 | Created on Feb 7, 2012 | |||
|
3 | ||||
|
4 | @author $Author$ | |||
|
5 | @version $Id$ | |||
|
6 | ''' No newline at end of file |
@@ -1,18 +1,19 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Feb 7, 2012 |
|
2 | Created on Feb 7, 2012 | |
3 |
|
3 | |||
4 | @author: roj-idl71 |
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |||
5 | ''' |
|
6 | ''' | |
6 |
|
7 | |||
7 | class FtpServer: |
|
8 | class FtpServer: | |
8 | ''' |
|
9 | ''' | |
9 | classdocs |
|
10 | classdocs | |
10 | ''' |
|
11 | ''' | |
11 |
|
12 | |||
12 |
|
13 | |||
13 | def __init__(self): |
|
14 | def __init__(self): | |
14 | ''' |
|
15 | ''' | |
15 | Constructor |
|
16 | Constructor | |
16 | ''' |
|
17 | ''' | |
17 | pass |
|
18 | pass | |
18 | No newline at end of file |
|
19 |
@@ -1,19 +1,20 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Feb 7, 2012 |
|
2 | Created on Feb 7, 2012 | |
3 |
|
3 | |||
4 | @author: roj-idl71 |
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |||
5 | ''' |
|
6 | ''' | |
6 |
|
7 | |||
7 | class FtpServerList: |
|
8 | class FtpServerList: | |
8 | ''' |
|
9 | ''' | |
9 | classdocs |
|
10 | classdocs | |
10 | ''' |
|
11 | ''' | |
11 |
|
12 | |||
12 |
|
13 | |||
13 | def __init__(self): |
|
14 | def __init__(self): | |
14 | ''' |
|
15 | ''' | |
15 | Constructor |
|
16 | Constructor | |
16 | ''' |
|
17 | ''' | |
17 | pass |
|
18 | pass | |
18 | m_FtpServer= FtpServer() |
|
19 | m_FtpServer= FtpServer() | |
19 |
|
20 |
General Comments 0
You need to be logged in to leave comments.
Login now