@@ -0,0 +1,94 | |||||
|
1 | import os, sys | |||
|
2 | ||||
|
3 | from schainpy.controller import Project | |||
|
4 | ||||
|
5 | if __name__ == '__main__': | |||
|
6 | ||||
|
7 | desc = "Segundo Test" | |||
|
8 | filename = "schain.xml" | |||
|
9 | ||||
|
10 | controllerObj = Project() | |||
|
11 | ||||
|
12 | controllerObj.setup(id = '191', name='test01', description=desc) | |||
|
13 | ||||
|
14 | readUnitConfObj = controllerObj.addReadUnit(datatype='VoltageReader', | |||
|
15 | path='/home/jchavez/jicamarca/jro_data/rawdata/', | |||
|
16 | startDate='2010/10/28', | |||
|
17 | endDate='2017/10/28', | |||
|
18 | startTime='00:00:00', | |||
|
19 | endTime='23:59:59', | |||
|
20 | online=0, | |||
|
21 | walk=0) | |||
|
22 | ||||
|
23 | opObj00 = readUnitConfObj.addOperation(name='printNumberOfBlock') | |||
|
24 | ||||
|
25 | procUnitConfObj0 = controllerObj.addProcUnit(datatype='VoltageProc', | |||
|
26 | inputId=readUnitConfObj.getId()) | |||
|
27 | ||||
|
28 | opObj10 = procUnitConfObj0.addOperation(name='DigitalRFWriter', optype='other') | |||
|
29 | opObj10.addParameter(name='path', value='/home/jchavez/jicamarca/data_sink/', format='str') | |||
|
30 | # opObj10.addParameter(name='minHei', value='0', format='float') | |||
|
31 | # opObj10.addParameter(name='maxHei', value='8', format='float') | |||
|
32 | ||||
|
33 | # opObj10 = procUnitConfObj0.addOperation(name='filterByHeights') | |||
|
34 | # opObj10.addParameter(name='window', value='2', format='float') | |||
|
35 | ||||
|
36 | # opObj10 = procUnitConfObj0.addOperation(name='Decoder', optype='external') | |||
|
37 | # opObj10.addParameter(name='code', value='1,-1', format='intlist') | |||
|
38 | # opObj10.addParameter(name='nCode', value='2', format='float') | |||
|
39 | # opObj10.addParameter(name='nBaud', value='1', format='float') | |||
|
40 | ||||
|
41 | ||||
|
42 | # opObj10 = procUnitConfObj0.addOperation(name='CohInt', optype='external') | |||
|
43 | # opObj10.addParameter(name='n', value='1296', format='float') | |||
|
44 | ||||
|
45 | # procUnitConfObj1 = controllerObj.addProcUnit(datatype='SpectraProc', | |||
|
46 | # inputId=procUnitConfObj0.getId()) | |||
|
47 | ||||
|
48 | #Creating a processing object with its parameters | |||
|
49 | #schainpy.model.proc.jroproc_spectra.SpectraProc.run() | |||
|
50 | #If you need to add more parameters can use the "addParameter method" | |||
|
51 | # procUnitConfObj1.addParameter(name='nFFTPoints', value='128', format='int') | |||
|
52 | ||||
|
53 | # opObj10 = procUnitConfObj1.addOperation(name='IncohInt', optype='external') | |||
|
54 | # opObj10.addParameter(name='n', value='2', format='float') | |||
|
55 | ||||
|
56 | #Using internal methods | |||
|
57 | #schainpy.model.proc.jroproc_spectra.SpectraProc.selectChannels() | |||
|
58 | # opObj10 = procUnitConfObj1.addOperation(name='selectChannels') | |||
|
59 | # opObj10.addParameter(name='channelList', value='0,1', format='intlist') | |||
|
60 | ||||
|
61 | #Using internal methods | |||
|
62 | #schainpy.model.proc.jroproc_spectra.SpectraProc.selectHeights() | |||
|
63 | # opObj10 = procUnitConfObj1.addOperation(name='selectHeights') | |||
|
64 | # opObj10.addParameter(name='minHei', value='90', format='float') | |||
|
65 | # opObj10.addParameter(name='maxHei', value='180', format='float') | |||
|
66 | ||||
|
67 | #Using external methods (new modules) | |||
|
68 | # #schainpy.model.proc.jroproc_spectra.IncohInt.setup() | |||
|
69 | # opObj12 = procUnitConfObj1.addOperation(name='IncohInt', optype='other') | |||
|
70 | # opObj12.addParameter(name='n', value='1', format='int') | |||
|
71 | ||||
|
72 | #Using external methods (new modules) | |||
|
73 | #schainpy.model.graphics.jroplot_spectra.SpectraPlot.setup() | |||
|
74 | # opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='external') | |||
|
75 | # opObj11.addParameter(name='id', value='11', format='int') | |||
|
76 | # opObj11.addParameter(name='wintitle', value='SpectraPlot', format='str') | |||
|
77 | # opObj11.addParameter(name='zmin', value='-60', format='int') | |||
|
78 | # opObj11.addParameter(name='zmax', value='10', format='int') | |||
|
79 | # opObj11.addParameter(name='save', value='1', format='int') | |||
|
80 | ||||
|
81 | # #Using external methods (new modules) | |||
|
82 | # #schainpy.model.graphics.jroplot_spectra.RTIPlot.setup() | |||
|
83 | # opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='other') | |||
|
84 | # opObj11.addParameter(name='id', value='30', format='int') | |||
|
85 | # opObj11.addParameter(name='wintitle', value='RTI', format='str') | |||
|
86 | # opObj11.addParameter(name='zmin', value='-60', format='int') | |||
|
87 | # opObj11.addParameter(name='zmax', value='-10', format='int') | |||
|
88 | # opObj11.addParameter(name='showprofile', value='1', format='int') | |||
|
89 | # # opObj11.addParameter(name='timerange', value=str(5*60*60*60), format='int') | |||
|
90 | # opObj11.addParameter(name='xmin', value='14', format='float') | |||
|
91 | # opObj11.addParameter(name='xmax', value='23.9', format='float') | |||
|
92 | # opObj11.addParameter(name='save', value='1', format='int') | |||
|
93 | ||||
|
94 | controllerObj.start() |
@@ -1,762 +1,761 | |||||
1 | ''' |
|
1 | ''' | |
2 |
|
2 | |||
3 | $Author: murco $ |
|
3 | $Author: murco $ | |
4 | $Id: JROHeaderIO.py 151 2012-10-31 19:00:51Z murco $ |
|
4 | $Id: JROHeaderIO.py 151 2012-10-31 19:00:51Z murco $ | |
5 | ''' |
|
5 | ''' | |
6 | import sys |
|
6 | import sys | |
7 | import numpy |
|
7 | import numpy | |
8 | import copy |
|
8 | import copy | |
9 | import datetime |
|
9 | import datetime | |
10 |
|
10 | |||
11 | SPEED_OF_LIGHT = 299792458 |
|
11 | SPEED_OF_LIGHT = 299792458 | |
12 | SPEED_OF_LIGHT = 3e8 |
|
12 | SPEED_OF_LIGHT = 3e8 | |
13 |
|
13 | |||
14 | BASIC_STRUCTURE = numpy.dtype([ |
|
14 | BASIC_STRUCTURE = numpy.dtype([ | |
15 | ('nSize','<u4'), |
|
15 | ('nSize','<u4'), | |
16 | ('nVersion','<u2'), |
|
16 | ('nVersion','<u2'), | |
17 | ('nDataBlockId','<u4'), |
|
17 | ('nDataBlockId','<u4'), | |
18 | ('nUtime','<u4'), |
|
18 | ('nUtime','<u4'), | |
19 | ('nMilsec','<u2'), |
|
19 | ('nMilsec','<u2'), | |
20 | ('nTimezone','<i2'), |
|
20 | ('nTimezone','<i2'), | |
21 | ('nDstflag','<i2'), |
|
21 | ('nDstflag','<i2'), | |
22 | ('nErrorCount','<u4') |
|
22 | ('nErrorCount','<u4') | |
23 | ]) |
|
23 | ]) | |
24 |
|
24 | |||
25 | SYSTEM_STRUCTURE = numpy.dtype([ |
|
25 | SYSTEM_STRUCTURE = numpy.dtype([ | |
26 | ('nSize','<u4'), |
|
26 | ('nSize','<u4'), | |
27 | ('nNumSamples','<u4'), |
|
27 | ('nNumSamples','<u4'), | |
28 | ('nNumProfiles','<u4'), |
|
28 | ('nNumProfiles','<u4'), | |
29 | ('nNumChannels','<u4'), |
|
29 | ('nNumChannels','<u4'), | |
30 | ('nADCResolution','<u4'), |
|
30 | ('nADCResolution','<u4'), | |
31 | ('nPCDIOBusWidth','<u4'), |
|
31 | ('nPCDIOBusWidth','<u4'), | |
32 | ]) |
|
32 | ]) | |
33 |
|
33 | |||
34 | RADAR_STRUCTURE = numpy.dtype([ |
|
34 | RADAR_STRUCTURE = numpy.dtype([ | |
35 | ('nSize','<u4'), |
|
35 | ('nSize','<u4'), | |
36 | ('nExpType','<u4'), |
|
36 | ('nExpType','<u4'), | |
37 | ('nNTx','<u4'), |
|
37 | ('nNTx','<u4'), | |
38 | ('fIpp','<f4'), |
|
38 | ('fIpp','<f4'), | |
39 | ('fTxA','<f4'), |
|
39 | ('fTxA','<f4'), | |
40 | ('fTxB','<f4'), |
|
40 | ('fTxB','<f4'), | |
41 | ('nNumWindows','<u4'), |
|
41 | ('nNumWindows','<u4'), | |
42 | ('nNumTaus','<u4'), |
|
42 | ('nNumTaus','<u4'), | |
43 | ('nCodeType','<u4'), |
|
43 | ('nCodeType','<u4'), | |
44 | ('nLine6Function','<u4'), |
|
44 | ('nLine6Function','<u4'), | |
45 | ('nLine5Function','<u4'), |
|
45 | ('nLine5Function','<u4'), | |
46 | ('fClock','<f4'), |
|
46 | ('fClock','<f4'), | |
47 | ('nPrePulseBefore','<u4'), |
|
47 | ('nPrePulseBefore','<u4'), | |
48 | ('nPrePulseAfter','<u4'), |
|
48 | ('nPrePulseAfter','<u4'), | |
49 | ('sRangeIPP','<a20'), |
|
49 | ('sRangeIPP','<a20'), | |
50 | ('sRangeTxA','<a20'), |
|
50 | ('sRangeTxA','<a20'), | |
51 | ('sRangeTxB','<a20'), |
|
51 | ('sRangeTxB','<a20'), | |
52 | ]) |
|
52 | ]) | |
53 |
|
53 | |||
54 | SAMPLING_STRUCTURE = numpy.dtype([('h0','<f4'),('dh','<f4'),('nsa','<u4')]) |
|
54 | SAMPLING_STRUCTURE = numpy.dtype([('h0','<f4'),('dh','<f4'),('nsa','<u4')]) | |
55 |
|
55 | |||
56 |
|
56 | |||
57 | PROCESSING_STRUCTURE = numpy.dtype([ |
|
57 | PROCESSING_STRUCTURE = numpy.dtype([ | |
58 | ('nSize','<u4'), |
|
58 | ('nSize','<u4'), | |
59 | ('nDataType','<u4'), |
|
59 | ('nDataType','<u4'), | |
60 | ('nSizeOfDataBlock','<u4'), |
|
60 | ('nSizeOfDataBlock','<u4'), | |
61 | ('nProfilesperBlock','<u4'), |
|
61 | ('nProfilesperBlock','<u4'), | |
62 | ('nDataBlocksperFile','<u4'), |
|
62 | ('nDataBlocksperFile','<u4'), | |
63 | ('nNumWindows','<u4'), |
|
63 | ('nNumWindows','<u4'), | |
64 | ('nProcessFlags','<u4'), |
|
64 | ('nProcessFlags','<u4'), | |
65 | ('nCoherentIntegrations','<u4'), |
|
65 | ('nCoherentIntegrations','<u4'), | |
66 | ('nIncoherentIntegrations','<u4'), |
|
66 | ('nIncoherentIntegrations','<u4'), | |
67 | ('nTotalSpectra','<u4') |
|
67 | ('nTotalSpectra','<u4') | |
68 | ]) |
|
68 | ]) | |
69 |
|
69 | |||
70 | class Header(object): |
|
70 | class Header(object): | |
71 |
|
71 | |||
72 | def __init__(self): |
|
72 | def __init__(self): | |
73 | raise NotImplementedError |
|
73 | raise NotImplementedError | |
74 |
|
74 | |||
75 | def copy(self): |
|
75 | def copy(self): | |
76 | return copy.deepcopy(self) |
|
76 | return copy.deepcopy(self) | |
77 |
|
77 | |||
78 | def read(self): |
|
78 | def read(self): | |
79 |
|
79 | |||
80 | raise NotImplementedError |
|
80 | raise NotImplementedError | |
81 |
|
81 | |||
82 | def write(self): |
|
82 | def write(self): | |
83 |
|
83 | |||
84 | raise NotImplementedError |
|
84 | raise NotImplementedError | |
85 |
|
85 | |||
86 | def printInfo(self): |
|
86 | def printInfo(self): | |
87 |
|
87 | |||
88 | message = "#"*50 + "\n" |
|
88 | message = "#"*50 + "\n" | |
89 | message += self.__class__.__name__.upper() + "\n" |
|
89 | message += self.__class__.__name__.upper() + "\n" | |
90 | message += "#"*50 + "\n" |
|
90 | message += "#"*50 + "\n" | |
91 |
|
91 | |||
92 | keyList = self.__dict__.keys() |
|
92 | keyList = self.__dict__.keys() | |
93 | keyList.sort() |
|
93 | keyList.sort() | |
94 |
|
94 | |||
95 | for key in keyList: |
|
95 | for key in keyList: | |
96 | message += "%s = %s" %(key, self.__dict__[key]) + "\n" |
|
96 | message += "%s = %s" %(key, self.__dict__[key]) + "\n" | |
97 |
|
97 | |||
98 | if "size" not in keyList: |
|
98 | if "size" not in keyList: | |
99 | attr = getattr(self, "size") |
|
99 | attr = getattr(self, "size") | |
100 |
|
100 | |||
101 | if attr: |
|
101 | if attr: | |
102 | message += "%s = %s" %("size", attr) + "\n" |
|
102 | message += "%s = %s" %("size", attr) + "\n" | |
103 |
|
103 | |||
104 | print message |
|
104 | print message | |
105 |
|
105 | |||
106 | class BasicHeader(Header): |
|
106 | class BasicHeader(Header): | |
107 |
|
107 | |||
108 | size = None |
|
108 | size = None | |
109 | version = None |
|
109 | version = None | |
110 | dataBlock = None |
|
110 | dataBlock = None | |
111 | utc = None |
|
111 | utc = None | |
112 | ltc = None |
|
112 | ltc = None | |
113 | miliSecond = None |
|
113 | miliSecond = None | |
114 | timeZone = None |
|
114 | timeZone = None | |
115 | dstFlag = None |
|
115 | dstFlag = None | |
116 | errorCount = None |
|
116 | errorCount = None | |
117 | datatime = None |
|
117 | datatime = None | |
118 |
|
118 | |||
119 | __LOCALTIME = None |
|
119 | __LOCALTIME = None | |
120 |
|
120 | |||
121 | def __init__(self, useLocalTime=True): |
|
121 | def __init__(self, useLocalTime=True): | |
122 |
|
122 | |||
123 | self.size = 24 |
|
123 | self.size = 24 | |
124 | self.version = 0 |
|
124 | self.version = 0 | |
125 | self.dataBlock = 0 |
|
125 | self.dataBlock = 0 | |
126 | self.utc = 0 |
|
126 | self.utc = 0 | |
127 | self.miliSecond = 0 |
|
127 | self.miliSecond = 0 | |
128 | self.timeZone = 0 |
|
128 | self.timeZone = 0 | |
129 | self.dstFlag = 0 |
|
129 | self.dstFlag = 0 | |
130 | self.errorCount = 0 |
|
130 | self.errorCount = 0 | |
131 |
|
131 | |||
132 | self.useLocalTime = useLocalTime |
|
132 | self.useLocalTime = useLocalTime | |
133 |
|
133 | |||
134 | def read(self, fp): |
|
134 | def read(self, fp): | |
135 |
|
135 | |||
136 | try: |
|
136 | try: | |
137 | header = numpy.fromfile(fp, BASIC_STRUCTURE,1) |
|
137 | header = numpy.fromfile(fp, BASIC_STRUCTURE,1) | |
138 |
|
138 | |||
139 | except Exception, e: |
|
139 | except Exception, e: | |
140 | print "BasicHeader: " |
|
140 | print "BasicHeader: " | |
141 | print e |
|
141 | print e | |
142 | return 0 |
|
142 | return 0 | |
143 |
|
143 | |||
144 | self.size = int(header['nSize'][0]) |
|
144 | self.size = int(header['nSize'][0]) | |
145 | self.version = int(header['nVersion'][0]) |
|
145 | self.version = int(header['nVersion'][0]) | |
146 | self.dataBlock = int(header['nDataBlockId'][0]) |
|
146 | self.dataBlock = int(header['nDataBlockId'][0]) | |
147 | self.utc = int(header['nUtime'][0]) |
|
147 | self.utc = int(header['nUtime'][0]) | |
148 | self.miliSecond = int(header['nMilsec'][0]) |
|
148 | self.miliSecond = int(header['nMilsec'][0]) | |
149 | self.timeZone = int(header['nTimezone'][0]) |
|
149 | self.timeZone = int(header['nTimezone'][0]) | |
150 | self.dstFlag = int(header['nDstflag'][0]) |
|
150 | self.dstFlag = int(header['nDstflag'][0]) | |
151 | self.errorCount = int(header['nErrorCount'][0]) |
|
151 | self.errorCount = int(header['nErrorCount'][0]) | |
152 |
|
152 | |||
153 | if self.size < 24: |
|
153 | if self.size < 24: | |
154 | return 0 |
|
154 | return 0 | |
155 |
|
155 | |||
156 | return 1 |
|
156 | return 1 | |
157 |
|
157 | |||
158 | def write(self, fp): |
|
158 | def write(self, fp): | |
159 |
|
159 | |||
160 | headerTuple = (self.size,self.version,self.dataBlock,self.utc,self.miliSecond,self.timeZone,self.dstFlag,self.errorCount) |
|
160 | headerTuple = (self.size,self.version,self.dataBlock,self.utc,self.miliSecond,self.timeZone,self.dstFlag,self.errorCount) | |
161 | header = numpy.array(headerTuple, BASIC_STRUCTURE) |
|
161 | header = numpy.array(headerTuple, BASIC_STRUCTURE) | |
162 | header.tofile(fp) |
|
162 | header.tofile(fp) | |
163 |
|
163 | |||
164 | return 1 |
|
164 | return 1 | |
165 |
|
165 | |||
166 | def get_ltc(self): |
|
166 | def get_ltc(self): | |
167 |
|
167 | |||
168 | return self.utc - self.timeZone*60 |
|
168 | return self.utc - self.timeZone*60 | |
169 |
|
169 | |||
170 | def set_ltc(self, value): |
|
170 | def set_ltc(self, value): | |
171 |
|
171 | |||
172 | self.utc = value + self.timeZone*60 |
|
172 | self.utc = value + self.timeZone*60 | |
173 |
|
173 | |||
174 | def get_datatime(self): |
|
174 | def get_datatime(self): | |
175 |
|
175 | |||
176 | return datetime.datetime.utcfromtimestamp(self.ltc) |
|
176 | return datetime.datetime.utcfromtimestamp(self.ltc) | |
177 |
|
177 | |||
178 | ltc = property(get_ltc, set_ltc) |
|
178 | ltc = property(get_ltc, set_ltc) | |
179 | datatime = property(get_datatime) |
|
179 | datatime = property(get_datatime) | |
180 |
|
180 | |||
181 | class SystemHeader(Header): |
|
181 | class SystemHeader(Header): | |
182 |
|
182 | |||
183 | size = None |
|
183 | size = None | |
184 | nSamples = None |
|
184 | nSamples = None | |
185 | nProfiles = None |
|
185 | nProfiles = None | |
186 | nChannels = None |
|
186 | nChannels = None | |
187 | adcResolution = None |
|
187 | adcResolution = None | |
188 | pciDioBusWidth = None |
|
188 | pciDioBusWidth = None | |
189 |
|
189 | |||
190 | def __init__(self, nSamples=0, nProfiles=0, nChannels=0, adcResolution=14, pciDioBusWith=0): |
|
190 | def __init__(self, nSamples=0, nProfiles=0, nChannels=0, adcResolution=14, pciDioBusWith=0): | |
191 |
|
191 | |||
192 | self.size = 24 |
|
192 | self.size = 24 | |
193 | self.nSamples = nSamples |
|
193 | self.nSamples = nSamples | |
194 | self.nProfiles = nProfiles |
|
194 | self.nProfiles = nProfiles | |
195 | self.nChannels = nChannels |
|
195 | self.nChannels = nChannels | |
196 | self.adcResolution = adcResolution |
|
196 | self.adcResolution = adcResolution | |
197 | self.pciDioBusWidth = pciDioBusWith |
|
197 | self.pciDioBusWidth = pciDioBusWith | |
198 |
|
198 | |||
199 | def read(self, fp): |
|
199 | def read(self, fp): | |
200 |
|
200 | |||
201 | startFp = fp.tell() |
|
201 | startFp = fp.tell() | |
202 |
|
202 | |||
203 | try: |
|
203 | try: | |
204 | header = numpy.fromfile(fp,SYSTEM_STRUCTURE,1) |
|
204 | header = numpy.fromfile(fp,SYSTEM_STRUCTURE,1) | |
205 | except Exception, e: |
|
205 | except Exception, e: | |
206 | print "System Header: " + e |
|
206 | print "System Header: " + e | |
207 | return 0 |
|
207 | return 0 | |
208 |
|
208 | |||
209 | self.size = header['nSize'][0] |
|
209 | self.size = header['nSize'][0] | |
210 | self.nSamples = header['nNumSamples'][0] |
|
210 | self.nSamples = header['nNumSamples'][0] | |
211 | self.nProfiles = header['nNumProfiles'][0] |
|
211 | self.nProfiles = header['nNumProfiles'][0] | |
212 | self.nChannels = header['nNumChannels'][0] |
|
212 | self.nChannels = header['nNumChannels'][0] | |
213 | self.adcResolution = header['nADCResolution'][0] |
|
213 | self.adcResolution = header['nADCResolution'][0] | |
214 | self.pciDioBusWidth = header['nPCDIOBusWidth'][0] |
|
214 | self.pciDioBusWidth = header['nPCDIOBusWidth'][0] | |
215 |
|
215 | |||
216 | endFp = self.size + startFp |
|
216 | endFp = self.size + startFp | |
217 |
|
217 | |||
218 | if fp.tell() > endFp: |
|
218 | if fp.tell() > endFp: | |
219 | sys.stderr.write("Warning %s: Size value read from System Header is lower than it has to be\n" %fp.name) |
|
219 | sys.stderr.write("Warning %s: Size value read from System Header is lower than it has to be\n" %fp.name) | |
220 | return 0 |
|
220 | return 0 | |
221 |
|
221 | |||
222 | if fp.tell() < endFp: |
|
222 | if fp.tell() < endFp: | |
223 | sys.stderr.write("Warning %s: Size value read from System Header size is greater than it has to be\n" %fp.name) |
|
223 | sys.stderr.write("Warning %s: Size value read from System Header size is greater than it has to be\n" %fp.name) | |
224 | return 0 |
|
224 | return 0 | |
225 |
|
225 | |||
226 | return 1 |
|
226 | return 1 | |
227 |
|
227 | |||
228 | def write(self, fp): |
|
228 | def write(self, fp): | |
229 |
|
229 | |||
230 | headerTuple = (self.size,self.nSamples,self.nProfiles,self.nChannels,self.adcResolution,self.pciDioBusWidth) |
|
230 | headerTuple = (self.size,self.nSamples,self.nProfiles,self.nChannels,self.adcResolution,self.pciDioBusWidth) | |
231 | header = numpy.array(headerTuple,SYSTEM_STRUCTURE) |
|
231 | header = numpy.array(headerTuple,SYSTEM_STRUCTURE) | |
232 | header.tofile(fp) |
|
232 | header.tofile(fp) | |
233 |
|
233 | |||
234 | return 1 |
|
234 | return 1 | |
235 |
|
235 | |||
236 | class RadarControllerHeader(Header): |
|
236 | class RadarControllerHeader(Header): | |
237 |
|
237 | |||
238 | expType = None |
|
238 | expType = None | |
239 | nTx = None |
|
239 | nTx = None | |
240 | ipp = None |
|
240 | ipp = None | |
241 | txA = None |
|
241 | txA = None | |
242 | txB = None |
|
242 | txB = None | |
243 | nWindows = None |
|
243 | nWindows = None | |
244 | numTaus = None |
|
244 | numTaus = None | |
245 | codeType = None |
|
245 | codeType = None | |
246 | line6Function = None |
|
246 | line6Function = None | |
247 | line5Function = None |
|
247 | line5Function = None | |
248 | fClock = None |
|
248 | fClock = None | |
249 | prePulseBefore = None |
|
249 | prePulseBefore = None | |
250 | prePulserAfter = None |
|
250 | prePulserAfter = None | |
251 | rangeIpp = None |
|
251 | rangeIpp = None | |
252 | rangeTxA = None |
|
252 | rangeTxA = None | |
253 | rangeTxB = None |
|
253 | rangeTxB = None | |
254 |
|
254 | |||
255 | __size = None |
|
255 | __size = None | |
256 |
|
256 | |||
257 | def __init__(self, expType=2, nTx=1, |
|
257 | def __init__(self, expType=2, nTx=1, | |
258 | ippKm=None, txA=0, txB=0, |
|
258 | ippKm=None, txA=0, txB=0, | |
259 | nWindows=None, nHeights=None, firstHeight=None, deltaHeight=None, |
|
259 | nWindows=None, nHeights=None, firstHeight=None, deltaHeight=None, | |
260 | numTaus=0, line6Function=0, line5Function=0, fClock=None, |
|
260 | numTaus=0, line6Function=0, line5Function=0, fClock=None, | |
261 | prePulseBefore=0, prePulseAfter=0, |
|
261 | prePulseBefore=0, prePulseAfter=0, | |
262 | codeType=0, nCode=0, nBaud=0, code=None, |
|
262 | codeType=0, nCode=0, nBaud=0, code=None, | |
263 | flip1=0, flip2=0): |
|
263 | flip1=0, flip2=0): | |
264 |
|
264 | |||
265 | # self.size = 116 |
|
265 | # self.size = 116 | |
266 | self.expType = expType |
|
266 | self.expType = expType | |
267 | self.nTx = nTx |
|
267 | self.nTx = nTx | |
268 | self.ipp = ippKm |
|
268 | self.ipp = ippKm | |
269 | self.txA = txA |
|
269 | self.txA = txA | |
270 | self.txB = txB |
|
270 | self.txB = txB | |
271 | self.rangeIpp = ippKm |
|
271 | self.rangeIpp = ippKm | |
272 | self.rangeTxA = txA |
|
272 | self.rangeTxA = txA | |
273 | self.rangeTxB = txB |
|
273 | self.rangeTxB = txB | |
274 |
|
274 | |||
275 | self.nWindows = nWindows |
|
275 | self.nWindows = nWindows | |
276 | self.numTaus = numTaus |
|
276 | self.numTaus = numTaus | |
277 | self.codeType = codeType |
|
277 | self.codeType = codeType | |
278 | self.line6Function = line6Function |
|
278 | self.line6Function = line6Function | |
279 | self.line5Function = line5Function |
|
279 | self.line5Function = line5Function | |
280 | self.fClock = fClock |
|
280 | self.fClock = fClock | |
281 | self.prePulseBefore = prePulseBefore |
|
281 | self.prePulseBefore = prePulseBefore | |
282 | self.prePulserAfter = prePulseAfter |
|
282 | self.prePulserAfter = prePulseAfter | |
283 |
|
283 | |||
284 | self.nHeights = nHeights |
|
284 | self.nHeights = nHeights | |
285 | self.firstHeight = firstHeight |
|
285 | self.firstHeight = firstHeight | |
286 | self.deltaHeight = deltaHeight |
|
286 | self.deltaHeight = deltaHeight | |
287 | self.samplesWin = nHeights |
|
287 | self.samplesWin = nHeights | |
288 |
|
288 | |||
289 | self.nCode = nCode |
|
289 | self.nCode = nCode | |
290 | self.nBaud = nBaud |
|
290 | self.nBaud = nBaud | |
291 | self.code = code |
|
291 | self.code = code | |
292 | self.flip1 = flip1 |
|
292 | self.flip1 = flip1 | |
293 | self.flip2 = flip2 |
|
293 | self.flip2 = flip2 | |
294 |
|
294 | |||
295 | self.code_size = int(numpy.ceil(self.nBaud/32.))*self.nCode*4 |
|
295 | self.code_size = int(numpy.ceil(self.nBaud/32.))*self.nCode*4 | |
296 | # self.dynamic = numpy.array([],numpy.dtype('byte')) |
|
296 | # self.dynamic = numpy.array([],numpy.dtype('byte')) | |
297 |
|
297 | |||
298 | if self.fClock is None and self.deltaHeight is not None: |
|
298 | if self.fClock is None and self.deltaHeight is not None: | |
299 | self.fClock = 0.15/(deltaHeight*1e-6) #0.15Km / (height * 1u) |
|
299 | self.fClock = 0.15/(deltaHeight*1e-6) #0.15Km / (height * 1u) | |
300 |
|
300 | |||
301 | def read(self, fp): |
|
301 | def read(self, fp): | |
302 |
|
302 | |||
303 |
|
303 | |||
304 | startFp = fp.tell() |
|
304 | startFp = fp.tell() | |
305 | try: |
|
305 | try: | |
306 | header = numpy.fromfile(fp,RADAR_STRUCTURE,1) |
|
306 | header = numpy.fromfile(fp,RADAR_STRUCTURE,1) | |
307 | except Exception, e: |
|
307 | except Exception, e: | |
308 | print "RadarControllerHeader: " + e |
|
308 | print "RadarControllerHeader: " + e | |
309 | return 0 |
|
309 | return 0 | |
310 |
|
310 | |||
311 | size = int(header['nSize'][0]) |
|
311 | size = int(header['nSize'][0]) | |
312 | self.expType = int(header['nExpType'][0]) |
|
312 | self.expType = int(header['nExpType'][0]) | |
313 | self.nTx = int(header['nNTx'][0]) |
|
313 | self.nTx = int(header['nNTx'][0]) | |
314 | self.ipp = float(header['fIpp'][0]) |
|
314 | self.ipp = float(header['fIpp'][0]) | |
315 | self.txA = float(header['fTxA'][0]) |
|
315 | self.txA = float(header['fTxA'][0]) | |
316 | self.txB = float(header['fTxB'][0]) |
|
316 | self.txB = float(header['fTxB'][0]) | |
317 | self.nWindows = int(header['nNumWindows'][0]) |
|
317 | self.nWindows = int(header['nNumWindows'][0]) | |
318 | self.numTaus = int(header['nNumTaus'][0]) |
|
318 | self.numTaus = int(header['nNumTaus'][0]) | |
319 | self.codeType = int(header['nCodeType'][0]) |
|
319 | self.codeType = int(header['nCodeType'][0]) | |
320 | self.line6Function = int(header['nLine6Function'][0]) |
|
320 | self.line6Function = int(header['nLine6Function'][0]) | |
321 | self.line5Function = int(header['nLine5Function'][0]) |
|
321 | self.line5Function = int(header['nLine5Function'][0]) | |
322 | self.fClock = float(header['fClock'][0]) |
|
322 | self.fClock = float(header['fClock'][0]) | |
323 | self.prePulseBefore = int(header['nPrePulseBefore'][0]) |
|
323 | self.prePulseBefore = int(header['nPrePulseBefore'][0]) | |
324 | self.prePulserAfter = int(header['nPrePulseAfter'][0]) |
|
324 | self.prePulserAfter = int(header['nPrePulseAfter'][0]) | |
325 | self.rangeIpp = header['sRangeIPP'][0] |
|
325 | self.rangeIpp = header['sRangeIPP'][0] | |
326 | self.rangeTxA = header['sRangeTxA'][0] |
|
326 | self.rangeTxA = header['sRangeTxA'][0] | |
327 | self.rangeTxB = header['sRangeTxB'][0] |
|
327 | self.rangeTxB = header['sRangeTxB'][0] | |
328 |
|
328 | |||
329 | samplingWindow = numpy.fromfile(fp,SAMPLING_STRUCTURE,self.nWindows) |
|
329 | samplingWindow = numpy.fromfile(fp,SAMPLING_STRUCTURE,self.nWindows) | |
330 |
|
330 | |||
331 | self.nHeights = int(numpy.sum(samplingWindow['nsa'])) |
|
331 | self.nHeights = int(numpy.sum(samplingWindow['nsa'])) | |
332 | self.firstHeight = samplingWindow['h0'] |
|
332 | self.firstHeight = samplingWindow['h0'] | |
333 | self.deltaHeight = samplingWindow['dh'] |
|
333 | self.deltaHeight = samplingWindow['dh'] | |
334 | self.samplesWin = samplingWindow['nsa'] |
|
334 | self.samplesWin = samplingWindow['nsa'] | |
335 |
|
335 | |||
336 | self.Taus = numpy.fromfile(fp,'<f4',self.numTaus) |
|
336 | self.Taus = numpy.fromfile(fp,'<f4',self.numTaus) | |
337 |
|
337 | |||
338 | self.code_size = 0 |
|
338 | self.code_size = 0 | |
339 | if self.codeType != 0: |
|
339 | if self.codeType != 0: | |
340 | self.nCode = int(numpy.fromfile(fp,'<u4',1)) |
|
340 | self.nCode = int(numpy.fromfile(fp,'<u4',1)) | |
341 | self.nBaud = int(numpy.fromfile(fp,'<u4',1)) |
|
341 | self.nBaud = int(numpy.fromfile(fp,'<u4',1)) | |
342 |
|
342 | |||
343 | code = numpy.empty([self.nCode,self.nBaud],dtype='i1') |
|
343 | code = numpy.empty([self.nCode,self.nBaud],dtype='i1') | |
344 | for ic in range(self.nCode): |
|
344 | for ic in range(self.nCode): | |
345 | temp = numpy.fromfile(fp,'u4',int(numpy.ceil(self.nBaud/32.))) |
|
345 | temp = numpy.fromfile(fp,'u4',int(numpy.ceil(self.nBaud/32.))) | |
346 | for ib in range(self.nBaud-1,-1,-1): |
|
346 | for ib in range(self.nBaud-1,-1,-1): | |
347 | code[ic,ib] = temp[ib/32]%2 |
|
347 | code[ic,ib] = temp[ib/32]%2 | |
348 | temp[ib/32] = temp[ib/32]/2 |
|
348 | temp[ib/32] = temp[ib/32]/2 | |
349 |
|
349 | |||
350 | self.code = 2.0*code - 1.0 |
|
350 | self.code = 2.0*code - 1.0 | |
351 | self.code_size = int(numpy.ceil(self.nBaud/32.))*self.nCode*4 |
|
351 | self.code_size = int(numpy.ceil(self.nBaud/32.))*self.nCode*4 | |
352 |
|
352 | |||
353 | # if self.line5Function == RCfunction.FLIP: |
|
353 | # if self.line5Function == RCfunction.FLIP: | |
354 | # self.flip1 = numpy.fromfile(fp,'<u4',1) |
|
354 | # self.flip1 = numpy.fromfile(fp,'<u4',1) | |
355 | # |
|
355 | # | |
356 | # if self.line6Function == RCfunction.FLIP: |
|
356 | # if self.line6Function == RCfunction.FLIP: | |
357 | # self.flip2 = numpy.fromfile(fp,'<u4',1) |
|
357 | # self.flip2 = numpy.fromfile(fp,'<u4',1) | |
358 |
|
358 | |||
359 | endFp = size + startFp |
|
359 | endFp = size + startFp | |
360 |
|
360 | |||
361 | if fp.tell() != endFp: |
|
361 | if fp.tell() != endFp: | |
362 | # fp.seek(endFp) |
|
362 | # fp.seek(endFp) | |
363 | print "%s: Radar Controller Header size is not consistent: from data [%d] != from header field [%d]" %(fp.name, fp.tell()-startFp, size) |
|
363 | print "%s: Radar Controller Header size is not consistent: from data [%d] != from header field [%d]" %(fp.name, fp.tell()-startFp, size) | |
364 | # return 0 |
|
364 | # return 0 | |
365 |
|
365 | |||
366 | if fp.tell() > endFp: |
|
366 | if fp.tell() > endFp: | |
367 | sys.stderr.write("Warning %s: Size value read from Radar Controller header is lower than it has to be\n" %fp.name) |
|
367 | sys.stderr.write("Warning %s: Size value read from Radar Controller header is lower than it has to be\n" %fp.name) | |
368 | # return 0 |
|
368 | # return 0 | |
369 |
|
369 | |||
370 | if fp.tell() < endFp: |
|
370 | if fp.tell() < endFp: | |
371 | sys.stderr.write("Warning %s: Size value read from Radar Controller header is greater than it has to be\n" %fp.name) |
|
371 | sys.stderr.write("Warning %s: Size value read from Radar Controller header is greater than it has to be\n" %fp.name) | |
372 |
|
372 | |||
373 |
|
||||
374 | return 1 |
|
373 | return 1 | |
375 |
|
374 | |||
376 | def write(self, fp): |
|
375 | def write(self, fp): | |
377 |
|
376 | |||
378 | headerTuple = (self.size, |
|
377 | headerTuple = (self.size, | |
379 | self.expType, |
|
378 | self.expType, | |
380 | self.nTx, |
|
379 | self.nTx, | |
381 | self.ipp, |
|
380 | self.ipp, | |
382 | self.txA, |
|
381 | self.txA, | |
383 | self.txB, |
|
382 | self.txB, | |
384 | self.nWindows, |
|
383 | self.nWindows, | |
385 | self.numTaus, |
|
384 | self.numTaus, | |
386 | self.codeType, |
|
385 | self.codeType, | |
387 | self.line6Function, |
|
386 | self.line6Function, | |
388 | self.line5Function, |
|
387 | self.line5Function, | |
389 | self.fClock, |
|
388 | self.fClock, | |
390 | self.prePulseBefore, |
|
389 | self.prePulseBefore, | |
391 | self.prePulserAfter, |
|
390 | self.prePulserAfter, | |
392 | self.rangeIpp, |
|
391 | self.rangeIpp, | |
393 | self.rangeTxA, |
|
392 | self.rangeTxA, | |
394 | self.rangeTxB) |
|
393 | self.rangeTxB) | |
395 |
|
394 | |||
396 | header = numpy.array(headerTuple,RADAR_STRUCTURE) |
|
395 | header = numpy.array(headerTuple,RADAR_STRUCTURE) | |
397 | header.tofile(fp) |
|
396 | header.tofile(fp) | |
398 |
|
397 | |||
399 | sampleWindowTuple = (self.firstHeight,self.deltaHeight,self.samplesWin) |
|
398 | sampleWindowTuple = (self.firstHeight,self.deltaHeight,self.samplesWin) | |
400 | samplingWindow = numpy.array(sampleWindowTuple,SAMPLING_STRUCTURE) |
|
399 | samplingWindow = numpy.array(sampleWindowTuple,SAMPLING_STRUCTURE) | |
401 | samplingWindow.tofile(fp) |
|
400 | samplingWindow.tofile(fp) | |
402 |
|
401 | |||
403 | if self.numTaus > 0: |
|
402 | if self.numTaus > 0: | |
404 | self.Taus.tofile(fp) |
|
403 | self.Taus.tofile(fp) | |
405 |
|
404 | |||
406 | if self.codeType !=0: |
|
405 | if self.codeType !=0: | |
407 | nCode = numpy.array(self.nCode, '<u4') |
|
406 | nCode = numpy.array(self.nCode, '<u4') | |
408 | nCode.tofile(fp) |
|
407 | nCode.tofile(fp) | |
409 | nBaud = numpy.array(self.nBaud, '<u4') |
|
408 | nBaud = numpy.array(self.nBaud, '<u4') | |
410 | nBaud.tofile(fp) |
|
409 | nBaud.tofile(fp) | |
411 | code1 = (self.code + 1.0)/2. |
|
410 | code1 = (self.code + 1.0)/2. | |
412 |
|
411 | |||
413 | for ic in range(self.nCode): |
|
412 | for ic in range(self.nCode): | |
414 | tempx = numpy.zeros(numpy.ceil(self.nBaud/32.)) |
|
413 | tempx = numpy.zeros(numpy.ceil(self.nBaud/32.)) | |
415 | start = 0 |
|
414 | start = 0 | |
416 | end = 32 |
|
415 | end = 32 | |
417 | for i in range(len(tempx)): |
|
416 | for i in range(len(tempx)): | |
418 | code_selected = code1[ic,start:end] |
|
417 | code_selected = code1[ic,start:end] | |
419 | for j in range(len(code_selected)-1,-1,-1): |
|
418 | for j in range(len(code_selected)-1,-1,-1): | |
420 | if code_selected[j] == 1: |
|
419 | if code_selected[j] == 1: | |
421 | tempx[i] = tempx[i] + 2**(len(code_selected)-1-j) |
|
420 | tempx[i] = tempx[i] + 2**(len(code_selected)-1-j) | |
422 | start = start + 32 |
|
421 | start = start + 32 | |
423 | end = end + 32 |
|
422 | end = end + 32 | |
424 |
|
423 | |||
425 | tempx = tempx.astype('u4') |
|
424 | tempx = tempx.astype('u4') | |
426 | tempx.tofile(fp) |
|
425 | tempx.tofile(fp) | |
427 |
|
426 | |||
428 | # if self.line5Function == RCfunction.FLIP: |
|
427 | # if self.line5Function == RCfunction.FLIP: | |
429 | # self.flip1.tofile(fp) |
|
428 | # self.flip1.tofile(fp) | |
430 | # |
|
429 | # | |
431 | # if self.line6Function == RCfunction.FLIP: |
|
430 | # if self.line6Function == RCfunction.FLIP: | |
432 | # self.flip2.tofile(fp) |
|
431 | # self.flip2.tofile(fp) | |
433 |
|
432 | |||
434 | return 1 |
|
433 | return 1 | |
435 |
|
434 | |||
436 | def get_ippSeconds(self): |
|
435 | def get_ippSeconds(self): | |
437 | ''' |
|
436 | ''' | |
438 | ''' |
|
437 | ''' | |
439 | ippSeconds = 2.0 * 1000 * self.ipp / SPEED_OF_LIGHT |
|
438 | ippSeconds = 2.0 * 1000 * self.ipp / SPEED_OF_LIGHT | |
440 |
|
439 | |||
441 | return ippSeconds |
|
440 | return ippSeconds | |
442 |
|
441 | |||
443 | def set_ippSeconds(self, ippSeconds): |
|
442 | def set_ippSeconds(self, ippSeconds): | |
444 | ''' |
|
443 | ''' | |
445 | ''' |
|
444 | ''' | |
446 |
|
445 | |||
447 | self.ipp = ippSeconds * SPEED_OF_LIGHT / (2.0*1000) |
|
446 | self.ipp = ippSeconds * SPEED_OF_LIGHT / (2.0*1000) | |
448 |
|
447 | |||
449 | return |
|
448 | return | |
450 |
|
449 | |||
451 | def get_size(self): |
|
450 | def get_size(self): | |
452 |
|
451 | |||
453 | self.__size = 116 + 12*self.nWindows + 4*self.numTaus |
|
452 | self.__size = 116 + 12*self.nWindows + 4*self.numTaus | |
454 |
|
453 | |||
455 | if self.codeType != 0: |
|
454 | if self.codeType != 0: | |
456 | self.__size += 4 + 4 + 4*self.nCode*numpy.ceil(self.nBaud/32.) |
|
455 | self.__size += 4 + 4 + 4*self.nCode*numpy.ceil(self.nBaud/32.) | |
457 |
|
456 | |||
458 | return self.__size |
|
457 | return self.__size | |
459 |
|
458 | |||
460 | def set_size(self, value): |
|
459 | def set_size(self, value): | |
461 |
|
460 | |||
462 | raise IOError, "size is a property and it cannot be set, just read" |
|
461 | raise IOError, "size is a property and it cannot be set, just read" | |
463 |
|
462 | |||
464 | return |
|
463 | return | |
465 |
|
464 | |||
466 | ippSeconds = property(get_ippSeconds, set_ippSeconds) |
|
465 | ippSeconds = property(get_ippSeconds, set_ippSeconds) | |
467 | size = property(get_size, set_size) |
|
466 | size = property(get_size, set_size) | |
468 |
|
467 | |||
469 | class ProcessingHeader(Header): |
|
468 | class ProcessingHeader(Header): | |
470 |
|
469 | |||
471 | # size = None |
|
470 | # size = None | |
472 | dtype = None |
|
471 | dtype = None | |
473 | blockSize = None |
|
472 | blockSize = None | |
474 | profilesPerBlock = None |
|
473 | profilesPerBlock = None | |
475 | dataBlocksPerFile = None |
|
474 | dataBlocksPerFile = None | |
476 | nWindows = None |
|
475 | nWindows = None | |
477 | processFlags = None |
|
476 | processFlags = None | |
478 | nCohInt = None |
|
477 | nCohInt = None | |
479 | nIncohInt = None |
|
478 | nIncohInt = None | |
480 | totalSpectra = None |
|
479 | totalSpectra = None | |
481 |
|
480 | |||
482 | flag_dc = None |
|
481 | flag_dc = None | |
483 | flag_cspc = None |
|
482 | flag_cspc = None | |
484 |
|
483 | |||
485 | def __init__(self): |
|
484 | def __init__(self): | |
486 |
|
485 | |||
487 | # self.size = 0 |
|
486 | # self.size = 0 | |
488 | self.dtype = 0 |
|
487 | self.dtype = 0 | |
489 | self.blockSize = 0 |
|
488 | self.blockSize = 0 | |
490 | self.profilesPerBlock = 0 |
|
489 | self.profilesPerBlock = 0 | |
491 | self.dataBlocksPerFile = 0 |
|
490 | self.dataBlocksPerFile = 0 | |
492 | self.nWindows = 0 |
|
491 | self.nWindows = 0 | |
493 | self.processFlags = 0 |
|
492 | self.processFlags = 0 | |
494 | self.nCohInt = 0 |
|
493 | self.nCohInt = 0 | |
495 | self.nIncohInt = 0 |
|
494 | self.nIncohInt = 0 | |
496 | self.totalSpectra = 0 |
|
495 | self.totalSpectra = 0 | |
497 |
|
496 | |||
498 | self.nHeights = 0 |
|
497 | self.nHeights = 0 | |
499 | self.firstHeight = 0 |
|
498 | self.firstHeight = 0 | |
500 | self.deltaHeight = 0 |
|
499 | self.deltaHeight = 0 | |
501 | self.samplesWin = 0 |
|
500 | self.samplesWin = 0 | |
502 | self.spectraComb = 0 |
|
501 | self.spectraComb = 0 | |
503 | self.nCode = None |
|
502 | self.nCode = None | |
504 | self.code = None |
|
503 | self.code = None | |
505 | self.nBaud = None |
|
504 | self.nBaud = None | |
506 |
|
505 | |||
507 | self.shif_fft = False |
|
506 | self.shif_fft = False | |
508 | self.flag_dc = False |
|
507 | self.flag_dc = False | |
509 | self.flag_cspc = False |
|
508 | self.flag_cspc = False | |
510 | self.flag_decode = False |
|
509 | self.flag_decode = False | |
511 | self.flag_deflip = False |
|
510 | self.flag_deflip = False | |
512 |
|
511 | |||
513 | def read(self, fp): |
|
512 | def read(self, fp): | |
514 |
|
513 | |||
515 | startFp = fp.tell() |
|
514 | startFp = fp.tell() | |
516 |
|
515 | |||
517 | try: |
|
516 | try: | |
518 | header = numpy.fromfile(fp,PROCESSING_STRUCTURE,1) |
|
517 | header = numpy.fromfile(fp,PROCESSING_STRUCTURE,1) | |
519 | except Exception, e: |
|
518 | except Exception, e: | |
520 | print "ProcessingHeader: " + e |
|
519 | print "ProcessingHeader: " + e | |
521 | return 0 |
|
520 | return 0 | |
522 |
|
521 | |||
523 | size = int(header['nSize'][0]) |
|
522 | size = int(header['nSize'][0]) | |
524 | self.dtype = int(header['nDataType'][0]) |
|
523 | self.dtype = int(header['nDataType'][0]) | |
525 | self.blockSize = int(header['nSizeOfDataBlock'][0]) |
|
524 | self.blockSize = int(header['nSizeOfDataBlock'][0]) | |
526 | self.profilesPerBlock = int(header['nProfilesperBlock'][0]) |
|
525 | self.profilesPerBlock = int(header['nProfilesperBlock'][0]) | |
527 | self.dataBlocksPerFile = int(header['nDataBlocksperFile'][0]) |
|
526 | self.dataBlocksPerFile = int(header['nDataBlocksperFile'][0]) | |
528 | self.nWindows = int(header['nNumWindows'][0]) |
|
527 | self.nWindows = int(header['nNumWindows'][0]) | |
529 | self.processFlags = header['nProcessFlags'] |
|
528 | self.processFlags = header['nProcessFlags'] | |
530 | self.nCohInt = int(header['nCoherentIntegrations'][0]) |
|
529 | self.nCohInt = int(header['nCoherentIntegrations'][0]) | |
531 | self.nIncohInt = int(header['nIncoherentIntegrations'][0]) |
|
530 | self.nIncohInt = int(header['nIncoherentIntegrations'][0]) | |
532 | self.totalSpectra = int(header['nTotalSpectra'][0]) |
|
531 | self.totalSpectra = int(header['nTotalSpectra'][0]) | |
533 |
|
532 | |||
534 | samplingWindow = numpy.fromfile(fp,SAMPLING_STRUCTURE,self.nWindows) |
|
533 | samplingWindow = numpy.fromfile(fp,SAMPLING_STRUCTURE,self.nWindows) | |
535 |
|
534 | |||
536 | self.nHeights = int(numpy.sum(samplingWindow['nsa'])) |
|
535 | self.nHeights = int(numpy.sum(samplingWindow['nsa'])) | |
537 | self.firstHeight = float(samplingWindow['h0'][0]) |
|
536 | self.firstHeight = float(samplingWindow['h0'][0]) | |
538 | self.deltaHeight = float(samplingWindow['dh'][0]) |
|
537 | self.deltaHeight = float(samplingWindow['dh'][0]) | |
539 | self.samplesWin = samplingWindow['nsa'][0] |
|
538 | self.samplesWin = samplingWindow['nsa'][0] | |
540 |
|
539 | |||
541 | self.spectraComb = numpy.fromfile(fp,'u1',2*self.totalSpectra) |
|
540 | self.spectraComb = numpy.fromfile(fp,'u1',2*self.totalSpectra) | |
542 |
|
541 | |||
543 | if ((self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE) == PROCFLAG.DEFINE_PROCESS_CODE): |
|
542 | if ((self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE) == PROCFLAG.DEFINE_PROCESS_CODE): | |
544 | self.nCode = int(numpy.fromfile(fp,'<u4',1)) |
|
543 | self.nCode = int(numpy.fromfile(fp,'<u4',1)) | |
545 | self.nBaud = int(numpy.fromfile(fp,'<u4',1)) |
|
544 | self.nBaud = int(numpy.fromfile(fp,'<u4',1)) | |
546 | self.code = numpy.fromfile(fp,'<f4',self.nCode*self.nBaud).reshape(self.nCode,self.nBaud) |
|
545 | self.code = numpy.fromfile(fp,'<f4',self.nCode*self.nBaud).reshape(self.nCode,self.nBaud) | |
547 |
|
546 | |||
548 | if ((self.processFlags & PROCFLAG.EXP_NAME_ESP) == PROCFLAG.EXP_NAME_ESP): |
|
547 | if ((self.processFlags & PROCFLAG.EXP_NAME_ESP) == PROCFLAG.EXP_NAME_ESP): | |
549 | exp_name_len = int(numpy.fromfile(fp,'<u4',1)) |
|
548 | exp_name_len = int(numpy.fromfile(fp,'<u4',1)) | |
550 | exp_name = numpy.fromfile(fp,'u1',exp_name_len+1) |
|
549 | exp_name = numpy.fromfile(fp,'u1',exp_name_len+1) | |
551 |
|
550 | |||
552 | if ((self.processFlags & PROCFLAG.SHIFT_FFT_DATA) == PROCFLAG.SHIFT_FFT_DATA): |
|
551 | if ((self.processFlags & PROCFLAG.SHIFT_FFT_DATA) == PROCFLAG.SHIFT_FFT_DATA): | |
553 | self.shif_fft = True |
|
552 | self.shif_fft = True | |
554 | else: |
|
553 | else: | |
555 | self.shif_fft = False |
|
554 | self.shif_fft = False | |
556 |
|
555 | |||
557 | if ((self.processFlags & PROCFLAG.SAVE_CHANNELS_DC) == PROCFLAG.SAVE_CHANNELS_DC): |
|
556 | if ((self.processFlags & PROCFLAG.SAVE_CHANNELS_DC) == PROCFLAG.SAVE_CHANNELS_DC): | |
558 | self.flag_dc = True |
|
557 | self.flag_dc = True | |
559 | else: |
|
558 | else: | |
560 | self.flag_dc = False |
|
559 | self.flag_dc = False | |
561 |
|
560 | |||
562 | if ((self.processFlags & PROCFLAG.DECODE_DATA) == PROCFLAG.DECODE_DATA): |
|
561 | if ((self.processFlags & PROCFLAG.DECODE_DATA) == PROCFLAG.DECODE_DATA): | |
563 | self.flag_decode = True |
|
562 | self.flag_decode = True | |
564 | else: |
|
563 | else: | |
565 | self.flag_decode = False |
|
564 | self.flag_decode = False | |
566 |
|
565 | |||
567 | if ((self.processFlags & PROCFLAG.DEFLIP_DATA) == PROCFLAG.DEFLIP_DATA): |
|
566 | if ((self.processFlags & PROCFLAG.DEFLIP_DATA) == PROCFLAG.DEFLIP_DATA): | |
568 | self.flag_deflip = True |
|
567 | self.flag_deflip = True | |
569 | else: |
|
568 | else: | |
570 | self.flag_deflip = False |
|
569 | self.flag_deflip = False | |
571 |
|
570 | |||
572 | nChannels = 0 |
|
571 | nChannels = 0 | |
573 | nPairs = 0 |
|
572 | nPairs = 0 | |
574 | pairList = [] |
|
573 | pairList = [] | |
575 |
|
574 | |||
576 | for i in range( 0, self.totalSpectra*2, 2 ): |
|
575 | for i in range( 0, self.totalSpectra*2, 2 ): | |
577 | if self.spectraComb[i] == self.spectraComb[i+1]: |
|
576 | if self.spectraComb[i] == self.spectraComb[i+1]: | |
578 | nChannels = nChannels + 1 #par de canales iguales |
|
577 | nChannels = nChannels + 1 #par de canales iguales | |
579 | else: |
|
578 | else: | |
580 | nPairs = nPairs + 1 #par de canales diferentes |
|
579 | nPairs = nPairs + 1 #par de canales diferentes | |
581 | pairList.append( (self.spectraComb[i], self.spectraComb[i+1]) ) |
|
580 | pairList.append( (self.spectraComb[i], self.spectraComb[i+1]) ) | |
582 |
|
581 | |||
583 | self.flag_cspc = False |
|
582 | self.flag_cspc = False | |
584 | if nPairs > 0: |
|
583 | if nPairs > 0: | |
585 | self.flag_cspc = True |
|
584 | self.flag_cspc = True | |
586 |
|
585 | |||
587 | endFp = size + startFp |
|
586 | endFp = size + startFp | |
588 |
|
587 | |||
589 | if fp.tell() > endFp: |
|
588 | if fp.tell() > endFp: | |
590 | sys.stderr.write("Warning: Processing header size is lower than it has to be") |
|
589 | sys.stderr.write("Warning: Processing header size is lower than it has to be") | |
591 | return 0 |
|
590 | return 0 | |
592 |
|
591 | |||
593 | if fp.tell() < endFp: |
|
592 | if fp.tell() < endFp: | |
594 | sys.stderr.write("Warning: Processing header size is greater than it is considered") |
|
593 | sys.stderr.write("Warning: Processing header size is greater than it is considered") | |
595 |
|
594 | |||
596 | return 1 |
|
595 | return 1 | |
597 |
|
596 | |||
598 | def write(self, fp): |
|
597 | def write(self, fp): | |
599 | #Clear DEFINE_PROCESS_CODE |
|
598 | #Clear DEFINE_PROCESS_CODE | |
600 | self.processFlags = self.processFlags & (~PROCFLAG.DEFINE_PROCESS_CODE) |
|
599 | self.processFlags = self.processFlags & (~PROCFLAG.DEFINE_PROCESS_CODE) | |
601 |
|
600 | |||
602 | headerTuple = (self.size, |
|
601 | headerTuple = (self.size, | |
603 | self.dtype, |
|
602 | self.dtype, | |
604 | self.blockSize, |
|
603 | self.blockSize, | |
605 | self.profilesPerBlock, |
|
604 | self.profilesPerBlock, | |
606 | self.dataBlocksPerFile, |
|
605 | self.dataBlocksPerFile, | |
607 | self.nWindows, |
|
606 | self.nWindows, | |
608 | self.processFlags, |
|
607 | self.processFlags, | |
609 | self.nCohInt, |
|
608 | self.nCohInt, | |
610 | self.nIncohInt, |
|
609 | self.nIncohInt, | |
611 | self.totalSpectra) |
|
610 | self.totalSpectra) | |
612 |
|
611 | |||
613 | header = numpy.array(headerTuple,PROCESSING_STRUCTURE) |
|
612 | header = numpy.array(headerTuple,PROCESSING_STRUCTURE) | |
614 | header.tofile(fp) |
|
613 | header.tofile(fp) | |
615 |
|
614 | |||
616 | if self.nWindows != 0: |
|
615 | if self.nWindows != 0: | |
617 | sampleWindowTuple = (self.firstHeight,self.deltaHeight,self.samplesWin) |
|
616 | sampleWindowTuple = (self.firstHeight,self.deltaHeight,self.samplesWin) | |
618 | samplingWindow = numpy.array(sampleWindowTuple,SAMPLING_STRUCTURE) |
|
617 | samplingWindow = numpy.array(sampleWindowTuple,SAMPLING_STRUCTURE) | |
619 | samplingWindow.tofile(fp) |
|
618 | samplingWindow.tofile(fp) | |
620 |
|
619 | |||
621 | if self.totalSpectra != 0: |
|
620 | if self.totalSpectra != 0: | |
622 | # spectraComb = numpy.array([],numpy.dtype('u1')) |
|
621 | # spectraComb = numpy.array([],numpy.dtype('u1')) | |
623 | spectraComb = self.spectraComb |
|
622 | spectraComb = self.spectraComb | |
624 | spectraComb.tofile(fp) |
|
623 | spectraComb.tofile(fp) | |
625 |
|
624 | |||
626 | # if self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE == PROCFLAG.DEFINE_PROCESS_CODE: |
|
625 | # if self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE == PROCFLAG.DEFINE_PROCESS_CODE: | |
627 | # nCode = numpy.array([self.nCode], numpy.dtype('u4')) #Probar con un dato que almacene codigo, hasta el momento no se hizo la prueba |
|
626 | # nCode = numpy.array([self.nCode], numpy.dtype('u4')) #Probar con un dato que almacene codigo, hasta el momento no se hizo la prueba | |
628 | # nCode.tofile(fp) |
|
627 | # nCode.tofile(fp) | |
629 | # |
|
628 | # | |
630 | # nBaud = numpy.array([self.nBaud], numpy.dtype('u4')) |
|
629 | # nBaud = numpy.array([self.nBaud], numpy.dtype('u4')) | |
631 | # nBaud.tofile(fp) |
|
630 | # nBaud.tofile(fp) | |
632 | # |
|
631 | # | |
633 | # code = self.code.reshape(self.nCode*self.nBaud) |
|
632 | # code = self.code.reshape(self.nCode*self.nBaud) | |
634 | # code = code.astype(numpy.dtype('<f4')) |
|
633 | # code = code.astype(numpy.dtype('<f4')) | |
635 | # code.tofile(fp) |
|
634 | # code.tofile(fp) | |
636 |
|
635 | |||
637 | return 1 |
|
636 | return 1 | |
638 |
|
637 | |||
639 | def get_size(self): |
|
638 | def get_size(self): | |
640 |
|
639 | |||
641 | self.__size = 40 + 12*self.nWindows + 2*self.totalSpectra |
|
640 | self.__size = 40 + 12*self.nWindows + 2*self.totalSpectra | |
642 |
|
641 | |||
643 | # if self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE == PROCFLAG.DEFINE_PROCESS_CODE: |
|
642 | # if self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE == PROCFLAG.DEFINE_PROCESS_CODE: | |
644 | # self.__size += 4 + 4 + 4*self.nCode*numpy.ceil(self.nBaud/32.) |
|
643 | # self.__size += 4 + 4 + 4*self.nCode*numpy.ceil(self.nBaud/32.) | |
645 | # self.__size += 4 + 4 + 4 * self.nCode * self.nBaud |
|
644 | # self.__size += 4 + 4 + 4 * self.nCode * self.nBaud | |
646 |
|
645 | |||
647 | return self.__size |
|
646 | return self.__size | |
648 |
|
647 | |||
649 | def set_size(self, value): |
|
648 | def set_size(self, value): | |
650 |
|
649 | |||
651 | raise IOError, "size is a property and it cannot be set, just read" |
|
650 | raise IOError, "size is a property and it cannot be set, just read" | |
652 |
|
651 | |||
653 | return |
|
652 | return | |
654 |
|
653 | |||
655 | size = property(get_size, set_size) |
|
654 | size = property(get_size, set_size) | |
656 |
|
655 | |||
657 | class RCfunction: |
|
656 | class RCfunction: | |
658 | NONE=0 |
|
657 | NONE=0 | |
659 | FLIP=1 |
|
658 | FLIP=1 | |
660 | CODE=2 |
|
659 | CODE=2 | |
661 | SAMPLING=3 |
|
660 | SAMPLING=3 | |
662 | LIN6DIV256=4 |
|
661 | LIN6DIV256=4 | |
663 | SYNCHRO=5 |
|
662 | SYNCHRO=5 | |
664 |
|
663 | |||
665 | class nCodeType: |
|
664 | class nCodeType: | |
666 | NONE=0 |
|
665 | NONE=0 | |
667 | USERDEFINE=1 |
|
666 | USERDEFINE=1 | |
668 | BARKER2=2 |
|
667 | BARKER2=2 | |
669 | BARKER3=3 |
|
668 | BARKER3=3 | |
670 | BARKER4=4 |
|
669 | BARKER4=4 | |
671 | BARKER5=5 |
|
670 | BARKER5=5 | |
672 | BARKER7=6 |
|
671 | BARKER7=6 | |
673 | BARKER11=7 |
|
672 | BARKER11=7 | |
674 | BARKER13=8 |
|
673 | BARKER13=8 | |
675 | AC128=9 |
|
674 | AC128=9 | |
676 | COMPLEMENTARYCODE2=10 |
|
675 | COMPLEMENTARYCODE2=10 | |
677 | COMPLEMENTARYCODE4=11 |
|
676 | COMPLEMENTARYCODE4=11 | |
678 | COMPLEMENTARYCODE8=12 |
|
677 | COMPLEMENTARYCODE8=12 | |
679 | COMPLEMENTARYCODE16=13 |
|
678 | COMPLEMENTARYCODE16=13 | |
680 | COMPLEMENTARYCODE32=14 |
|
679 | COMPLEMENTARYCODE32=14 | |
681 | COMPLEMENTARYCODE64=15 |
|
680 | COMPLEMENTARYCODE64=15 | |
682 | COMPLEMENTARYCODE128=16 |
|
681 | COMPLEMENTARYCODE128=16 | |
683 | CODE_BINARY28=17 |
|
682 | CODE_BINARY28=17 | |
684 |
|
683 | |||
685 | class PROCFLAG: |
|
684 | class PROCFLAG: | |
686 |
|
685 | |||
687 | COHERENT_INTEGRATION = numpy.uint32(0x00000001) |
|
686 | COHERENT_INTEGRATION = numpy.uint32(0x00000001) | |
688 | DECODE_DATA = numpy.uint32(0x00000002) |
|
687 | DECODE_DATA = numpy.uint32(0x00000002) | |
689 | SPECTRA_CALC = numpy.uint32(0x00000004) |
|
688 | SPECTRA_CALC = numpy.uint32(0x00000004) | |
690 | INCOHERENT_INTEGRATION = numpy.uint32(0x00000008) |
|
689 | INCOHERENT_INTEGRATION = numpy.uint32(0x00000008) | |
691 | POST_COHERENT_INTEGRATION = numpy.uint32(0x00000010) |
|
690 | POST_COHERENT_INTEGRATION = numpy.uint32(0x00000010) | |
692 | SHIFT_FFT_DATA = numpy.uint32(0x00000020) |
|
691 | SHIFT_FFT_DATA = numpy.uint32(0x00000020) | |
693 |
|
692 | |||
694 | DATATYPE_CHAR = numpy.uint32(0x00000040) |
|
693 | DATATYPE_CHAR = numpy.uint32(0x00000040) | |
695 | DATATYPE_SHORT = numpy.uint32(0x00000080) |
|
694 | DATATYPE_SHORT = numpy.uint32(0x00000080) | |
696 | DATATYPE_LONG = numpy.uint32(0x00000100) |
|
695 | DATATYPE_LONG = numpy.uint32(0x00000100) | |
697 | DATATYPE_INT64 = numpy.uint32(0x00000200) |
|
696 | DATATYPE_INT64 = numpy.uint32(0x00000200) | |
698 | DATATYPE_FLOAT = numpy.uint32(0x00000400) |
|
697 | DATATYPE_FLOAT = numpy.uint32(0x00000400) | |
699 | DATATYPE_DOUBLE = numpy.uint32(0x00000800) |
|
698 | DATATYPE_DOUBLE = numpy.uint32(0x00000800) | |
700 |
|
699 | |||
701 | DATAARRANGE_CONTIGUOUS_CH = numpy.uint32(0x00001000) |
|
700 | DATAARRANGE_CONTIGUOUS_CH = numpy.uint32(0x00001000) | |
702 | DATAARRANGE_CONTIGUOUS_H = numpy.uint32(0x00002000) |
|
701 | DATAARRANGE_CONTIGUOUS_H = numpy.uint32(0x00002000) | |
703 | DATAARRANGE_CONTIGUOUS_P = numpy.uint32(0x00004000) |
|
702 | DATAARRANGE_CONTIGUOUS_P = numpy.uint32(0x00004000) | |
704 |
|
703 | |||
705 | SAVE_CHANNELS_DC = numpy.uint32(0x00008000) |
|
704 | SAVE_CHANNELS_DC = numpy.uint32(0x00008000) | |
706 | DEFLIP_DATA = numpy.uint32(0x00010000) |
|
705 | DEFLIP_DATA = numpy.uint32(0x00010000) | |
707 | DEFINE_PROCESS_CODE = numpy.uint32(0x00020000) |
|
706 | DEFINE_PROCESS_CODE = numpy.uint32(0x00020000) | |
708 |
|
707 | |||
709 | ACQ_SYS_NATALIA = numpy.uint32(0x00040000) |
|
708 | ACQ_SYS_NATALIA = numpy.uint32(0x00040000) | |
710 | ACQ_SYS_ECHOTEK = numpy.uint32(0x00080000) |
|
709 | ACQ_SYS_ECHOTEK = numpy.uint32(0x00080000) | |
711 | ACQ_SYS_ADRXD = numpy.uint32(0x000C0000) |
|
710 | ACQ_SYS_ADRXD = numpy.uint32(0x000C0000) | |
712 | ACQ_SYS_JULIA = numpy.uint32(0x00100000) |
|
711 | ACQ_SYS_JULIA = numpy.uint32(0x00100000) | |
713 | ACQ_SYS_XXXXXX = numpy.uint32(0x00140000) |
|
712 | ACQ_SYS_XXXXXX = numpy.uint32(0x00140000) | |
714 |
|
713 | |||
715 | EXP_NAME_ESP = numpy.uint32(0x00200000) |
|
714 | EXP_NAME_ESP = numpy.uint32(0x00200000) | |
716 | CHANNEL_NAMES_ESP = numpy.uint32(0x00400000) |
|
715 | CHANNEL_NAMES_ESP = numpy.uint32(0x00400000) | |
717 |
|
716 | |||
718 | OPERATION_MASK = numpy.uint32(0x0000003F) |
|
717 | OPERATION_MASK = numpy.uint32(0x0000003F) | |
719 | DATATYPE_MASK = numpy.uint32(0x00000FC0) |
|
718 | DATATYPE_MASK = numpy.uint32(0x00000FC0) | |
720 | DATAARRANGE_MASK = numpy.uint32(0x00007000) |
|
719 | DATAARRANGE_MASK = numpy.uint32(0x00007000) | |
721 | ACQ_SYS_MASK = numpy.uint32(0x001C0000) |
|
720 | ACQ_SYS_MASK = numpy.uint32(0x001C0000) | |
722 |
|
721 | |||
723 | dtype0 = numpy.dtype([('real','<i1'),('imag','<i1')]) |
|
722 | dtype0 = numpy.dtype([('real','<i1'),('imag','<i1')]) | |
724 | dtype1 = numpy.dtype([('real','<i2'),('imag','<i2')]) |
|
723 | dtype1 = numpy.dtype([('real','<i2'),('imag','<i2')]) | |
725 | dtype2 = numpy.dtype([('real','<i4'),('imag','<i4')]) |
|
724 | dtype2 = numpy.dtype([('real','<i4'),('imag','<i4')]) | |
726 | dtype3 = numpy.dtype([('real','<i8'),('imag','<i8')]) |
|
725 | dtype3 = numpy.dtype([('real','<i8'),('imag','<i8')]) | |
727 | dtype4 = numpy.dtype([('real','<f4'),('imag','<f4')]) |
|
726 | dtype4 = numpy.dtype([('real','<f4'),('imag','<f4')]) | |
728 | dtype5 = numpy.dtype([('real','<f8'),('imag','<f8')]) |
|
727 | dtype5 = numpy.dtype([('real','<f8'),('imag','<f8')]) | |
729 |
|
728 | |||
730 | NUMPY_DTYPE_LIST = [dtype0, dtype1, dtype2, dtype3, dtype4, dtype5] |
|
729 | NUMPY_DTYPE_LIST = [dtype0, dtype1, dtype2, dtype3, dtype4, dtype5] | |
731 |
|
730 | |||
732 | PROCFLAG_DTYPE_LIST = [PROCFLAG.DATATYPE_CHAR, |
|
731 | PROCFLAG_DTYPE_LIST = [PROCFLAG.DATATYPE_CHAR, | |
733 | PROCFLAG.DATATYPE_SHORT, |
|
732 | PROCFLAG.DATATYPE_SHORT, | |
734 | PROCFLAG.DATATYPE_LONG, |
|
733 | PROCFLAG.DATATYPE_LONG, | |
735 | PROCFLAG.DATATYPE_INT64, |
|
734 | PROCFLAG.DATATYPE_INT64, | |
736 | PROCFLAG.DATATYPE_FLOAT, |
|
735 | PROCFLAG.DATATYPE_FLOAT, | |
737 | PROCFLAG.DATATYPE_DOUBLE] |
|
736 | PROCFLAG.DATATYPE_DOUBLE] | |
738 |
|
737 | |||
739 | DTYPE_WIDTH = [1, 2, 4, 8, 4, 8] |
|
738 | DTYPE_WIDTH = [1, 2, 4, 8, 4, 8] | |
740 |
|
739 | |||
741 | def get_dtype_index(numpy_dtype): |
|
740 | def get_dtype_index(numpy_dtype): | |
742 |
|
741 | |||
743 | index = None |
|
742 | index = None | |
744 |
|
743 | |||
745 | for i in range(len(NUMPY_DTYPE_LIST)): |
|
744 | for i in range(len(NUMPY_DTYPE_LIST)): | |
746 | if numpy_dtype == NUMPY_DTYPE_LIST[i]: |
|
745 | if numpy_dtype == NUMPY_DTYPE_LIST[i]: | |
747 | index = i |
|
746 | index = i | |
748 | break |
|
747 | break | |
749 |
|
748 | |||
750 | return index |
|
749 | return index | |
751 |
|
750 | |||
752 | def get_numpy_dtype(index): |
|
751 | def get_numpy_dtype(index): | |
753 |
|
752 | |||
754 | return NUMPY_DTYPE_LIST[index] |
|
753 | return NUMPY_DTYPE_LIST[index] | |
755 |
|
754 | |||
756 | def get_procflag_dtype(index): |
|
755 | def get_procflag_dtype(index): | |
757 |
|
756 | |||
758 | return PROCFLAG_DTYPE_LIST[index] |
|
757 | return PROCFLAG_DTYPE_LIST[index] | |
759 |
|
758 | |||
760 | def get_dtype_width(index): |
|
759 | def get_dtype_width(index): | |
761 |
|
760 | |||
762 | return DTYPE_WIDTH[index] No newline at end of file |
|
761 | return DTYPE_WIDTH[index] |
@@ -1,590 +1,596 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Jul 3, 2014 |
|
2 | Created on Jul 3, 2014 | |
3 |
|
3 | |||
4 | @author: roj-idl71 |
|
4 | @author: roj-idl71 | |
5 | ''' |
|
5 | ''' | |
6 | import os |
|
6 | import os | |
7 | import datetime |
|
7 | import datetime | |
8 | import numpy |
|
8 | import numpy | |
9 |
|
9 | |||
10 | try: |
|
10 | try: | |
11 | from gevent import sleep |
|
11 | from gevent import sleep | |
12 | except: |
|
12 | except: | |
13 | from time import sleep |
|
13 | from time import sleep | |
14 |
|
14 | |||
15 | from schainpy.model.data.jroheaderIO import RadarControllerHeader, SystemHeader |
|
15 | from schainpy.model.data.jroheaderIO import RadarControllerHeader, SystemHeader | |
16 | from schainpy.model.data.jrodata import Voltage |
|
16 | from schainpy.model.data.jrodata import Voltage | |
17 | from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation |
|
17 | from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation | |
18 |
|
18 | |||
19 | try: |
|
19 | try: | |
20 | import digital_rf |
|
20 | import digital_rf | |
21 | except: |
|
21 | except: | |
22 | print 'You should install "digital_rf" module if you want to read Digital RF data' |
|
22 | print 'You should install "digital_rf" module if you want to read Digital RF data' | |
23 |
|
23 | |||
24 | class DigitalRFReader(ProcessingUnit): |
|
24 | class DigitalRFReader(ProcessingUnit): | |
25 | ''' |
|
25 | ''' | |
26 | classdocs |
|
26 | classdocs | |
27 | ''' |
|
27 | ''' | |
28 |
|
28 | |||
29 | def __init__(self, **kwargs): |
|
29 | def __init__(self, **kwargs): | |
30 | ''' |
|
30 | ''' | |
31 | Constructor |
|
31 | Constructor | |
32 | ''' |
|
32 | ''' | |
33 |
|
33 | |||
34 | ProcessingUnit.__init__(self, **kwargs) |
|
34 | ProcessingUnit.__init__(self, **kwargs) | |
35 |
|
35 | |||
36 | self.dataOut = Voltage() |
|
36 | self.dataOut = Voltage() | |
37 | self.__printInfo = True |
|
37 | self.__printInfo = True | |
38 | self.__flagDiscontinuousBlock = False |
|
38 | self.__flagDiscontinuousBlock = False | |
39 | self.__bufferIndex = 9999999 |
|
39 | self.__bufferIndex = 9999999 | |
40 |
|
40 | |||
41 | self.__ippKm = None |
|
41 | self.__ippKm = None | |
42 | self.__codeType = 0 |
|
42 | self.__codeType = 0 | |
43 | self.__nCode = None |
|
43 | self.__nCode = None | |
44 | self.__nBaud = None |
|
44 | self.__nBaud = None | |
45 | self.__code = None |
|
45 | self.__code = None | |
46 |
|
46 | |||
47 | def __getCurrentSecond(self): |
|
47 | def __getCurrentSecond(self): | |
48 |
|
48 | |||
49 | return self.__thisUnixSample/self.__sample_rate |
|
49 | return self.__thisUnixSample/self.__sample_rate | |
50 |
|
50 | |||
51 | thisSecond = property(__getCurrentSecond, "I'm the 'thisSecond' property.") |
|
51 | thisSecond = property(__getCurrentSecond, "I'm the 'thisSecond' property.") | |
52 |
|
52 | |||
53 | def __setFileHeader(self): |
|
53 | def __setFileHeader(self): | |
54 | ''' |
|
54 | ''' | |
55 | In this method will be initialized every parameter of dataOut object (header, no data) |
|
55 | In this method will be initialized every parameter of dataOut object (header, no data) | |
56 | ''' |
|
56 | ''' | |
57 | ippSeconds = 1.0*self.__nSamples/self.__sample_rate |
|
57 | ippSeconds = 1.0*self.__nSamples/self.__sample_rate | |
58 |
|
58 | |||
59 | nProfiles = 1.0/ippSeconds #Number of profiles in one second |
|
59 | nProfiles = 1.0/ippSeconds #Number of profiles in one second | |
60 |
|
60 | |||
61 | self.dataOut.radarControllerHeaderObj = RadarControllerHeader(ippKm=self.__ippKm, |
|
61 | self.dataOut.radarControllerHeaderObj = RadarControllerHeader(ippKm=self.__ippKm, | |
62 | txA=0, |
|
62 | txA=0, | |
63 | txB=0, |
|
63 | txB=0, | |
64 | nWindows=1, |
|
64 | nWindows=1, | |
65 | nHeights=self.__nSamples, |
|
65 | nHeights=self.__nSamples, | |
66 | firstHeight=self.__firstHeigth, |
|
66 | firstHeight=self.__firstHeigth, | |
67 | deltaHeight=self.__deltaHeigth, |
|
67 | deltaHeight=self.__deltaHeigth, | |
68 | codeType=self.__codeType, |
|
68 | codeType=self.__codeType, | |
69 | nCode=self.__nCode, nBaud=self.__nBaud, |
|
69 | nCode=self.__nCode, nBaud=self.__nBaud, | |
70 | code = self.__code) |
|
70 | code = self.__code) | |
71 |
|
71 | |||
72 | self.dataOut.systemHeaderObj = SystemHeader(nSamples=self.__nSamples, |
|
72 | self.dataOut.systemHeaderObj = SystemHeader(nSamples=self.__nSamples, | |
73 | nProfiles=nProfiles, |
|
73 | nProfiles=nProfiles, | |
74 | nChannels=len(self.__channelList), |
|
74 | nChannels=len(self.__channelList), | |
75 | adcResolution=14) |
|
75 | adcResolution=14) | |
76 |
|
76 | |||
77 | self.dataOut.type = "Voltage" |
|
77 | self.dataOut.type = "Voltage" | |
78 |
|
78 | |||
79 | self.dataOut.data = None |
|
79 | self.dataOut.data = None | |
80 |
|
80 | |||
81 | self.dataOut.dtype = numpy.dtype([('real','<i8'),('imag','<i8')]) |
|
81 | self.dataOut.dtype = numpy.dtype([('real','<i8'),('imag','<i8')]) | |
82 |
|
82 | |||
83 | # self.dataOut.nChannels = 0 |
|
83 | # self.dataOut.nChannels = 0 | |
84 |
|
84 | |||
85 | # self.dataOut.nHeights = 0 |
|
85 | # self.dataOut.nHeights = 0 | |
86 |
|
86 | |||
87 | self.dataOut.nProfiles = nProfiles |
|
87 | self.dataOut.nProfiles = nProfiles | |
88 |
|
88 | |||
89 | self.dataOut.heightList = self.__firstHeigth + numpy.arange(self.__nSamples, dtype = numpy.float)*self.__deltaHeigth |
|
89 | self.dataOut.heightList = self.__firstHeigth + numpy.arange(self.__nSamples, dtype = numpy.float)*self.__deltaHeigth | |
90 |
|
90 | |||
91 | self.dataOut.channelList = self.__channelList |
|
91 | self.dataOut.channelList = self.__channelList | |
92 |
|
92 | |||
93 | self.dataOut.blocksize = self.dataOut.getNChannels() * self.dataOut.getNHeights() |
|
93 | self.dataOut.blocksize = self.dataOut.getNChannels() * self.dataOut.getNHeights() | |
94 |
|
94 | |||
95 | # self.dataOut.channelIndexList = None |
|
95 | # self.dataOut.channelIndexList = None | |
96 |
|
96 | |||
97 | self.dataOut.flagNoData = True |
|
97 | self.dataOut.flagNoData = True | |
98 |
|
98 | |||
99 | #Set to TRUE if the data is discontinuous |
|
99 | #Set to TRUE if the data is discontinuous | |
100 | self.dataOut.flagDiscontinuousBlock = False |
|
100 | self.dataOut.flagDiscontinuousBlock = False | |
101 |
|
101 | |||
102 | self.dataOut.utctime = None |
|
102 | self.dataOut.utctime = None | |
103 |
|
103 | |||
104 | self.dataOut.timeZone = self.__timezone/60 #timezone like jroheader, difference in minutes between UTC and localtime |
|
104 | self.dataOut.timeZone = self.__timezone/60 #timezone like jroheader, difference in minutes between UTC and localtime | |
105 |
|
105 | |||
106 | self.dataOut.dstFlag = 0 |
|
106 | self.dataOut.dstFlag = 0 | |
107 |
|
107 | |||
108 | self.dataOut.errorCount = 0 |
|
108 | self.dataOut.errorCount = 0 | |
109 |
|
109 | |||
110 | self.dataOut.nCohInt = 1 |
|
110 | self.dataOut.nCohInt = 1 | |
111 |
|
111 | |||
112 | self.dataOut.flagDecodeData = False #asumo que la data esta decodificada |
|
112 | self.dataOut.flagDecodeData = False #asumo que la data esta decodificada | |
113 |
|
113 | |||
114 | self.dataOut.flagDeflipData = False #asumo que la data esta sin flip |
|
114 | self.dataOut.flagDeflipData = False #asumo que la data esta sin flip | |
115 |
|
115 | |||
116 | self.dataOut.flagShiftFFT = False |
|
116 | self.dataOut.flagShiftFFT = False | |
117 |
|
117 | |||
118 | self.dataOut.ippSeconds = ippSeconds |
|
118 | self.dataOut.ippSeconds = ippSeconds | |
119 |
|
119 | |||
120 | #Time interval between profiles |
|
120 | #Time interval between profiles | |
121 | #self.dataOut.timeInterval = self.dataOut.ippSeconds * self.dataOut.nCohInt |
|
121 | #self.dataOut.timeInterval = self.dataOut.ippSeconds * self.dataOut.nCohInt | |
122 |
|
122 | |||
123 | self.dataOut.frequency = self.__frequency |
|
123 | self.dataOut.frequency = self.__frequency | |
124 |
|
124 | |||
125 | self.dataOut.realtime = self.__online |
|
125 | self.dataOut.realtime = self.__online | |
126 |
|
126 | |||
127 | def findDatafiles(self, path, startDate=None, endDate=None): |
|
127 | def findDatafiles(self, path, startDate=None, endDate=None): | |
128 |
|
128 | |||
129 | if not os.path.isdir(path): |
|
129 | if not os.path.isdir(path): | |
130 | return [] |
|
130 | return [] | |
131 |
|
131 | |||
132 | try: |
|
132 | try: | |
133 | digitalReadObj = digital_rf.DigitalRFReader(path, load_all_metadata=True) |
|
133 | digitalReadObj = digital_rf.DigitalRFReader(path, load_all_metadata=True) | |
134 | except: |
|
134 | except: | |
135 | digitalReadObj = digital_rf.DigitalRFReader(path) |
|
135 | digitalReadObj = digital_rf.DigitalRFReader(path) | |
136 |
|
136 | |||
137 | channelNameList = digitalReadObj.get_channels() |
|
137 | channelNameList = digitalReadObj.get_channels() | |
138 |
|
138 | |||
139 | if not channelNameList: |
|
139 | if not channelNameList: | |
140 | return [] |
|
140 | return [] | |
141 |
|
141 | |||
142 | metadata_dict = digitalReadObj.get_rf_file_metadata(channelNameList[0]) |
|
142 | metadata_dict = digitalReadObj.get_rf_file_metadata(channelNameList[0]) | |
143 |
|
143 | |||
144 | sample_rate = metadata_dict['sample_rate'][0] |
|
144 | sample_rate = metadata_dict['sample_rate'][0] | |
145 |
|
145 | |||
146 | this_metadata_file = digitalReadObj.get_metadata(channelNameList[0]) |
|
146 | this_metadata_file = digitalReadObj.get_metadata(channelNameList[0]) | |
147 |
|
147 | |||
148 | try: |
|
148 | try: | |
149 | timezone = this_metadata_file['timezone'].value |
|
149 | timezone = this_metadata_file['timezone'].value | |
150 | except: |
|
150 | except: | |
151 | timezone = 0 |
|
151 | timezone = 0 | |
152 |
|
152 | |||
153 | startUTCSecond, endUTCSecond = digitalReadObj.get_bounds(channelNameList[0])/sample_rate - timezone |
|
153 | startUTCSecond, endUTCSecond = digitalReadObj.get_bounds(channelNameList[0])/sample_rate - timezone | |
154 |
|
154 | |||
155 | startDatetime = datetime.datetime.utcfromtimestamp(startUTCSecond) |
|
155 | startDatetime = datetime.datetime.utcfromtimestamp(startUTCSecond) | |
156 | endDatatime = datetime.datetime.utcfromtimestamp(endUTCSecond) |
|
156 | endDatatime = datetime.datetime.utcfromtimestamp(endUTCSecond) | |
157 |
|
157 | |||
158 | if not startDate: |
|
158 | if not startDate: | |
159 | startDate = startDatetime.date() |
|
159 | startDate = startDatetime.date() | |
160 |
|
160 | |||
161 | if not endDate: |
|
161 | if not endDate: | |
162 | endDate = endDatatime.date() |
|
162 | endDate = endDatatime.date() | |
163 |
|
163 | |||
164 | dateList = [] |
|
164 | dateList = [] | |
165 |
|
165 | |||
166 | thisDatetime = startDatetime |
|
166 | thisDatetime = startDatetime | |
167 |
|
167 | |||
168 | while(thisDatetime<=endDatatime): |
|
168 | while(thisDatetime<=endDatatime): | |
169 |
|
169 | |||
170 | thisDate = thisDatetime.date() |
|
170 | thisDate = thisDatetime.date() | |
171 |
|
171 | |||
172 | if thisDate < startDate: |
|
172 | if thisDate < startDate: | |
173 | continue |
|
173 | continue | |
174 |
|
174 | |||
175 | if thisDate > endDate: |
|
175 | if thisDate > endDate: | |
176 | break |
|
176 | break | |
177 |
|
177 | |||
178 | dateList.append(thisDate) |
|
178 | dateList.append(thisDate) | |
179 | thisDatetime += datetime.timedelta(1) |
|
179 | thisDatetime += datetime.timedelta(1) | |
180 |
|
180 | |||
181 | return dateList |
|
181 | return dateList | |
182 |
|
182 | |||
183 | def setup(self, path = None, |
|
183 | def setup(self, path = None, | |
184 | startDate = None, |
|
184 | startDate = None, | |
185 | endDate = None, |
|
185 | endDate = None, | |
186 | startTime = datetime.time(0,0,0), |
|
186 | startTime = datetime.time(0,0,0), | |
187 | endTime = datetime.time(23,59,59), |
|
187 | endTime = datetime.time(23,59,59), | |
188 | channelList = None, |
|
188 | channelList = None, | |
189 | nSamples = None, |
|
189 | nSamples = None, | |
190 | ippKm = 60, |
|
190 | ippKm = 60, | |
191 | online = False, |
|
191 | online = False, | |
192 | delay = 60, |
|
192 | delay = 60, | |
193 | buffer_size = 1024, |
|
193 | buffer_size = 1024, | |
194 | **kwargs): |
|
194 | **kwargs): | |
195 | ''' |
|
195 | ''' | |
196 | In this method we should set all initial parameters. |
|
196 | In this method we should set all initial parameters. | |
197 |
|
197 | |||
198 | Inputs: |
|
198 | Inputs: | |
199 | path |
|
199 | path | |
200 | startDate |
|
200 | startDate | |
201 | endDate |
|
201 | endDate | |
202 | startTime |
|
202 | startTime | |
203 | endTime |
|
203 | endTime | |
204 | set |
|
204 | set | |
205 | expLabel |
|
205 | expLabel | |
206 | ext |
|
206 | ext | |
207 | online |
|
207 | online | |
208 | delay |
|
208 | delay | |
209 | ''' |
|
209 | ''' | |
210 |
|
210 | |||
211 | if not os.path.isdir(path): |
|
211 | if not os.path.isdir(path): | |
212 | raise ValueError, "[Reading] Directory %s does not exist" %path |
|
212 | raise ValueError, "[Reading] Directory %s does not exist" %path | |
213 |
|
213 | |||
214 | try: |
|
214 | try: | |
215 | self.digitalReadObj = digital_rf.DigitalRFReader(path, load_all_metadata=True) |
|
215 | self.digitalReadObj = digital_rf.DigitalRFReader(path, load_all_metadata=True) | |
216 | except: |
|
216 | except: | |
217 | self.digitalReadObj = digital_rf.DigitalRFReader(path) |
|
217 | self.digitalReadObj = digital_rf.DigitalRFReader(path) | |
218 |
|
218 | |||
219 | channelNameList = self.digitalReadObj.get_channels() |
|
219 | channelNameList = self.digitalReadObj.get_channels() | |
220 |
|
220 | |||
221 | if not channelNameList: |
|
221 | if not channelNameList: | |
222 | raise ValueError, "[Reading] Directory %s does not have any files" %path |
|
222 | raise ValueError, "[Reading] Directory %s does not have any files" %path | |
223 |
|
223 | |||
224 | if not channelList: |
|
224 | if not channelList: | |
225 | channelList = range(len(channelNameList)) |
|
225 | channelList = range(len(channelNameList)) | |
226 |
|
226 | |||
227 | ########## Reading metadata ###################### |
|
227 | ########## Reading metadata ###################### | |
228 |
|
228 | |||
229 | metadata_dict = self.digitalReadObj.get_properties(channelNameList[channelList[0]]) |
|
229 | metadata_dict = self.digitalReadObj.get_properties(channelNameList[channelList[0]]) | |
230 |
|
230 | |||
231 | self.__sample_rate = metadata_dict['sample_rate_numerator'] / metadata_dict['sample_rate_denominator'] |
|
231 | self.__sample_rate = metadata_dict['sample_rate_numerator'] / metadata_dict['sample_rate_denominator'] | |
232 | # self.__samples_per_file = metadata_dict['samples_per_file'][0] |
|
232 | # self.__samples_per_file = metadata_dict['samples_per_file'][0] | |
233 | self.__deltaHeigth = 1e6*0.15/self.__sample_rate ## why 0.15? |
|
233 | self.__deltaHeigth = 1e6*0.15/self.__sample_rate ## why 0.15? | |
234 |
|
234 | |||
235 | this_metadata_file = self.digitalReadObj.get_digital_metadata(channelNameList[channelList[0]]) |
|
235 | this_metadata_file = self.digitalReadObj.get_digital_metadata(channelNameList[channelList[0]]) | |
236 | metadata_bounds = this_metadata_file.get_bounds() |
|
236 | metadata_bounds = this_metadata_file.get_bounds() | |
237 | self.fixed_metadata_dict = this_metadata_file.read(metadata_bounds[0])[metadata_bounds[0]] ##GET FIRST HEADER |
|
237 | self.fixed_metadata_dict = this_metadata_file.read(metadata_bounds[0])[metadata_bounds[0]] ##GET FIRST HEADER | |
238 |
|
238 | |||
239 | self.__frequency = None |
|
239 | self.__frequency = None | |
240 | try: |
|
240 | try: | |
241 | self.__frequency = self.fixed_metadata_dict['frequency'] |
|
241 | self.__frequency = self.fixed_metadata_dict['frequency'] | |
242 | except: |
|
242 | except: | |
243 | self.__frequency = None |
|
243 | self.__frequency = None | |
244 |
|
244 | |||
245 | try: |
|
245 | try: | |
246 | self.__timezone = self.fixed_metadata_dict['timezone'] |
|
246 | self.__timezone = self.fixed_metadata_dict['timezone'] | |
247 | except: |
|
247 | except: | |
248 | self.__timezone = 0 |
|
248 | self.__timezone = 0 | |
249 |
|
249 | |||
250 | self.__firstHeigth = 0 |
|
250 | self.__firstHeigth = 0 | |
251 |
|
251 | |||
252 |
|
252 | |||
253 | try: |
|
253 | try: | |
254 | codeType = self.fixed_metadata_dict['codeType'] |
|
254 | codeType = self.fixed_metadata_dict['codeType'] | |
255 | except: |
|
255 | except: | |
256 | codeType = 0 |
|
256 | codeType = 0 | |
257 |
|
257 | |||
258 | nCode = 1 |
|
258 | nCode = 1 | |
259 | nBaud = 1 |
|
259 | nBaud = 1 | |
260 | code = numpy.ones((nCode, nBaud), dtype=numpy.int) |
|
260 | code = numpy.ones((nCode, nBaud), dtype=numpy.int) | |
261 |
|
261 | |||
262 | if codeType: |
|
262 | if codeType: | |
263 | nCode = self.fixed_metadata_dict['nCode'] |
|
263 | nCode = self.fixed_metadata_dict['nCode'] | |
264 | nBaud = self.fixed_metadata_dict['nBaud'] |
|
264 | nBaud = self.fixed_metadata_dict['nBaud'] | |
265 | code = self.fixed_metadata_dict['code'] |
|
265 | code = self.fixed_metadata_dict['code'] | |
266 |
|
266 | |||
267 | if not ippKm: |
|
267 | if not ippKm: | |
268 | try: |
|
268 | try: | |
269 | #seconds to km |
|
269 | #seconds to km | |
270 | ippKm = 1e6*0.15*self.fixed_metadata_dict['ipp'] |
|
270 | ippKm = 1e6*0.15*self.fixed_metadata_dict['ipp'] | |
271 | except: |
|
271 | except: | |
272 | ippKm = None |
|
272 | ippKm = None | |
273 | #################################################### |
|
273 | #################################################### | |
274 | startUTCSecond = None |
|
274 | startUTCSecond = None | |
275 | endUTCSecond = None |
|
275 | endUTCSecond = None | |
276 |
|
276 | |||
277 | if startDate: |
|
277 | if startDate: | |
278 | startDatetime = datetime.datetime.combine(startDate, startTime) |
|
278 | startDatetime = datetime.datetime.combine(startDate, startTime) | |
279 | startUTCSecond = (startDatetime-datetime.datetime(1970,1,1)).total_seconds() + self.__timezone |
|
279 | startUTCSecond = (startDatetime-datetime.datetime(1970,1,1)).total_seconds() + self.__timezone | |
280 |
|
280 | |||
281 | if endDate: |
|
281 | if endDate: | |
282 | endDatetime = datetime.datetime.combine(endDate, endTime) |
|
282 | endDatetime = datetime.datetime.combine(endDate, endTime) | |
283 | endUTCSecond = (endDatetime-datetime.datetime(1970,1,1)).total_seconds() + self.__timezone |
|
283 | endUTCSecond = (endDatetime-datetime.datetime(1970,1,1)).total_seconds() + self.__timezone | |
284 |
|
284 | |||
285 | start_index, end_index = self.digitalReadObj.get_bounds(channelNameList[channelList[0]]) |
|
285 | start_index, end_index = self.digitalReadObj.get_bounds(channelNameList[channelList[0]]) | |
286 |
|
286 | |||
287 | if not startUTCSecond: |
|
287 | if not startUTCSecond: | |
288 | startUTCSecond = start_index/self.__sample_rate |
|
288 | startUTCSecond = start_index/self.__sample_rate | |
289 |
|
289 | |||
290 | if start_index > startUTCSecond*self.__sample_rate: |
|
290 | if start_index > startUTCSecond*self.__sample_rate: | |
291 | startUTCSecond = start_index/self.__sample_rate |
|
291 | startUTCSecond = start_index/self.__sample_rate | |
292 |
|
292 | |||
293 | if not endUTCSecond: |
|
293 | if not endUTCSecond: | |
294 | endUTCSecond = end_index/self.__sample_rate |
|
294 | endUTCSecond = end_index/self.__sample_rate | |
295 |
|
295 | |||
296 | if end_index < endUTCSecond*self.__sample_rate: |
|
296 | if end_index < endUTCSecond*self.__sample_rate: | |
297 | endUTCSecond = end_index/self.__sample_rate |
|
297 | endUTCSecond = end_index/self.__sample_rate | |
298 |
|
298 | |||
299 | if not nSamples: |
|
299 | if not nSamples: | |
300 | if not ippKm: |
|
300 | if not ippKm: | |
301 | raise ValueError, "[Reading] nSamples or ippKm should be defined" |
|
301 | raise ValueError, "[Reading] nSamples or ippKm should be defined" | |
302 | nSamples = int(ippKm / (1e6*0.15/self.__sample_rate)) |
|
302 | nSamples = int(ippKm / (1e6*0.15/self.__sample_rate)) | |
303 |
|
303 | |||
304 | channelBoundList = [] |
|
304 | channelBoundList = [] | |
305 | channelNameListFiltered = [] |
|
305 | channelNameListFiltered = [] | |
306 |
|
306 | |||
307 | for thisIndexChannel in channelList: |
|
307 | for thisIndexChannel in channelList: | |
308 | thisChannelName = channelNameList[thisIndexChannel] |
|
308 | thisChannelName = channelNameList[thisIndexChannel] | |
309 | start_index, end_index = self.digitalReadObj.get_bounds(thisChannelName) |
|
309 | start_index, end_index = self.digitalReadObj.get_bounds(thisChannelName) | |
310 | channelBoundList.append((start_index, end_index)) |
|
310 | channelBoundList.append((start_index, end_index)) | |
311 | channelNameListFiltered.append(thisChannelName) |
|
311 | channelNameListFiltered.append(thisChannelName) | |
312 |
|
312 | |||
313 | self.profileIndex = 0 |
|
313 | self.profileIndex = 0 | |
314 |
|
314 | |||
315 | self.__delay = delay |
|
315 | self.__delay = delay | |
316 | self.__ippKm = ippKm |
|
316 | self.__ippKm = ippKm | |
317 | self.__codeType = codeType |
|
317 | self.__codeType = codeType | |
318 | self.__nCode = nCode |
|
318 | self.__nCode = nCode | |
319 | self.__nBaud = nBaud |
|
319 | self.__nBaud = nBaud | |
320 | self.__code = code |
|
320 | self.__code = code | |
321 |
|
321 | |||
322 | self.__datapath = path |
|
322 | self.__datapath = path | |
323 | self.__online = online |
|
323 | self.__online = online | |
324 | self.__channelList = channelList |
|
324 | self.__channelList = channelList | |
325 | self.__channelNameList = channelNameListFiltered |
|
325 | self.__channelNameList = channelNameListFiltered | |
326 | self.__channelBoundList = channelBoundList |
|
326 | self.__channelBoundList = channelBoundList | |
327 | self.__nSamples = nSamples |
|
327 | self.__nSamples = nSamples | |
328 | self.__samples_to_read = long(buffer_size*nSamples) #FIJO: AHORA 40 |
|
328 | self.__samples_to_read = long(buffer_size*nSamples) #FIJO: AHORA 40 | |
329 | self.__nChannels = len(self.__channelList) |
|
329 | self.__nChannels = len(self.__channelList) | |
330 |
|
330 | |||
331 | self.__startUTCSecond = startUTCSecond |
|
331 | self.__startUTCSecond = startUTCSecond | |
332 | self.__endUTCSecond = endUTCSecond |
|
332 | self.__endUTCSecond = endUTCSecond | |
333 |
|
333 | |||
334 | self.__timeInterval = 1.0 * self.__samples_to_read/self.__sample_rate #Time interval |
|
334 | self.__timeInterval = 1.0 * self.__samples_to_read/self.__sample_rate #Time interval | |
335 |
|
335 | |||
336 | if online: |
|
336 | if online: | |
337 | # self.__thisUnixSample = int(endUTCSecond*self.__sample_rate - 4*self.__samples_to_read) |
|
337 | # self.__thisUnixSample = int(endUTCSecond*self.__sample_rate - 4*self.__samples_to_read) | |
338 | startUTCSecond = numpy.floor(endUTCSecond) |
|
338 | startUTCSecond = numpy.floor(endUTCSecond) | |
339 |
|
339 | |||
340 | self.__thisUnixSample = long(startUTCSecond*self.__sample_rate) - self.__samples_to_read ##por que en el otro metodo lo primero q se hace es sumar samplestoread |
|
340 | self.__thisUnixSample = long(startUTCSecond*self.__sample_rate) - self.__samples_to_read ##por que en el otro metodo lo primero q se hace es sumar samplestoread | |
341 |
|
341 | |||
342 | self.__data_buffer = numpy.zeros((self.__nChannels, self.__samples_to_read), dtype = numpy.complex) |
|
342 | self.__data_buffer = numpy.zeros((self.__nChannels, self.__samples_to_read), dtype = numpy.complex) | |
343 |
|
343 | |||
344 | self.__setFileHeader() |
|
344 | self.__setFileHeader() | |
345 | self.isConfig = True |
|
345 | self.isConfig = True | |
346 |
|
346 | |||
347 | print "[Reading] Digital RF Data was found from %s to %s " %( |
|
347 | print "[Reading] Digital RF Data was found from %s to %s " %( | |
348 | datetime.datetime.utcfromtimestamp(self.__startUTCSecond - self.__timezone), |
|
348 | datetime.datetime.utcfromtimestamp(self.__startUTCSecond - self.__timezone), | |
349 | datetime.datetime.utcfromtimestamp(self.__endUTCSecond - self.__timezone) |
|
349 | datetime.datetime.utcfromtimestamp(self.__endUTCSecond - self.__timezone) | |
350 | ) |
|
350 | ) | |
351 |
|
351 | |||
352 | print "[Reading] Starting process from %s to %s" %(datetime.datetime.utcfromtimestamp(startUTCSecond - self.__timezone), |
|
352 | print "[Reading] Starting process from %s to %s" %(datetime.datetime.utcfromtimestamp(startUTCSecond - self.__timezone), | |
353 | datetime.datetime.utcfromtimestamp(endUTCSecond - self.__timezone) |
|
353 | datetime.datetime.utcfromtimestamp(endUTCSecond - self.__timezone) | |
354 | ) |
|
354 | ) | |
355 |
|
355 | |||
356 | def __reload(self): |
|
356 | def __reload(self): | |
357 |
|
357 | |||
358 | # print "%s not in range [%s, %s]" %( |
|
358 | # print "%s not in range [%s, %s]" %( | |
359 | # datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), |
|
359 | # datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), | |
360 | # datetime.datetime.utcfromtimestamp(self.__startUTCSecond - self.__timezone), |
|
360 | # datetime.datetime.utcfromtimestamp(self.__startUTCSecond - self.__timezone), | |
361 | # datetime.datetime.utcfromtimestamp(self.__endUTCSecond - self.__timezone) |
|
361 | # datetime.datetime.utcfromtimestamp(self.__endUTCSecond - self.__timezone) | |
362 | # ) |
|
362 | # ) | |
363 | print "[Reading] reloading metadata ..." |
|
363 | print "[Reading] reloading metadata ..." | |
364 |
|
364 | |||
365 | try: |
|
365 | try: | |
366 | self.digitalReadObj.reload(complete_update=True) |
|
366 | self.digitalReadObj.reload(complete_update=True) | |
367 | except: |
|
367 | except: | |
368 | self.digitalReadObj.reload() |
|
368 | self.digitalReadObj.reload() | |
369 |
|
369 | |||
370 | start_index, end_index = self.digitalReadObj.get_bounds(self.__channelNameList[self.__channelList[0]]) |
|
370 | start_index, end_index = self.digitalReadObj.get_bounds(self.__channelNameList[self.__channelList[0]]) | |
371 |
|
371 | |||
372 | if start_index > self.__startUTCSecond*self.__sample_rate: |
|
372 | if start_index > self.__startUTCSecond*self.__sample_rate: | |
373 | self.__startUTCSecond = 1.0*start_index/self.__sample_rate |
|
373 | self.__startUTCSecond = 1.0*start_index/self.__sample_rate | |
374 |
|
374 | |||
375 | if end_index > self.__endUTCSecond*self.__sample_rate: |
|
375 | if end_index > self.__endUTCSecond*self.__sample_rate: | |
376 | self.__endUTCSecond = 1.0*end_index/self.__sample_rate |
|
376 | self.__endUTCSecond = 1.0*end_index/self.__sample_rate | |
377 |
|
377 | |||
378 | print "[Reading] New timerange found [%s, %s] " %( |
|
378 | print "[Reading] New timerange found [%s, %s] " %( | |
379 | datetime.datetime.utcfromtimestamp(self.__startUTCSecond - self.__timezone), |
|
379 | datetime.datetime.utcfromtimestamp(self.__startUTCSecond - self.__timezone), | |
380 | datetime.datetime.utcfromtimestamp(self.__endUTCSecond - self.__timezone) |
|
380 | datetime.datetime.utcfromtimestamp(self.__endUTCSecond - self.__timezone) | |
381 | ) |
|
381 | ) | |
382 |
|
382 | |||
383 | return True |
|
383 | return True | |
384 |
|
384 | |||
385 | return False |
|
385 | return False | |
386 |
|
386 | |||
387 | def __readNextBlock(self, seconds=30, volt_scale = 218776): |
|
387 | def __readNextBlock(self, seconds=30, volt_scale = 218776): | |
388 | ''' |
|
388 | ''' | |
389 | ''' |
|
389 | ''' | |
390 |
|
390 | |||
391 | #Set the next data |
|
391 | #Set the next data | |
392 | self.__flagDiscontinuousBlock = False |
|
392 | self.__flagDiscontinuousBlock = False | |
393 | self.__thisUnixSample += self.__samples_to_read |
|
393 | self.__thisUnixSample += self.__samples_to_read | |
394 |
|
394 | |||
395 | if self.__thisUnixSample + 2*self.__samples_to_read > self.__endUTCSecond*self.__sample_rate: |
|
395 | if self.__thisUnixSample + 2*self.__samples_to_read > self.__endUTCSecond*self.__sample_rate: | |
396 | print "[Reading] There are no more data into selected time-range" |
|
396 | print "[Reading] There are no more data into selected time-range" | |
397 | if self.__online: |
|
397 | if self.__online: | |
398 | self.__reload() |
|
398 | self.__reload() | |
399 | else: |
|
399 | else: | |
400 | return False |
|
400 | return False | |
401 |
|
401 | |||
402 | if self.__thisUnixSample + 2*self.__samples_to_read > self.__endUTCSecond*self.__sample_rate: |
|
402 | if self.__thisUnixSample + 2*self.__samples_to_read > self.__endUTCSecond*self.__sample_rate: | |
403 | return False |
|
403 | return False | |
404 | self.__thisUnixSample -= self.__samples_to_read |
|
404 | self.__thisUnixSample -= self.__samples_to_read | |
405 |
|
405 | |||
406 | indexChannel = 0 |
|
406 | indexChannel = 0 | |
407 |
|
407 | |||
408 | dataOk = False |
|
408 | dataOk = False | |
409 |
|
409 | |||
410 | for thisChannelName in self.__channelNameList: ##TODO VARIOS CHANNELS? |
|
410 | for thisChannelName in self.__channelNameList: ##TODO VARIOS CHANNELS? | |
411 |
|
411 | |||
412 | try: |
|
412 | try: | |
413 | result = self.digitalReadObj.read_vector_c81d(self.__thisUnixSample, |
|
413 | result = self.digitalReadObj.read_vector_c81d(self.__thisUnixSample, | |
414 | self.__samples_to_read, |
|
414 | self.__samples_to_read, | |
415 | thisChannelName) |
|
415 | thisChannelName) | |
416 | except IOError, e: |
|
416 | except IOError, e: | |
417 | #read next profile |
|
417 | #read next profile | |
418 | self.__flagDiscontinuousBlock = True |
|
418 | self.__flagDiscontinuousBlock = True | |
419 | print "[Reading] %s" %datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), e |
|
419 | print "[Reading] %s" %datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), e | |
420 | break |
|
420 | break | |
421 |
|
421 | |||
422 | if result.shape[0] != self.__samples_to_read: |
|
422 | if result.shape[0] != self.__samples_to_read: | |
423 | self.__flagDiscontinuousBlock = True |
|
423 | self.__flagDiscontinuousBlock = True | |
424 | print "[Reading] %s: Too few samples were found, just %d/%d samples" %(datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), |
|
424 | print "[Reading] %s: Too few samples were found, just %d/%d samples" %(datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), | |
425 | result.shape[0], |
|
425 | result.shape[0], | |
426 | self.__samples_to_read) |
|
426 | self.__samples_to_read) | |
427 | break |
|
427 | break | |
428 |
|
428 | |||
429 | self.__data_buffer[indexChannel,:] = result*volt_scale |
|
429 | self.__data_buffer[indexChannel,:] = result*volt_scale | |
430 |
|
430 | |||
431 | indexChannel += 1 |
|
431 | indexChannel += 1 | |
432 |
|
432 | |||
433 | dataOk = True |
|
433 | dataOk = True | |
434 |
|
434 | |||
435 | self.__utctime = self.__thisUnixSample/self.__sample_rate |
|
435 | self.__utctime = self.__thisUnixSample/self.__sample_rate | |
436 |
|
436 | |||
437 | if not dataOk: |
|
437 | if not dataOk: | |
438 | return False |
|
438 | return False | |
439 |
|
439 | |||
440 | print "[Reading] %s: %d samples <> %f sec" %(datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), |
|
440 | print "[Reading] %s: %d samples <> %f sec" %(datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), | |
441 | self.__samples_to_read, |
|
441 | self.__samples_to_read, | |
442 | self.__timeInterval) |
|
442 | self.__timeInterval) | |
443 |
|
443 | |||
444 | self.__bufferIndex = 0 |
|
444 | self.__bufferIndex = 0 | |
445 |
|
445 | |||
446 | return True |
|
446 | return True | |
447 |
|
447 | |||
448 | def __isBufferEmpty(self): |
|
448 | def __isBufferEmpty(self): | |
449 | return self.__bufferIndex > self.__samples_to_read - self.__nSamples #40960 - 40 |
|
449 | return self.__bufferIndex > self.__samples_to_read - self.__nSamples #40960 - 40 | |
450 |
|
450 | |||
451 | def getData(self, seconds=30, nTries=5): |
|
451 | def getData(self, seconds=30, nTries=5): | |
452 |
|
452 | |||
453 | ''' |
|
453 | ''' | |
454 | This method gets the data from files and put the data into the dataOut object |
|
454 | This method gets the data from files and put the data into the dataOut object | |
455 |
|
455 | |||
456 | In addition, increase el the buffer counter in one. |
|
456 | In addition, increase el the buffer counter in one. | |
457 |
|
457 | |||
458 | Return: |
|
458 | Return: | |
459 | data : retorna un perfil de voltages (alturas * canales) copiados desde el |
|
459 | data : retorna un perfil de voltages (alturas * canales) copiados desde el | |
460 | buffer. Si no hay mas archivos a leer retorna None. |
|
460 | buffer. Si no hay mas archivos a leer retorna None. | |
461 |
|
461 | |||
462 | Affected: |
|
462 | Affected: | |
463 | self.dataOut |
|
463 | self.dataOut | |
464 | self.profileIndex |
|
464 | self.profileIndex | |
465 | self.flagDiscontinuousBlock |
|
465 | self.flagDiscontinuousBlock | |
466 | self.flagIsNewBlock |
|
466 | self.flagIsNewBlock | |
467 | ''' |
|
467 | ''' | |
468 |
|
468 | |||
469 | err_counter = 0 |
|
469 | err_counter = 0 | |
470 | self.dataOut.flagNoData = True |
|
470 | self.dataOut.flagNoData = True | |
471 |
|
471 | |||
472 | if self.__isBufferEmpty(): |
|
472 | if self.__isBufferEmpty(): | |
473 |
|
473 | |||
474 | self.__flagDiscontinuousBlock = False |
|
474 | self.__flagDiscontinuousBlock = False | |
475 |
|
475 | |||
476 | while True: |
|
476 | while True: | |
477 | if self.__readNextBlock(): |
|
477 | if self.__readNextBlock(): | |
478 | break |
|
478 | break | |
479 | if self.__thisUnixSample > self.__endUTCSecond*self.__sample_rate: |
|
479 | if self.__thisUnixSample > self.__endUTCSecond*self.__sample_rate: | |
480 | return False |
|
480 | return False | |
481 |
|
481 | |||
482 | if self.__flagDiscontinuousBlock: |
|
482 | if self.__flagDiscontinuousBlock: | |
483 | print '[Reading] discontinuous block found ... continue with the next block' |
|
483 | print '[Reading] discontinuous block found ... continue with the next block' | |
484 | continue |
|
484 | continue | |
485 |
|
485 | |||
486 | if not self.__online: |
|
486 | if not self.__online: | |
487 | return False |
|
487 | return False | |
488 |
|
488 | |||
489 | err_counter += 1 |
|
489 | err_counter += 1 | |
490 | if err_counter > nTries: |
|
490 | if err_counter > nTries: | |
491 | return False |
|
491 | return False | |
492 |
|
492 | |||
493 | print '[Reading] waiting %d seconds to read a new block' %seconds |
|
493 | print '[Reading] waiting %d seconds to read a new block' %seconds | |
494 | sleep(seconds) |
|
494 | sleep(seconds) | |
495 |
|
495 | |||
496 | self.dataOut.data = self.__data_buffer[:,self.__bufferIndex:self.__bufferIndex+self.__nSamples] |
|
496 | self.dataOut.data = self.__data_buffer[:,self.__bufferIndex:self.__bufferIndex+self.__nSamples] | |
497 | self.dataOut.utctime = (self.__thisUnixSample + self.__bufferIndex)/self.__sample_rate |
|
497 | self.dataOut.utctime = (self.__thisUnixSample + self.__bufferIndex)/self.__sample_rate | |
498 | self.dataOut.flagNoData = False |
|
498 | self.dataOut.flagNoData = False | |
499 | self.dataOut.flagDiscontinuousBlock = self.__flagDiscontinuousBlock |
|
499 | self.dataOut.flagDiscontinuousBlock = self.__flagDiscontinuousBlock | |
500 | self.dataOut.profileIndex = self.profileIndex |
|
500 | self.dataOut.profileIndex = self.profileIndex | |
501 |
|
501 | |||
502 | self.__bufferIndex += self.__nSamples |
|
502 | self.__bufferIndex += self.__nSamples | |
503 | self.profileIndex += 1 |
|
503 | self.profileIndex += 1 | |
504 |
|
504 | |||
505 | if self.profileIndex == self.dataOut.nProfiles: |
|
505 | if self.profileIndex == self.dataOut.nProfiles: | |
506 | self.profileIndex = 0 |
|
506 | self.profileIndex = 0 | |
507 |
|
507 | |||
508 | return True |
|
508 | return True | |
509 |
|
509 | |||
510 | def printInfo(self): |
|
510 | def printInfo(self): | |
511 | ''' |
|
511 | ''' | |
512 | ''' |
|
512 | ''' | |
513 | if self.__printInfo == False: |
|
513 | if self.__printInfo == False: | |
514 | return |
|
514 | return | |
515 |
|
515 | |||
516 | # self.systemHeaderObj.printInfo() |
|
516 | # self.systemHeaderObj.printInfo() | |
517 | # self.radarControllerHeaderObj.printInfo() |
|
517 | # self.radarControllerHeaderObj.printInfo() | |
518 |
|
518 | |||
519 | self.__printInfo = False |
|
519 | self.__printInfo = False | |
520 |
|
520 | |||
521 | def printNumberOfBlock(self): |
|
521 | def printNumberOfBlock(self): | |
522 | ''' |
|
522 | ''' | |
523 | ''' |
|
523 | ''' | |
524 | return |
|
524 | return | |
525 | #print self.profileIndex |
|
525 | #print self.profileIndex | |
526 |
|
526 | |||
527 | def run(self, **kwargs): |
|
527 | def run(self, **kwargs): | |
528 | ''' |
|
528 | ''' | |
529 | This method will be called many times so here you should put all your code |
|
529 | This method will be called many times so here you should put all your code | |
530 | ''' |
|
530 | ''' | |
531 |
|
531 | |||
532 | if not self.isConfig: |
|
532 | if not self.isConfig: | |
533 | self.setup(**kwargs) |
|
533 | self.setup(**kwargs) | |
534 |
|
534 | |||
535 | self.getData(seconds=self.__delay) |
|
535 | self.getData(seconds=self.__delay) | |
536 |
|
536 | |||
537 | return |
|
537 | return | |
538 |
|
538 | |||
539 | class DigitalRFWriter(Operation): |
|
539 | class DigitalRFWriter(Operation): | |
540 | ''' |
|
540 | ''' | |
541 | classdocs |
|
541 | classdocs | |
542 | ''' |
|
542 | ''' | |
543 |
|
543 | |||
544 | def __init__(self, **kwargs): |
|
544 | def __init__(self, **kwargs): | |
545 | ''' |
|
545 | ''' | |
546 | Constructor |
|
546 | Constructor | |
547 | ''' |
|
547 | ''' | |
548 | Operation.__init__(self, **kwargs) |
|
548 | Operation.__init__(self, **kwargs) | |
549 | self.dataOut = None |
|
549 | self.dataOut = None | |
550 |
|
550 | |||
551 |
def setup(self, dataIn, path, blocksPerFile, set=0, ext= |
|
551 | def setup(self, dataIn, path, blocksPerFile, set=0, ext='.h5'): | |
552 | ''' |
|
552 | ''' | |
553 | In this method we should set all initial parameters. |
|
553 | In this method we should set all initial parameters. | |
554 |
|
554 | |||
555 | Input: |
|
555 | Input: | |
556 | dataIn : Input data will also be outputa data |
|
556 | dataIn : Input data will also be outputa data | |
557 |
|
557 | |||
558 | ''' |
|
558 | ''' | |
559 | self.dataOut = dataIn |
|
559 | self.dataOut = dataIn | |
560 |
|
560 | |||
561 |
|
561 | |||
562 |
|
562 | |||
563 |
|
563 | |||
564 |
|
564 | |||
565 | self.isConfig = True |
|
565 | self.isConfig = True | |
566 |
|
566 | |||
567 | return |
|
567 | return | |
568 |
|
568 | |||
569 | def run(self, dataIn, **kwargs): |
|
569 | def run(self, dataIn, path=None, **kwargs): | |
570 | ''' |
|
570 | ''' | |
571 | This method will be called many times so here you should put all your code |
|
571 | This method will be called many times so here you should put all your code | |
572 |
|
572 | |||
573 | Inputs: |
|
573 | Inputs: | |
574 |
|
574 | |||
575 | dataIn : object with the data |
|
575 | dataIn : object with the data | |
576 |
|
576 | |||
577 | ''' |
|
577 | ''' | |
578 |
|
578 | print dir(dataIn) | ||
|
579 | print 'blocksize', dataIn.blocksize | |||
|
580 | print 'channelIndexList', dataIn.channelIndexList | |||
|
581 | print 'ippSeconds', dataIn.ippSeconds | |||
|
582 | print 'frequency', dataIn.frequency | |||
|
583 | print 'nProfiles', dataIn.nProfiles | |||
|
584 | print 'systemHeaderObj.nSamples', dataIn.systemHeaderObj.nSamples | |||
579 | if not self.isConfig: |
|
585 | if not self.isConfig: | |
580 | self.setup(dataIn, **kwargs) |
|
586 | self.setup(dataIn, path, **kwargs) | |
581 |
|
587 | |||
582 |
|
588 | |||
583 | if __name__ == '__main__': |
|
589 | if __name__ == '__main__': | |
584 |
|
590 | |||
585 | readObj = DigitalRFReader() |
|
591 | readObj = DigitalRFReader() | |
586 |
|
592 | |||
587 | while True: |
|
593 | while True: | |
588 | readObj.run(path='/home/jchavez/jicamarca/mocked_data/') |
|
594 | readObj.run(path='/home/jchavez/jicamarca/mocked_data/') | |
589 | # readObj.printInfo() |
|
595 | # readObj.printInfo() | |
590 | readObj.printNumberOfBlock() |
|
596 | readObj.printNumberOfBlock() |
@@ -1,1 +1,1 | |||||
1 | <Project description="Testing USRP data reader" id="191" name="test01"><ReadUnit datatype="DigitalRF" id="1911" inputId="0" name="DigitalRFReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="DigitalRF" /><Parameter format="str" id="191112" name="path" value="/home/jchavez/jicamarca/mocked_data" /><Parameter format="date" id="191113" name="startDate" value="2000/07/03" /><Parameter format="date" id="191114" name="endDate" value="2017/07/03" /><Parameter format="time" id="191115" name="startTime" value="00:00:00" /><Parameter format="time" id="191116" name="endTime" value="23:59:59" /><Parameter format="int" id="191118" name="ippKm" value="60" /><Parameter format="int" id="191119" name="online" value="0" /></Operation></ReadUnit><ProcUnit datatype="Voltage" id="1912" inputId="1911" name="VoltageProc"><Operation id="19121" name="run" priority="1" type="self" /><Operation id="19122" name="CohInt" priority="2" type="external"><Parameter format="float" id="191221" name="n" value="1" /></Operation><Operation id="19123" name="Scope" priority="3" type="external"><Parameter format="int" id="191231" name="id" value="121" /><Parameter format="str" id="191232" name="wintitle" value="Scope" /></Operation></ProcUnit></Project> No newline at end of file |
|
1 | <Project description="Segundo Test" id="191" name="test01"><ReadUnit datatype="VoltageReader" id="1911" inputId="0" name="VoltageReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="VoltageReader" /><Parameter format="str" id="191112" name="path" value="/home/jchavez/jicamarca/jro_data/rawdata" /><Parameter format="date" id="191113" name="startDate" value="2010/10/28" /><Parameter format="date" id="191114" name="endDate" value="2017/10/28" /><Parameter format="time" id="191115" name="startTime" value="00:00:00" /><Parameter format="time" id="191116" name="endTime" value="23:59:59" /><Parameter format="int" id="191118" name="online" value="0" /><Parameter format="int" id="191119" name="walk" value="0" /></Operation><Operation id="19112" name="printNumberOfBlock" priority="2" type="self" /></ReadUnit><ProcUnit datatype="VoltageProc" id="1912" inputId="1911" name="VoltageProc"><Operation id="19121" name="run" priority="1" type="self" /><Operation id="19122" name="DigitalRFWriter" priority="2" type="other"><Parameter format="str" id="191221" name="path" value="/home/jchavez/jicamarca/data_sink/" /></Operation></ProcUnit></Project> No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now