@@ -0,0 +1,17 | |||||
|
1 | ''' | |||
|
2 | Created on Feb 7, 2012 | |||
|
3 | ||||
|
4 | @author: roj-idl71 | |||
|
5 | ''' | |||
|
6 | ||||
|
7 | class VoltagePlot(object): | |||
|
8 | ''' | |||
|
9 | classdocs | |||
|
10 | ''' | |||
|
11 | ||||
|
12 | ||||
|
13 | def __init__(self): | |||
|
14 | ''' | |||
|
15 | Constructor | |||
|
16 | ''' | |||
|
17 | pass No newline at end of file |
@@ -10,6 +10,11 class Spectrum: | |||||
10 | showPowerProfile = True |
|
10 | showPowerProfile = True | |
11 |
|
11 | |||
12 | __szchar = 0.7 |
|
12 | __szchar = 0.7 | |
|
13 | __xrange = None | |||
|
14 | __yrange = None | |||
|
15 | __zrange = None | |||
|
16 | specObj = BasicGraph() | |||
|
17 | ||||
13 |
|
18 | |||
14 | def __init__(self): |
|
19 | def __init__(self): | |
15 |
|
20 | |||
@@ -175,13 +180,22 class CrossSpectrum: | |||||
175 | showPowerProfile = True |
|
180 | showPowerProfile = True | |
176 |
|
181 | |||
177 | __szchar = 0.7 |
|
182 | __szchar = 0.7 | |
|
183 | __showPhase = False | |||
|
184 | __xrange = None | |||
|
185 | __yrange = None | |||
|
186 | __zrange = None | |||
|
187 | m_BasicGraph= BasicGraph() | |||
|
188 | ||||
178 | def __init__(self): |
|
189 | def __init__(self): | |
179 | pass |
|
190 | pass | |
180 |
|
191 | |||
181 | def setup(self): |
|
192 | def setup(self, subpage, title, xlabel, ylabel, colormap, showColorbar, showPowerProfile): | |
182 | pass |
|
193 | pass | |
183 |
|
194 | |||
184 | def plotData(self): |
|
195 | def setRanges(self, xrange, yrange, zrange): | |
|
196 | pass | |||
|
197 | ||||
|
198 | def plotData(self, data, xmin, xmax, ymin, ymax, zmin, zmax): | |||
185 | pass |
|
199 | pass | |
186 |
|
200 | |||
187 | if __name__ == '__main__': |
|
201 | if __name__ == '__main__': |
@@ -4,28 +4,31 Created on 23/01/2012 | |||||
4 | @author: danielangelsuarezmunoz |
|
4 | @author: danielangelsuarezmunoz | |
5 | ''' |
|
5 | ''' | |
6 |
|
6 | |||
7 |
import Voltage |
|
7 | import Voltage | |
8 | import datetime |
|
8 | import datetime | |
9 | import time |
|
9 | import time | |
10 |
|
10 | |||
11 |
objReader = Voltage |
|
11 | objReader = Voltage.VoltageReader() | |
12 |
|
12 | |||
13 | path = '/Users/danielangelsuarezmunoz/Documents/Projects' |
|
13 | ||
14 | startDateTime = datetime.datetime(2007,1,1,16,0,0) |
|
14 | path = '/home/roj-idl71/Data/RAWDATA/DP_Faraday/' | |
15 |
|
|
15 | startDateTime = datetime.datetime(2011,3,11,16,0,0) | |
|
16 | endDateTime = datetime.datetime(2011,3,11,20,1,0) | |||
16 | set = None |
|
17 | set = None | |
17 | expLabel = '' |
|
18 | expLabel = '' | |
18 | ext = '*.r' |
|
19 | ext = '*.r' | |
19 |
|
20 | |||
20 | t0 = time.time() |
|
21 | t0 = time.time() | |
21 |
objReader.setup(path, startDateTime, endDateTime |
|
22 | objReader.setup(path, startDateTime, endDateTime) | |
22 | print time.time() - t0 |
|
23 | #print time.time() - t0 | |
23 |
|
24 | |||
24 |
|
25 | |||
25 | while(not(objReader.noMoreFiles)): |
|
26 | while(not(objReader.noMoreFiles)): | |
26 |
|
27 | |||
27 | objReader.getData() |
|
28 | objReader.getData() | |
|
29 | # if objReader.flagIsNewFile: | |||
|
30 | # print objReader.m_BasicHeader.dataBlock | |||
28 | #print objReader.objStructShortHeader.dataBlock |
|
31 | #print objReader.objStructShortHeader.dataBlock | |
29 |
#print time.localtime(objReader. |
|
32 | #print time.localtime(objReader.m_BasicHeader.utc) | |
30 |
|
33 | |||
31 | No newline at end of file |
|
34 |
@@ -17,23 +17,23 from Data import DataReader | |||||
17 | from Data import DataWriter |
|
17 | from 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( |
|
20 | sys.path.append(path) | |
21 |
|
21 | |||
22 | from Voltage import Voltage |
|
22 | from Model.Voltage import Voltage | |
23 |
|
23 | |||
24 | class VoltageReader(DataReader): |
|
24 | class VoltageReader(DataReader): | |
25 |
|
25 | |||
26 |
__idFile = |
|
26 | __idFile = None | |
27 |
|
27 | |||
28 |
__fp = |
|
28 | __fp = None | |
29 |
|
29 | |||
30 |
__startDateTime = |
|
30 | __startDateTime = None | |
31 |
|
31 | |||
32 |
__endDateTime = |
|
32 | __endDateTime = None | |
33 |
|
33 | |||
34 |
__dataType = |
|
34 | __dataType = None | |
35 |
|
35 | |||
36 |
__ |
|
36 | __fileSizeByHeader = 0 | |
37 |
|
37 | |||
38 | __pathList = [] |
|
38 | __pathList = [] | |
39 |
|
39 | |||
@@ -51,9 +51,9 class VoltageReader(DataReader): | |||||
51 |
|
51 | |||
52 | online = 0 |
|
52 | online = 0 | |
53 |
|
53 | |||
54 |
filename = |
|
54 | filename = None | |
55 |
|
55 | |||
56 |
fileSize = |
|
56 | fileSize = None | |
57 |
|
57 | |||
58 | firstHeaderSize = 0 |
|
58 | firstHeaderSize = 0 | |
59 |
|
59 | |||
@@ -73,8 +73,11 class VoltageReader(DataReader): | |||||
73 |
|
73 | |||
74 | __buffer_id = 9999 |
|
74 | __buffer_id = 9999 | |
75 |
|
75 | |||
76 | def __init__(self, m_Voltage): |
|
76 | def __init__(self, m_Voltage = None): | |
77 |
|
77 | |||
|
78 | if m_Voltage == None: | |||
|
79 | m_Voltage = Voltage() | |||
|
80 | ||||
78 | self.m_Voltage = m_Voltage |
|
81 | self.m_Voltage = m_Voltage | |
79 |
|
82 | |||
80 | def __rdSystemHeader(self,fp=None): |
|
83 | def __rdSystemHeader(self,fp=None): | |
@@ -95,7 +98,9 class VoltageReader(DataReader): | |||||
95 |
|
98 | |||
96 | self.m_ProcessingHeader.read(fp) |
|
99 | self.m_ProcessingHeader.read(fp) | |
97 |
|
100 | |||
98 |
def __searchFiles(self,path, startDateTime, endDateTime, set=None, expLabel = "", ext = " |
|
101 | def __searchFiles(self,path, startDateTime, endDateTime, set=None, expLabel = "", ext = ".r"): | |
|
102 | ||||
|
103 | print "Searching files ..." | |||
99 |
|
104 | |||
100 | startUtSeconds = time.mktime(startDateTime.timetuple()) |
|
105 | startUtSeconds = time.mktime(startDateTime.timetuple()) | |
101 | endUtSeconds = time.mktime(endDateTime.timetuple()) |
|
106 | endUtSeconds = time.mktime(endDateTime.timetuple()) | |
@@ -106,50 +111,51 class VoltageReader(DataReader): | |||||
106 | startDoy = startDateTime.timetuple().tm_yday |
|
111 | startDoy = startDateTime.timetuple().tm_yday | |
107 | endDoy = endDateTime.timetuple().tm_yday |
|
112 | endDoy = endDateTime.timetuple().tm_yday | |
108 |
|
113 | |||
109 |
range |
|
114 | yearRange = range(startYear,endYear+1) | |
110 |
|
115 | |||
111 |
|
|
116 | doyDoubleList = [] | |
112 | if startYear == endYear: |
|
117 | if startYear == endYear: | |
113 | doyList = range(startDoy,endDoy+1) |
|
118 | doyList = range(startDoy,endDoy+1) | |
114 | else: |
|
119 | else: | |
115 |
for year in range |
|
120 | for year in yearRange: | |
116 | if (year == startYear): |
|
121 | if (year == startYear): | |
117 |
|
|
122 | doyDoubleList.append(range(startDoy,365+1)) | |
118 | elif (year == endYear): |
|
123 | elif (year == endYear): | |
119 |
|
|
124 | doyDoubleList.append(range(1,endDoy+1)) | |
120 | else: |
|
125 | else: | |
121 |
|
|
126 | doyDoubleList.append(range(1,365+1)) | |
122 | doyList = [] |
|
127 | doyList = [] | |
123 |
for list in |
|
128 | for list in doyDoubleList: | |
124 | doyList = doyList + list |
|
129 | doyList = doyList + list | |
125 |
|
130 | |||
126 |
|
|
131 | doyPathList = [] | |
127 | for thisPath in os.listdir(path): |
|
132 | for thisPath in os.listdir(path): | |
128 | if os.path.isdir(os.path.join(path,thisPath)): |
|
133 | if os.path.isdir(os.path.join(path,thisPath)): | |
129 |
# |
|
134 | #doyPathList.append(os.path.join(path,thisPath)) | |
130 |
|
|
135 | doyPathList.append(thisPath) | |
131 |
|
136 | |||
132 | pathList = [] |
|
137 | pathList = [] | |
133 |
|
|
138 | pathDict = {} | |
134 |
for year in range |
|
139 | for year in yearRange: | |
135 | for doy in doyList: |
|
140 | for doy in doyList: | |
136 |
|
|
141 | match = fnmatch.filter(doyPathList, 'D' + '%4.4d%3.3d' % (year,doy)) | |
137 |
if len( |
|
142 | if len(match) == 0: | |
138 | continue |
|
143 | match = fnmatch.filter(doyPathList, 'd' + '%4.4d%3.3d' % (year,doy)) | |
|
144 | if len(match) == 0: continue | |||
139 | if expLabel == '': |
|
145 | if expLabel == '': | |
140 |
pathList.append(os.path.join(path, |
|
146 | pathList.append(os.path.join(path,match[0])) | |
141 |
|
|
147 | pathDict.setdefault(os.path.join(path,match[0])) | |
142 |
|
|
148 | pathDict[os.path.join(path,match[0])] = [] | |
143 | else: |
|
149 | else: | |
144 |
pathList.append(os.path.join(path,os.path.join( |
|
150 | pathList.append(os.path.join(path,os.path.join(match[0],expLabel))) | |
145 |
|
|
151 | pathDict.setdefault(os.path.join(path,os.path.join(match[0],expLabel))) | |
146 |
|
|
152 | pathDict[os.path.join(path,os.path.join(match[0],expLabel))] = [] | |
147 |
|
153 | |||
148 |
|
154 | |||
149 | filenameList = [] |
|
155 | filenameList = [] | |
150 | for thisPath in pathList: |
|
156 | for thisPath in pathList: | |
151 | fileList = glob.glob1(thisPath, ext) |
|
157 | fileList = glob.glob1(thisPath, "*%s" %ext) | |
152 |
# |
|
158 | #pathDict[thisPath].append(fileList) | |
153 | fileList.sort() |
|
159 | fileList.sort() | |
154 | for file in fileList: |
|
160 | for file in fileList: | |
155 | filename = os.path.join(thisPath,file) |
|
161 | filename = os.path.join(thisPath,file) | |
@@ -218,7 +224,7 class VoltageReader(DataReader): | |||||
218 | tmp = 0 |
|
224 | tmp = 0 | |
219 |
|
225 | |||
220 | self.__dataType = tmp |
|
226 | self.__dataType = tmp | |
221 |
self.__ |
|
227 | self.__fileSizeByHeader = self.m_ProcessingHeader.dataBlocksPerFile * self.m_ProcessingHeader.blockSize + self.firstHeaderSize + self.basicHeaderSize*(self.m_ProcessingHeader.dataBlocksPerFile - 1) | |
222 |
|
228 | |||
223 | def __setNextFileOnline(self): |
|
229 | def __setNextFileOnline(self): | |
224 | return 0 |
|
230 | return 0 | |
@@ -265,6 +271,9 class VoltageReader(DataReader): | |||||
265 |
|
271 | |||
266 | def __setNewBlock(self): |
|
272 | def __setNewBlock(self): | |
267 |
|
273 | |||
|
274 | if self.__fp == None: | |||
|
275 | return 0 | |||
|
276 | ||||
268 | if self.__flagIsNewFile: |
|
277 | if self.__flagIsNewFile: | |
269 | return 1 |
|
278 | return 1 | |
270 |
|
279 | |||
@@ -337,18 +346,18 class VoltageReader(DataReader): | |||||
337 | self.readNextBlock() |
|
346 | self.readNextBlock() | |
338 |
|
347 | |||
339 | if self.noMoreFiles == 1: |
|
348 | if self.noMoreFiles == 1: | |
340 |
print ' |
|
349 | print 'Process finished' | |
341 | return None |
|
350 | return None | |
342 |
|
351 | |||
343 | data = self.__buffer[self.__buffer_id,:,:] |
|
352 | data = self.__buffer[self.__buffer_id,:,:] | |
344 | time = 111 |
|
353 | time = 111 | |
345 |
|
354 | |||
346 | self.m_Voltage.data = data |
|
355 | # self.m_Voltage.data = data | |
347 | self.m_Voltage.timeProfile = time |
|
356 | # self.m_Voltage.timeProfile = time | |
348 | self.m_Voltage.m_BasicHeader = self.m_BasicHeader.copy() |
|
357 | # self.m_Voltage.m_BasicHeader = self.m_BasicHeader.copy() | |
349 | self.m_Voltage.m_ProcessingHeader = self.m_ProcessingHeader.copy() |
|
358 | # self.m_Voltage.m_ProcessingHeader = self.m_ProcessingHeader.copy() | |
350 | self.m_Voltage.m_RadarControllerHeader = self.m_RadarControllerHeader.copy() |
|
359 | # self.m_Voltage.m_RadarControllerHeader = self.m_RadarControllerHeader.copy() | |
351 | self.m_Voltage.m_SystemHeader = self.m_systemHeader.copy() |
|
360 | # self.m_Voltage.m_SystemHeader = self.m_systemHeader.copy() | |
352 |
|
361 | |||
353 | self.__buffer_id += 1 |
|
362 | self.__buffer_id += 1 | |
354 |
|
363 | |||
@@ -363,6 +372,8 class VoltageReader(DataReader): | |||||
363 | pathList, filenameList = self.__searchFiles(path, startDateTime, endDateTime, set, expLabel, ext) |
|
372 | pathList, filenameList = self.__searchFiles(path, startDateTime, endDateTime, set, expLabel, ext) | |
364 |
|
373 | |||
365 | if len(filenameList) == 0: |
|
374 | if len(filenameList) == 0: | |
|
375 | self.__fp = None | |||
|
376 | self.noMoreFiles = 1 | |||
366 | print 'Do not exist files in range: %s - %s'%(startDateTime.ctime(), endDateTime.ctime()) |
|
377 | print 'Do not exist files in range: %s - %s'%(startDateTime.ctime(), endDateTime.ctime()) | |
367 | return 0 |
|
378 | return 0 | |
368 |
|
379 |
@@ -3,6 +3,13 Created on Feb 7, 2012 | |||||
3 |
|
3 | |||
4 | @author: roj-idl71 |
|
4 | @author: roj-idl71 | |
5 | ''' |
|
5 | ''' | |
|
6 | import os, sys | |||
|
7 | ||||
|
8 | path = os.path.split(os.getcwd())[0] | |||
|
9 | sys.path.append(path) | |||
|
10 | ||||
|
11 | from Model.Data import Data | |||
|
12 | from IO.Header import * | |||
6 |
|
13 | |||
7 | class Voltage(Data): |
|
14 | class Voltage(Data): | |
8 | ''' |
|
15 | ''' |
General Comments 0
You need to be logged in to leave comments.
Login now