@@ -1,485 +1,480 | |||||
1 | import numpy,math,random,time |
|
1 | import numpy,math,random,time | |
2 | import zmq |
|
2 | import zmq | |
3 | import tempfile |
|
3 | import tempfile | |
4 | from io import StringIO |
|
4 | from io import StringIO | |
5 | ########## 1 Heredamos JRODatareader |
|
5 | ########## 1 Heredamos JRODatareader | |
6 | from schainpy.model.io.jroIO_base import * |
|
6 | from schainpy.model.io.jroIO_base import * | |
7 | ########## 2 Heredamos las propiedades de ProcessingUnit |
|
7 | ########## 2 Heredamos las propiedades de ProcessingUnit | |
8 | from schainpy.model.proc.jroproc_base import ProcessingUnit,Operation,MPDecorator |
|
8 | from schainpy.model.proc.jroproc_base import ProcessingUnit,Operation,MPDecorator | |
9 | ########## 3 Importaremos las clases BascicHeader, SystemHeader, RadarControlHeader, ProcessingHeader |
|
9 | ########## 3 Importaremos las clases BascicHeader, SystemHeader, RadarControlHeader, ProcessingHeader | |
10 | from schainpy.model.data.jroheaderIO import PROCFLAG, BasicHeader,SystemHeader,RadarControllerHeader, ProcessingHeader |
|
10 | from schainpy.model.data.jroheaderIO import PROCFLAG, BasicHeader,SystemHeader,RadarControllerHeader, ProcessingHeader | |
11 | ########## 4 Importaremos el objeto Voltge |
|
11 | ########## 4 Importaremos el objeto Voltge | |
12 | from schainpy.model.data.jrodata import Voltage |
|
12 | from schainpy.model.data.jrodata import Voltage | |
13 |
|
13 | |||
14 | @MPDecorator |
|
14 | @MPDecorator | |
15 | class SimulatorReader(JRODataReader, ProcessingUnit): |
|
15 | class SimulatorReader(JRODataReader, ProcessingUnit): | |
16 | incIntFactor = 1 |
|
16 | incIntFactor = 1 | |
17 | nFFTPoints = 0 |
|
17 | nFFTPoints = 0 | |
18 | FixPP_IncInt = 1 |
|
18 | FixPP_IncInt = 1 | |
19 | FixRCP_IPP = 1000 |
|
19 | FixRCP_IPP = 1000 | |
20 | FixPP_CohInt = 1 |
|
20 | FixPP_CohInt = 1 | |
21 | Tau_0 = 250 |
|
21 | Tau_0 = 250 | |
22 | AcqH0_0 = 70 |
|
22 | AcqH0_0 = 70 | |
23 | H0 = AcqH0_0 |
|
23 | H0 = AcqH0_0 | |
24 | AcqDH_0 = 1.25 |
|
24 | AcqDH_0 = 1.25 | |
25 | DH0 = AcqDH_0 |
|
25 | DH0 = AcqDH_0 | |
26 | Bauds = 32 |
|
26 | Bauds = 32 | |
27 | BaudWidth = None |
|
27 | BaudWidth = None | |
28 | FixRCP_TXA = 40 |
|
28 | FixRCP_TXA = 40 | |
29 | FixRCP_TXB = 70 |
|
29 | FixRCP_TXB = 70 | |
30 | fAngle = 2.0*math.pi*(1/16) |
|
30 | fAngle = 2.0*math.pi*(1/16) | |
31 | DC_level = 500 |
|
31 | DC_level = 500 | |
32 | stdev = 8 |
|
32 | stdev = 8 | |
33 | Num_Codes = 2 |
|
33 | Num_Codes = 2 | |
34 | #code0 = numpy.array([1,1,1,0,1,1,0,1,1,1,1,0,0,0,1,0,1,1,1,0,1,1,0,1,0,0,0,1,1,1,0,1]) |
|
34 | #code0 = numpy.array([1,1,1,0,1,1,0,1,1,1,1,0,0,0,1,0,1,1,1,0,1,1,0,1,0,0,0,1,1,1,0,1]) | |
35 | #code1 = numpy.array([1,1,1,0,1,1,0,1,1,1,1,0,0,0,1,0,0,0,0,1,0,0,1,0,1,1,1,0,0,0,1,0]) |
|
35 | #code1 = numpy.array([1,1,1,0,1,1,0,1,1,1,1,0,0,0,1,0,0,0,0,1,0,0,1,0,1,1,1,0,0,0,1,0]) | |
36 | #Dyn_snCode = numpy.array([Num_Codes,Bauds]) |
|
36 | #Dyn_snCode = numpy.array([Num_Codes,Bauds]) | |
37 | Dyn_snCode = None |
|
37 | Dyn_snCode = None | |
38 | Samples = 200 |
|
38 | Samples = 200 | |
39 | channels = 5 |
|
39 | channels = 5 | |
40 | pulses = None |
|
40 | pulses = None | |
41 | Reference = None |
|
41 | Reference = None | |
42 | pulse_size = None |
|
42 | pulse_size = None | |
43 | prof_gen = None |
|
43 | prof_gen = None | |
44 | Fdoppler = 100 |
|
44 | Fdoppler = 100 | |
45 | Hdoppler = 36 |
|
45 | Hdoppler = 36 | |
46 | def __init__(self): |
|
46 | def __init__(self): | |
47 | """ |
|
47 | """ | |
48 | Inicializador de la clases SimulatorReader para |
|
48 | Inicializador de la clases SimulatorReader para | |
49 | generar datos de voltage simulados. |
|
49 | generar datos de voltage simulados. | |
50 | Input: |
|
50 | Input: | |
51 | dataOut: Objeto de la clase Voltage. |
|
51 | dataOut: Objeto de la clase Voltage. | |
52 | Este Objeto sera utilizado apra almacenar |
|
52 | Este Objeto sera utilizado apra almacenar | |
53 | un perfil de datos cada vez qe se haga psiversho |
|
53 | un perfil de datos cada vez qe se haga psiversho | |
54 | un requerimiento (getData) |
|
54 | un requerimiento (getData) | |
55 | """ |
|
55 | """ | |
56 | ProcessingUnit.__init__(self) |
|
56 | ProcessingUnit.__init__(self) | |
57 | print(" [ START ] init - Metodo Simulator Reader") |
|
57 | print(" [ START ] init - Metodo Simulator Reader") | |
58 |
|
58 | |||
59 | self.isConfig = False |
|
59 | self.isConfig = False | |
60 | self.basicHeaderObj = BasicHeader(LOCALTIME) |
|
60 | self.basicHeaderObj = BasicHeader(LOCALTIME) | |
61 | self.systemHeaderObj = SystemHeader() |
|
61 | self.systemHeaderObj = SystemHeader() | |
62 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
62 | self.radarControllerHeaderObj = RadarControllerHeader() | |
63 | self.processingHeaderObj = ProcessingHeader() |
|
63 | self.processingHeaderObj = ProcessingHeader() | |
64 | self.profileIndex = 2**32-1 |
|
64 | self.profileIndex = 2**32-1 | |
65 | self.dataOut = Voltage() |
|
65 | self.dataOut = Voltage() | |
66 | #code0 = numpy.array([1,1,1,0,1,1,0,1,1,1,1,0,0,0,1,0,1,1,1,0,1,1,0,1,0,0,0,1,1,1,0,1]) |
|
66 | #code0 = numpy.array([1,1,1,0,1,1,0,1,1,1,1,0,0,0,1,0,1,1,1,0,1,1,0,1,0,0,0,1,1,1,0,1]) | |
67 | code0 = numpy.array([1,1,1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,-1,1,1,1,-1,1,1,-1,1,-1,-1,-1,1,1,1,-1,1]) |
|
67 | code0 = numpy.array([1,1,1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,-1,1,1,1,-1,1,1,-1,1,-1,-1,-1,1,1,1,-1,1]) | |
68 | #code1 = numpy.array([1,1,1,0,1,1,0,1,1,1,1,0,0,0,1,0,0,0,0,1,0,0,1,0,1,1,1,0,0,0,1,0]) |
|
68 | #code1 = numpy.array([1,1,1,0,1,1,0,1,1,1,1,0,0,0,1,0,0,0,0,1,0,0,1,0,1,1,1,0,0,0,1,0]) | |
69 | code1 = numpy.array([1,1,1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,-1,1,-1]) |
|
69 | code1 = numpy.array([1,1,1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,-1,1,-1]) | |
70 | #self.Dyn_snCode = numpy.array([code0,code1]) |
|
70 | #self.Dyn_snCode = numpy.array([code0,code1]) | |
71 | self.Dyn_snCode = None |
|
71 | self.Dyn_snCode = None | |
72 | print(" [ END ] init - Metodo simulator Reader" ) |
|
72 | print(" [ END ] init - Metodo simulator Reader" ) | |
73 |
|
73 | |||
74 |
|
74 | |||
75 | def __hasNotDataInBuffer(self): |
|
75 | def __hasNotDataInBuffer(self): | |
76 |
|
76 | |||
77 | if self.profileIndex >= self.processingHeaderObj.profilesPerBlock* self.nTxs: |
|
77 | if self.profileIndex >= self.processingHeaderObj.profilesPerBlock* self.nTxs: | |
78 | if self.nReadBlocks>0: |
|
78 | if self.nReadBlocks>0: | |
79 | tmp = self.dataOut.utctime |
|
79 | tmp = self.dataOut.utctime | |
80 | tmp_utc = int(self.dataOut.utctime) |
|
80 | tmp_utc = int(self.dataOut.utctime) | |
81 | tmp_milisecond = int((tmp-tmp_utc)*1000) |
|
81 | tmp_milisecond = int((tmp-tmp_utc)*1000) | |
82 | self.basicHeaderObj.utc = tmp_utc |
|
82 | self.basicHeaderObj.utc = tmp_utc | |
83 | self.basicHeaderObj.miliSecond= tmp_milisecond |
|
83 | self.basicHeaderObj.miliSecond= tmp_milisecond | |
84 | return 1 |
|
84 | return 1 | |
85 | return 0 |
|
85 | return 0 | |
86 |
|
86 | |||
87 |
|
87 | |||
88 | def setNextFile(self): |
|
88 | def setNextFile(self): | |
89 | """Set the next file to be readed open it and parse de file header""" |
|
89 | """Set the next file to be readed open it and parse de file header""" | |
90 |
|
90 | |||
91 | if (self.nReadBlocks >= self.processingHeaderObj.dataBlocksPerFile): |
|
91 | if (self.nReadBlocks >= self.processingHeaderObj.dataBlocksPerFile): | |
92 | print('------------------- [Opening file] ------------------------------') |
|
92 | print('------------------- [Opening file] ------------------------------') | |
93 | self.nReadBlocks = 0 |
|
93 | self.nReadBlocks = 0 | |
94 |
|
94 | |||
95 | def __setNewBlock(self): |
|
95 | def __setNewBlock(self): | |
96 |
|
96 | |||
97 | self.setNextFile() |
|
97 | self.setNextFile() | |
98 | if self.flagIsNewFile: |
|
98 | if self.flagIsNewFile: | |
99 | return 1 |
|
99 | return 1 | |
100 |
|
100 | |||
101 | def readNextBlock(self): |
|
101 | def readNextBlock(self): | |
102 | while True: |
|
102 | while True: | |
103 | self.__setNewBlock() |
|
103 | self.__setNewBlock() | |
104 | if not(self.readBlock()): |
|
104 | if not(self.readBlock()): | |
105 | return 0 |
|
105 | return 0 | |
106 | self.getBasicHeader() |
|
106 | self.getBasicHeader() | |
107 | break |
|
107 | break | |
108 | if self.verbose: |
|
108 | if self.verbose: | |
109 | print("[Reading] Block No. %d/%d -> %s" %(self.nReadBlocks, |
|
109 | print("[Reading] Block No. %d/%d -> %s" %(self.nReadBlocks, | |
110 | self.processingHeaderObj.dataBlocksPerFile, |
|
110 | self.processingHeaderObj.dataBlocksPerFile, | |
111 | self.dataOut.datatime.ctime()) ) |
|
111 | self.dataOut.datatime.ctime()) ) | |
112 | return 1 |
|
112 | return 1 | |
113 |
|
113 | |||
114 | def getFirstHeader(self): |
|
114 | def getFirstHeader(self): | |
115 | self.getBasicHeader() |
|
115 | self.getBasicHeader() | |
116 | self.dataOut.processingHeaderObj = self.processingHeaderObj.copy() |
|
116 | self.dataOut.processingHeaderObj = self.processingHeaderObj.copy() | |
117 | self.dataOut.systemHeaderObj = self.systemHeaderObj.copy() |
|
117 | self.dataOut.systemHeaderObj = self.systemHeaderObj.copy() | |
118 | self.dataOut.radarControllerHeaderObj = self.radarControllerHeaderObj.copy() |
|
118 | self.dataOut.radarControllerHeaderObj = self.radarControllerHeaderObj.copy() | |
119 | #ADD NEW |
|
119 | #ADD NEW | |
120 | self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock |
|
120 | self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock | |
121 | self.dataOut.heightList = numpy.arange(self.processingHeaderObj.nHeights) * self.processingHeaderObj.deltaHeight + self.processingHeaderObj.firstHeight |
|
121 | self.dataOut.heightList = numpy.arange(self.processingHeaderObj.nHeights) * self.processingHeaderObj.deltaHeight + self.processingHeaderObj.firstHeight | |
122 | self.dataOut.channelList = list(range(self.systemHeaderObj.nChannels)) |
|
122 | self.dataOut.channelList = list(range(self.systemHeaderObj.nChannels)) | |
123 | self.dataOut.nCohInt = self.processingHeaderObj.nCohInt |
|
123 | self.dataOut.nCohInt = self.processingHeaderObj.nCohInt | |
124 | # asumo q la data no esta decodificada |
|
124 | # asumo q la data no esta decodificada | |
125 | self.dataOut.flagDecodeData = self.processingHeaderObj.flag_decode |
|
125 | self.dataOut.flagDecodeData = self.processingHeaderObj.flag_decode | |
126 | # asumo q la data no esta sin flip |
|
126 | # asumo q la data no esta sin flip | |
127 | self.dataOut.flagDeflipData = self.processingHeaderObj.flag_deflip |
|
127 | self.dataOut.flagDeflipData = self.processingHeaderObj.flag_deflip | |
128 | self.dataOut.flagShiftFFT = self.processingHeaderObj.shif_fft |
|
128 | self.dataOut.flagShiftFFT = self.processingHeaderObj.shif_fft | |
129 |
|
129 | |||
130 | def getBasicHeader(self): |
|
130 | def getBasicHeader(self): | |
131 |
|
131 | |||
132 | self.dataOut.utctime = self.basicHeaderObj.utc + self.basicHeaderObj.miliSecond / \ |
|
132 | self.dataOut.utctime = self.basicHeaderObj.utc + self.basicHeaderObj.miliSecond / \ | |
133 | 1000. + self.profileIndex * self.radarControllerHeaderObj.ippSeconds |
|
133 | 1000. + self.profileIndex * self.radarControllerHeaderObj.ippSeconds | |
134 |
|
134 | |||
135 | self.dataOut.flagDiscontinuousBlock = self.flagDiscontinuousBlock |
|
135 | self.dataOut.flagDiscontinuousBlock = self.flagDiscontinuousBlock | |
136 |
|
136 | |||
137 | self.dataOut.timeZone = self.basicHeaderObj.timeZone |
|
137 | self.dataOut.timeZone = self.basicHeaderObj.timeZone | |
138 |
|
138 | |||
139 | self.dataOut.dstFlag = self.basicHeaderObj.dstFlag |
|
139 | self.dataOut.dstFlag = self.basicHeaderObj.dstFlag | |
140 |
|
140 | |||
141 | self.dataOut.errorCount = self.basicHeaderObj.errorCount |
|
141 | self.dataOut.errorCount = self.basicHeaderObj.errorCount | |
142 |
|
142 | |||
143 | self.dataOut.useLocalTime = self.basicHeaderObj.useLocalTime |
|
143 | self.dataOut.useLocalTime = self.basicHeaderObj.useLocalTime | |
144 |
|
144 | |||
145 | self.dataOut.ippSeconds = self.radarControllerHeaderObj.ippSeconds / self.nTxs |
|
145 | self.dataOut.ippSeconds = self.radarControllerHeaderObj.ippSeconds / self.nTxs | |
146 |
|
146 | |||
147 | def reshapeData(self): |
|
147 | def reshapeData(self): | |
148 | if self.nTxs==1: |
|
148 | if self.nTxs==1: | |
149 | return |
|
149 | return | |
150 |
|
150 | |||
151 | def readBlock(self): |
|
151 | def readBlock(self): | |
152 |
|
152 | |||
153 | self.jro_GenerateBlockOfData(Samples= self.samples,DC_level=self.DC_level, |
|
153 | self.jro_GenerateBlockOfData(Samples= self.samples,DC_level=self.DC_level, | |
154 | stdev=self.stdev,Reference= self.Reference, |
|
154 | stdev=self.stdev,Reference= self.Reference, | |
155 | pulses = self.pulses,Num_Codes=self.Num_Codes, |
|
155 | pulses = self.pulses,Num_Codes=self.Num_Codes, | |
156 | pulse_size=self.pulse_size,prof_gen=self.profiles, |
|
156 | pulse_size=self.pulse_size,prof_gen=self.profiles, | |
157 | H0=self.H0,DH0=self.DH0) |
|
157 | H0=self.H0,DH0=self.DH0) | |
158 |
|
158 | |||
159 | self.profileIndex = 0 |
|
159 | self.profileIndex = 0 | |
160 | self.flagIsNewFile = 0 |
|
160 | self.flagIsNewFile = 0 | |
161 | self.flagIsNewBlock = 1 |
|
161 | self.flagIsNewBlock = 1 | |
162 | self.nTotalBlocks += 1 |
|
162 | self.nTotalBlocks += 1 | |
163 | self.nReadBlocks += 1 |
|
163 | self.nReadBlocks += 1 | |
164 |
|
164 | |||
165 | return 1 |
|
165 | return 1 | |
166 |
|
166 | |||
167 |
|
167 | |||
168 | def getData(self): ### metodo propio de VoltageReader |
|
168 | def getData(self): ### metodo propio de VoltageReader | |
169 |
|
169 | |||
170 | if self.flagNoMoreFiles: |
|
170 | if self.flagNoMoreFiles: | |
171 | self.dataOut.flagNodata = True |
|
171 | self.dataOut.flagNodata = True | |
172 | self.flagDiscontinuousBlock = 0 |
|
172 | self.flagDiscontinuousBlock = 0 | |
173 | self.flagIsNewBlock = 0 |
|
173 | self.flagIsNewBlock = 0 | |
174 | if self.__hasNotDataInBuffer(): # aqui es verdad |
|
174 | if self.__hasNotDataInBuffer(): # aqui es verdad | |
175 | if not(self.readNextBlock()): # return 1 y por eso el if not salta a getBasic Header |
|
175 | if not(self.readNextBlock()): # return 1 y por eso el if not salta a getBasic Header | |
176 | return 0 |
|
176 | return 0 | |
177 | self.getFirstHeader() # atributo |
|
177 | self.getFirstHeader() # atributo | |
178 | self.reshapeData() # nTxx1 =1 return , n |
|
178 | self.reshapeData() # nTxx1 =1 return , n | |
179 |
|
179 | |||
180 | if not self.getByBlock: |
|
180 | if not self.getByBlock: | |
181 | self.dataOut.flagDataAsBlock = False |
|
181 | self.dataOut.flagDataAsBlock = False | |
182 | self.dataOut.data = self.datablock[:, self.profileIndex, :] |
|
182 | self.dataOut.data = self.datablock[:, self.profileIndex, :] | |
183 | self.dataOut.profileIndex = self.profileIndex |
|
183 | self.dataOut.profileIndex = self.profileIndex | |
184 | self.profileIndex += 1 |
|
184 | self.profileIndex += 1 | |
185 | else: |
|
185 | else: | |
186 | pass |
|
186 | pass | |
187 | self.dataOut.flagNoData = False |
|
187 | self.dataOut.flagNoData = False | |
188 | self.getBasicHeader() |
|
188 | self.getBasicHeader() | |
189 | self.dataOut.realtime = self.online |
|
189 | self.dataOut.realtime = self.online | |
190 | return self.dataOut.data |
|
190 | return self.dataOut.data | |
191 |
|
191 | |||
192 | def set_kwargs(self, **kwargs): |
|
192 | def set_kwargs(self, **kwargs): | |
193 | for key, value in kwargs.items(): |
|
193 | for key, value in kwargs.items(): | |
194 | setattr(self, key, value) |
|
194 | setattr(self, key, value) | |
195 |
|
195 | |||
196 | def set_RCH(self, expType=2, nTx=1,ipp=None, txA=0, txB=0, |
|
196 | def set_RCH(self, expType=2, nTx=1,ipp=None, txA=0, txB=0, | |
197 | nWindows=None, nHeights=None, firstHeight=None, deltaHeight=None, |
|
197 | nWindows=None, nHeights=None, firstHeight=None, deltaHeight=None, | |
198 | numTaus=0, line6Function=0, line5Function=0, fClock=None, |
|
198 | numTaus=0, line6Function=0, line5Function=0, fClock=None, | |
199 | prePulseBefore=0, prePulseAfter=0, |
|
199 | prePulseBefore=0, prePulseAfter=0, | |
200 | codeType=0, nCode=0, nBaud=0, code=None, |
|
200 | codeType=0, nCode=0, nBaud=0, code=None, | |
201 | flip1=0, flip2=0): |
|
201 | flip1=0, flip2=0): | |
202 |
|
202 | |||
203 | self.radarControllerHeaderObj.expType = expType |
|
203 | self.radarControllerHeaderObj.expType = expType | |
204 | self.radarControllerHeaderObj.nTx = nTx |
|
204 | self.radarControllerHeaderObj.nTx = nTx | |
205 | self.radarControllerHeaderObj.ipp = float(ipp) |
|
205 | self.radarControllerHeaderObj.ipp = float(ipp) | |
206 | self.radarControllerHeaderObj.txA = float(txA) |
|
206 | self.radarControllerHeaderObj.txA = float(txA) | |
207 | self.radarControllerHeaderObj.txB = float(txB) |
|
207 | self.radarControllerHeaderObj.txB = float(txB) | |
208 | self.radarControllerHeaderObj.rangeIPP = ipp |
|
208 | self.radarControllerHeaderObj.rangeIPP = ipp | |
209 | self.radarControllerHeaderObj.rangeTxA = txA |
|
209 | self.radarControllerHeaderObj.rangeTxA = txA | |
210 | self.radarControllerHeaderObj.rangeTxB = txB |
|
210 | self.radarControllerHeaderObj.rangeTxB = txB | |
211 |
|
211 | |||
212 | self.radarControllerHeaderObj.nHeights = int(nHeights) |
|
212 | self.radarControllerHeaderObj.nHeights = int(nHeights) | |
213 | self.radarControllerHeaderObj.firstHeight = numpy.array([firstHeight]) |
|
213 | self.radarControllerHeaderObj.firstHeight = numpy.array([firstHeight]) | |
214 | self.radarControllerHeaderObj.deltaHeight = numpy.array([deltaHeight]) |
|
214 | self.radarControllerHeaderObj.deltaHeight = numpy.array([deltaHeight]) | |
215 | self.radarControllerHeaderObj.samplesWin = numpy.array([nHeights]) |
|
215 | self.radarControllerHeaderObj.samplesWin = numpy.array([nHeights]) | |
216 |
|
216 | |||
217 |
|
217 | |||
218 | self.radarControllerHeaderObj.nWindows = nWindows |
|
218 | self.radarControllerHeaderObj.nWindows = nWindows | |
219 | self.radarControllerHeaderObj.numTaus = numTaus |
|
219 | self.radarControllerHeaderObj.numTaus = numTaus | |
220 | self.radarControllerHeaderObj.codeType = codeType |
|
220 | self.radarControllerHeaderObj.codeType = codeType | |
221 | self.radarControllerHeaderObj.line6Function = line6Function |
|
221 | self.radarControllerHeaderObj.line6Function = line6Function | |
222 | self.radarControllerHeaderObj.line5Function = line5Function |
|
222 | self.radarControllerHeaderObj.line5Function = line5Function | |
223 | self.radarControllerHeaderObj.fclock = fClock |
|
223 | self.radarControllerHeaderObj.fclock = fClock | |
224 | self.radarControllerHeaderObj.prePulseBefore= prePulseBefore |
|
224 | self.radarControllerHeaderObj.prePulseBefore= prePulseBefore | |
225 | self.radarControllerHeaderObj.prePulseAfter = prePulseAfter |
|
225 | self.radarControllerHeaderObj.prePulseAfter = prePulseAfter | |
226 |
|
226 | |||
227 | self.radarControllerHeaderObj.nCode = nCode |
|
227 | self.radarControllerHeaderObj.nCode = nCode | |
228 | self.radarControllerHeaderObj.nBaud = nBaud |
|
228 | self.radarControllerHeaderObj.nBaud = nBaud | |
229 | self.radarControllerHeaderObj.code = code |
|
229 | self.radarControllerHeaderObj.code = code | |
230 | self.radarControllerHeaderObj.flip1 = flip1 |
|
230 | self.radarControllerHeaderObj.flip1 = flip1 | |
231 | self.radarControllerHeaderObj.flip2 = flip2 |
|
231 | self.radarControllerHeaderObj.flip2 = flip2 | |
232 |
|
232 | |||
233 | self.radarControllerHeaderObj.code_size = int(numpy.ceil(nBaud / 32.)) * nCode * 4 |
|
233 | self.radarControllerHeaderObj.code_size = int(numpy.ceil(nBaud / 32.)) * nCode * 4 | |
234 |
|
234 | |||
235 | if fClock is None and deltaHeight is not None: |
|
235 | if fClock is None and deltaHeight is not None: | |
236 | self.fClock = 0.15 / (deltaHeight * 1e-6) |
|
236 | self.fClock = 0.15 / (deltaHeight * 1e-6) | |
237 |
|
237 | |||
238 | def set_PH(self, dtype=0, blockSize=0, profilesPerBlock=0, |
|
238 | def set_PH(self, dtype=0, blockSize=0, profilesPerBlock=0, | |
239 | dataBlocksPerFile=0, nWindows=0, processFlags=0, nCohInt=0, |
|
239 | dataBlocksPerFile=0, nWindows=0, processFlags=0, nCohInt=0, | |
240 | nIncohInt=0, totalSpectra=0, nHeights=0, firstHeight=0, |
|
240 | nIncohInt=0, totalSpectra=0, nHeights=0, firstHeight=0, | |
241 | deltaHeight=0, samplesWin=0, spectraComb=0, nCode=0, |
|
241 | deltaHeight=0, samplesWin=0, spectraComb=0, nCode=0, | |
242 | code=0, nBaud=None, shif_fft=False, flag_dc=False, |
|
242 | code=0, nBaud=None, shif_fft=False, flag_dc=False, | |
243 | flag_cspc=False, flag_decode=False, flag_deflip=False): |
|
243 | flag_cspc=False, flag_decode=False, flag_deflip=False): | |
244 |
|
244 | |||
245 | self.processingHeaderObj.profilesPerBlock = profilesPerBlock |
|
245 | self.processingHeaderObj.profilesPerBlock = profilesPerBlock | |
246 | self.processingHeaderObj.dataBlocksPerFile = dataBlocksPerFile |
|
246 | self.processingHeaderObj.dataBlocksPerFile = dataBlocksPerFile | |
247 | self.processingHeaderObj.nWindows = nWindows |
|
247 | self.processingHeaderObj.nWindows = nWindows | |
248 | self.processingHeaderObj.nCohInt = nCohInt |
|
248 | self.processingHeaderObj.nCohInt = nCohInt | |
249 | self.processingHeaderObj.nIncohInt = nIncohInt |
|
249 | self.processingHeaderObj.nIncohInt = nIncohInt | |
250 | self.processingHeaderObj.totalSpectra = totalSpectra |
|
250 | self.processingHeaderObj.totalSpectra = totalSpectra | |
251 | self.processingHeaderObj.nHeights = int(nHeights) |
|
251 | self.processingHeaderObj.nHeights = int(nHeights) | |
252 | self.processingHeaderObj.firstHeight = firstHeight |
|
252 | self.processingHeaderObj.firstHeight = firstHeight | |
253 | self.processingHeaderObj.deltaHeight = deltaHeight |
|
253 | self.processingHeaderObj.deltaHeight = deltaHeight | |
254 | self.processingHeaderObj.samplesWin = nHeights |
|
254 | self.processingHeaderObj.samplesWin = nHeights | |
255 |
|
255 | |||
256 | def set_BH(self, utc = 0, miliSecond = 0, timeZone = 0): |
|
256 | def set_BH(self, utc = 0, miliSecond = 0, timeZone = 0): | |
257 | self.basicHeaderObj.utc = utc |
|
257 | self.basicHeaderObj.utc = utc | |
258 | self.basicHeaderObj.miliSecond = miliSecond |
|
258 | self.basicHeaderObj.miliSecond = miliSecond | |
259 | self.basicHeaderObj.timeZone = timeZone |
|
259 | self.basicHeaderObj.timeZone = timeZone | |
260 |
|
260 | |||
261 | def set_SH(self, nSamples=0, nProfiles=0, nChannels=0, adcResolution=14, pciDioBusWidth=0): |
|
261 | def set_SH(self, nSamples=0, nProfiles=0, nChannels=0, adcResolution=14, pciDioBusWidth=0): | |
262 | self.systemHeaderObj.nSamples = nSamples |
|
262 | self.systemHeaderObj.nSamples = nSamples | |
263 | self.systemHeaderObj.nProfiles = nProfiles |
|
263 | self.systemHeaderObj.nProfiles = nProfiles | |
264 | self.systemHeaderObj.nChannels = nChannels |
|
264 | self.systemHeaderObj.nChannels = nChannels | |
265 | self.systemHeaderObj.adcResolution = adcResolution |
|
265 | self.systemHeaderObj.adcResolution = adcResolution | |
266 | self.systemHeaderObj.pciDioBusWidth = pciDioBusWidth |
|
266 | self.systemHeaderObj.pciDioBusWidth = pciDioBusWidth | |
267 |
|
267 | |||
268 | def setup(self,incIntFactor= 1, nFFTPoints = 0, FixPP_IncInt=1,FixRCP_IPP=1000, |
|
268 | def setup(self,incIntFactor= 1, nFFTPoints = 0, FixPP_IncInt=1,FixRCP_IPP=1000, | |
269 | FixPP_CohInt= 1,Tau_0= 250,AcqH0_0 = 70 ,AcqDH_0=1.25, Bauds= 32, |
|
269 | FixPP_CohInt= 1,Tau_0= 250,AcqH0_0 = 70 ,AcqDH_0=1.25, Bauds= 32, | |
270 | FixRCP_TXA = 40, FixRCP_TXB = 50, fAngle = 2.0*math.pi*(1/16),DC_level= 500, |
|
270 | FixRCP_TXA = 40, FixRCP_TXB = 50, fAngle = 2.0*math.pi*(1/16),DC_level= 500, | |
271 | stdev= 8,Num_Codes = 1 , Dyn_snCode = None, samples=200,channels=1,Fdoppler=20,Hdoppler=36, |
|
271 | stdev= 8,Num_Codes = 1 , Dyn_snCode = None, samples=200,channels=1,Fdoppler=20,Hdoppler=36, | |
272 | **kwargs): |
|
272 | **kwargs): | |
273 |
|
273 | |||
274 | self.set_kwargs(**kwargs) |
|
274 | self.set_kwargs(**kwargs) | |
275 | self.nReadBlocks = 0 |
|
275 | self.nReadBlocks = 0 | |
276 | tmp = time.time() |
|
276 | tmp = time.time() | |
277 | tmp_utc = int(tmp) |
|
277 | tmp_utc = int(tmp) | |
278 | tmp_milisecond = int((tmp-tmp_utc)*1000) |
|
278 | tmp_milisecond = int((tmp-tmp_utc)*1000) | |
279 | print(" SETUP -basicHeaderObj.utc",datetime.datetime.utcfromtimestamp(tmp)) |
|
279 | print(" SETUP -basicHeaderObj.utc",datetime.datetime.utcfromtimestamp(tmp)) | |
280 | if Dyn_snCode is None: |
|
280 | if Dyn_snCode is None: | |
281 | Num_Codes=1 |
|
281 | Num_Codes=1 | |
282 | Bauds =1 |
|
282 | Bauds =1 | |
283 |
|
283 | |||
284 |
|
284 | |||
285 |
|
285 | |||
286 | self.set_BH(utc= tmp_utc,miliSecond= tmp_milisecond,timeZone=300 ) |
|
286 | self.set_BH(utc= tmp_utc,miliSecond= tmp_milisecond,timeZone=300 ) | |
287 |
|
287 | |||
288 | self.set_RCH( expType=0, nTx=150,ipp=FixRCP_IPP, txA=FixRCP_TXA, txB= FixRCP_TXB, |
|
288 | self.set_RCH( expType=0, nTx=150,ipp=FixRCP_IPP, txA=FixRCP_TXA, txB= FixRCP_TXB, | |
289 | nWindows=1 , nHeights=samples, firstHeight=AcqH0_0, deltaHeight=AcqDH_0, |
|
289 | nWindows=1 , nHeights=samples, firstHeight=AcqH0_0, deltaHeight=AcqDH_0, | |
290 | numTaus=1, line6Function=0, line5Function=0, fClock=None, |
|
290 | numTaus=1, line6Function=0, line5Function=0, fClock=None, | |
291 | prePulseBefore=0, prePulseAfter=0, |
|
291 | prePulseBefore=0, prePulseAfter=0, | |
292 | codeType=14, nCode=Num_Codes, nBaud=32, code=Dyn_snCode, |
|
292 | codeType=14, nCode=Num_Codes, nBaud=32, code=Dyn_snCode, | |
293 | flip1=0, flip2=0) |
|
293 | flip1=0, flip2=0) | |
294 |
|
294 | |||
295 | self.set_PH(dtype=0, blockSize=0, profilesPerBlock=300, |
|
295 | self.set_PH(dtype=0, blockSize=0, profilesPerBlock=300, | |
296 | dataBlocksPerFile=120, nWindows=1, processFlags=0, nCohInt=1, |
|
296 | dataBlocksPerFile=120, nWindows=1, processFlags=0, nCohInt=1, | |
297 | nIncohInt=1, totalSpectra=0, nHeights=samples, firstHeight=AcqH0_0, |
|
297 | nIncohInt=1, totalSpectra=0, nHeights=samples, firstHeight=AcqH0_0, | |
298 | deltaHeight=AcqDH_0, samplesWin=samples, spectraComb=0, nCode=0, |
|
298 | deltaHeight=AcqDH_0, samplesWin=samples, spectraComb=0, nCode=0, | |
299 | code=0, nBaud=None, shif_fft=False, flag_dc=False, |
|
299 | code=0, nBaud=None, shif_fft=False, flag_dc=False, | |
300 | flag_cspc=False, flag_decode=False, flag_deflip=False) |
|
300 | flag_cspc=False, flag_decode=False, flag_deflip=False) | |
301 |
|
301 | |||
302 | self.set_SH(nSamples=samples, nProfiles=300, nChannels=channels) |
|
302 | self.set_SH(nSamples=samples, nProfiles=300, nChannels=channels) | |
303 |
|
303 | |||
304 | self.incIntFactor = incIntFactor |
|
304 | self.incIntFactor = incIntFactor | |
305 | self.nFFTPoints = nFFTPoints |
|
305 | self.nFFTPoints = nFFTPoints | |
306 | self.FixPP_IncInt = FixPP_IncInt |
|
306 | self.FixPP_IncInt = FixPP_IncInt | |
307 | self.FixRCP_IPP = FixRCP_IPP |
|
307 | self.FixRCP_IPP = FixRCP_IPP | |
308 | self.FixPP_CohInt = FixPP_CohInt |
|
308 | self.FixPP_CohInt = FixPP_CohInt | |
309 | self.Tau_0 = Tau_0 |
|
309 | self.Tau_0 = Tau_0 | |
310 | self.AcqH0_0 = AcqH0_0 |
|
310 | self.AcqH0_0 = AcqH0_0 | |
311 | self.H0 = AcqH0_0 |
|
311 | self.H0 = AcqH0_0 | |
312 | self.AcqDH_0 = AcqDH_0 |
|
312 | self.AcqDH_0 = AcqDH_0 | |
313 | self.DH0 = AcqDH_0 |
|
313 | self.DH0 = AcqDH_0 | |
314 | self.Bauds = Bauds |
|
314 | self.Bauds = Bauds | |
315 | self.FixRCP_TXA = FixRCP_TXA |
|
315 | self.FixRCP_TXA = FixRCP_TXA | |
316 | self.FixRCP_TXB = FixRCP_TXB |
|
316 | self.FixRCP_TXB = FixRCP_TXB | |
317 | self.fAngle = fAngle |
|
317 | self.fAngle = fAngle | |
318 | self.DC_level = DC_level |
|
318 | self.DC_level = DC_level | |
319 | self.stdev = stdev |
|
319 | self.stdev = stdev | |
320 | self.Num_Codes = Num_Codes |
|
320 | self.Num_Codes = Num_Codes | |
321 | self.Dyn_snCode = Dyn_snCode |
|
321 | self.Dyn_snCode = Dyn_snCode | |
322 | self.samples = samples |
|
322 | self.samples = samples | |
323 | self.channels = channels |
|
323 | self.channels = channels | |
324 | self.profiles = None |
|
324 | self.profiles = None | |
325 | self.m_nReference = None |
|
325 | self.m_nReference = None | |
326 | self.Baudwidth = None |
|
326 | self.Baudwidth = None | |
327 | self.Fdoppler = Fdoppler |
|
327 | self.Fdoppler = Fdoppler | |
328 | self.Hdoppler = Hdoppler |
|
328 | self.Hdoppler = Hdoppler | |
329 |
|
329 | |||
330 | print("IPP ", self.FixRCP_IPP) |
|
330 | print("IPP ", self.FixRCP_IPP) | |
331 | print("Tau_0 ",self.Tau_0) |
|
331 | print("Tau_0 ",self.Tau_0) | |
332 | print("AcqH0_0",self.AcqH0_0) |
|
332 | print("AcqH0_0",self.AcqH0_0) | |
333 | print("samples,window ",self.samples) |
|
333 | print("samples,window ",self.samples) | |
334 | print("AcqDH_0",AcqDH_0) |
|
334 | print("AcqDH_0",AcqDH_0) | |
335 | print("FixRCP_TXA",self.FixRCP_TXA) |
|
335 | print("FixRCP_TXA",self.FixRCP_TXA) | |
336 | print("FixRCP_TXB",self.FixRCP_TXB) |
|
336 | print("FixRCP_TXB",self.FixRCP_TXB) | |
337 | print("Dyn_snCode",Dyn_snCode) |
|
337 | print("Dyn_snCode",Dyn_snCode) | |
338 | print("Fdoppler", Fdoppler) |
|
338 | print("Fdoppler", Fdoppler) | |
339 | print("Hdoppler",Hdoppler) |
|
339 | print("Hdoppler",Hdoppler) | |
340 |
|
340 | |||
341 | self.init_acquisition() |
|
341 | self.init_acquisition() | |
342 | self.pulses,self.pulse_size=self.init_pulse(Num_Codes=self.Num_Codes,Bauds=self.Bauds,BaudWidth=self.BaudWidth,Dyn_snCode=Dyn_snCode) |
|
342 | self.pulses,self.pulse_size=self.init_pulse(Num_Codes=self.Num_Codes,Bauds=self.Bauds,BaudWidth=self.BaudWidth,Dyn_snCode=Dyn_snCode) | |
343 | print(" [ END ] - SETUP metodo") |
|
343 | print(" [ END ] - SETUP metodo") | |
344 | return |
|
344 | return | |
345 |
|
345 | |||
346 | def run(self,**kwargs): # metodo propio |
|
346 | def run(self,**kwargs): # metodo propio | |
347 | if not(self.isConfig): |
|
347 | if not(self.isConfig): | |
348 | self.setup(**kwargs) |
|
348 | self.setup(**kwargs) | |
349 | self.isConfig = True |
|
349 | self.isConfig = True | |
350 | self.getData() |
|
350 | self.getData() | |
351 |
|
351 | |||
352 | ################################################################## |
|
352 | ################################################################## | |
353 | ###### Aqui ingresamos las clases y metodos propios del simulador |
|
353 | ###### Aqui ingresamos las clases y metodos propios del simulador | |
354 | ################################################################## |
|
354 | ################################################################## | |
355 |
|
355 | |||
356 | ############################################# |
|
356 | ############################################# | |
357 | ############## INIT_ACQUISITION############## |
|
357 | ############## INIT_ACQUISITION############## | |
358 | ############################################# |
|
358 | ############################################# | |
359 | def init_acquisition(self): |
|
359 | def init_acquisition(self): | |
360 |
|
360 | |||
361 | if self.nFFTPoints != 0: |
|
361 | if self.nFFTPoints != 0: | |
362 | self.incIntFactor = m_nProfilesperBlock/self.nFFTPoints |
|
362 | self.incIntFactor = m_nProfilesperBlock/self.nFFTPoints | |
363 | if (self.FixPP_IncInt > self.incIntFactor): |
|
363 | if (self.FixPP_IncInt > self.incIntFactor): | |
364 | self.incIntFactor = self.FixPP_IncInt/ self.incIntFactor |
|
364 | self.incIntFactor = self.FixPP_IncInt/ self.incIntFactor | |
365 | elif(self.FixPP_IncInt< self.incIntFactor): |
|
365 | elif(self.FixPP_IncInt< self.incIntFactor): | |
366 | print("False alert...") |
|
366 | print("False alert...") | |
367 |
|
367 | |||
368 | ProfilesperBlock = self.processingHeaderObj.profilesPerBlock |
|
368 | ProfilesperBlock = self.processingHeaderObj.profilesPerBlock | |
369 |
|
369 | |||
370 | self.timeperblock =int(((self.FixRCP_IPP |
|
370 | self.timeperblock =int(((self.FixRCP_IPP | |
371 | *ProfilesperBlock |
|
371 | *ProfilesperBlock | |
372 | *self.FixPP_CohInt |
|
372 | *self.FixPP_CohInt | |
373 | *self.incIntFactor) |
|
373 | *self.incIntFactor) | |
374 | /150.0) |
|
374 | /150.0) | |
375 | *0.9 |
|
375 | *0.9 | |
376 | +0.5) |
|
376 | +0.5) | |
377 | # para cada canal |
|
377 | # para cada canal | |
378 | self.profiles = ProfilesperBlock*self.FixPP_CohInt |
|
378 | self.profiles = ProfilesperBlock*self.FixPP_CohInt | |
379 | self.profiles = ProfilesperBlock |
|
379 | self.profiles = ProfilesperBlock | |
380 | self.Reference = int((self.Tau_0-self.AcqH0_0)/(self.AcqDH_0)+0.5) |
|
380 | self.Reference = int((self.Tau_0-self.AcqH0_0)/(self.AcqDH_0)+0.5) | |
381 | self.BaudWidth = int((self.FixRCP_TXA/self.AcqDH_0)/self.Bauds + 0.5 ) |
|
381 | self.BaudWidth = int((self.FixRCP_TXA/self.AcqDH_0)/self.Bauds + 0.5 ) | |
382 |
|
382 | |||
383 | if (self.BaudWidth==0): |
|
383 | if (self.BaudWidth==0): | |
384 | self.BaudWidth=1 |
|
384 | self.BaudWidth=1 | |
385 | ################################################################# |
|
385 | ################################################################# | |
386 | ####################### init_pulse ############################## |
|
386 | ####################### init_pulse ############################## | |
387 | ################################################################ |
|
387 | ################################################################ | |
388 |
|
388 | |||
389 | def init_pulse(self,Num_Codes=Num_Codes,Bauds=Bauds,BaudWidth=BaudWidth,Dyn_snCode=Dyn_snCode): |
|
389 | def init_pulse(self,Num_Codes=Num_Codes,Bauds=Bauds,BaudWidth=BaudWidth,Dyn_snCode=Dyn_snCode): | |
390 |
|
390 | |||
391 | Num_Codes = Num_Codes |
|
391 | Num_Codes = Num_Codes | |
392 | Bauds = Bauds |
|
392 | Bauds = Bauds | |
393 | BaudWidth = BaudWidth |
|
393 | BaudWidth = BaudWidth | |
394 | Dyn_snCode = Dyn_snCode |
|
394 | Dyn_snCode = Dyn_snCode | |
395 |
|
395 | |||
396 | if Dyn_snCode: |
|
396 | if Dyn_snCode: | |
397 | print("EXISTE") |
|
397 | print("EXISTE") | |
398 | else: |
|
398 | else: | |
399 | print("No existe") |
|
399 | print("No existe") | |
400 |
|
400 | |||
401 | if Dyn_snCode: # if Bauds: |
|
401 | if Dyn_snCode: # if Bauds: | |
402 | pulses = list(range(0,Num_Codes)) |
|
402 | pulses = list(range(0,Num_Codes)) | |
403 | num_codes = Num_Codes |
|
403 | num_codes = Num_Codes | |
404 | for i in range(num_codes): |
|
404 | for i in range(num_codes): | |
405 | pulse_size = Bauds*BaudWidth |
|
405 | pulse_size = Bauds*BaudWidth | |
406 | pulses[i] = numpy.zeros(pulse_size) |
|
406 | pulses[i] = numpy.zeros(pulse_size) | |
407 | for j in range(Bauds): |
|
407 | for j in range(Bauds): | |
408 | for k in range(BaudWidth): |
|
408 | for k in range(BaudWidth): | |
409 | pulses[i][j*BaudWidth+k] = int(Dyn_snCode[i][j]*600) |
|
409 | pulses[i][j*BaudWidth+k] = int(Dyn_snCode[i][j]*600) | |
410 | else: |
|
410 | else: | |
411 | print("sin code") |
|
411 | print("sin code") | |
412 | pulses = list(range(1)) |
|
412 | pulses = list(range(1)) | |
413 | pulse_size = int(self.FixRCP_TXB/0.15+0.5) |
|
413 | pulse_size = int(self.FixRCP_TXB/0.15+0.5) | |
414 | pulses[0] = numpy.ones(pulse_size) |
|
414 | pulses[0] = numpy.ones(pulse_size) | |
415 | pulses = 600*pulses[0] |
|
415 | pulses = 600*pulses[0] | |
416 |
|
416 | |||
417 | return pulses,pulse_size |
|
417 | return pulses,pulse_size | |
418 |
|
418 | |||
419 | ################################################################# |
|
419 | ################################################################# | |
420 | ##################### Generate block data |
|
420 | ##################### Generate block data | |
421 | ################################################################ |
|
421 | ################################################################ | |
422 |
|
422 | |||
423 | def jro_GenerateBlockOfData(self,Samples=Samples,DC_level= DC_level,stdev=stdev, |
|
423 | def jro_GenerateBlockOfData(self,Samples=Samples,DC_level= DC_level,stdev=stdev, | |
424 | Reference= Reference,pulses= pulses, |
|
424 | Reference= Reference,pulses= pulses, | |
425 | Num_Codes= Num_Codes,pulse_size=pulse_size, |
|
425 | Num_Codes= Num_Codes,pulse_size=pulse_size, | |
426 | prof_gen= prof_gen,H0 = H0,DH0=DH0,Fdoppler= Fdoppler,Hdoppler=Hdoppler): |
|
426 | prof_gen= prof_gen,H0 = H0,DH0=DH0,Fdoppler= Fdoppler,Hdoppler=Hdoppler): | |
427 | Samples = Samples |
|
427 | Samples = Samples | |
428 | DC_level = DC_level |
|
428 | DC_level = DC_level | |
429 | stdev = stdev |
|
429 | stdev = stdev | |
430 | m_nR = Reference |
|
430 | m_nR = Reference | |
431 | pulses = pulses |
|
431 | pulses = pulses | |
432 | num_codes = Num_Codes |
|
432 | num_codes = Num_Codes | |
433 | ps = pulse_size |
|
433 | ps = pulse_size | |
434 | prof_gen = prof_gen |
|
434 | prof_gen = prof_gen | |
435 | channels = self.channels |
|
435 | channels = self.channels | |
436 | H0 = H0 |
|
436 | H0 = H0 | |
437 | DH0 = DH0 |
|
437 | DH0 = DH0 | |
438 | ippSec = self.radarControllerHeaderObj.ippSeconds |
|
438 | ippSec = self.radarControllerHeaderObj.ippSeconds | |
439 | Fdoppler = self.Fdoppler |
|
439 | Fdoppler = self.Fdoppler | |
440 | Hdoppler = self.Hdoppler |
|
440 | Hdoppler = self.Hdoppler | |
441 |
|
441 | |||
442 | self.datablock = numpy.zeros([channels,prof_gen,Samples],dtype= numpy.complex64) |
|
442 | self.datablock = numpy.zeros([channels,prof_gen,Samples],dtype= numpy.complex64) | |
443 | for i in range(channels): |
|
443 | for i in range(channels): | |
444 | for k in range(prof_gen): |
|
444 | for k in range(prof_gen): | |
445 | #·······················NOISE··············· |
|
445 | #·······················NOISE··············· | |
446 | Noise_r = numpy.random.normal(DC_level,stdev,Samples) |
|
446 | Noise_r = numpy.random.normal(DC_level,stdev,Samples) | |
447 | Noise_i = numpy.random.normal(DC_level,stdev,Samples) |
|
447 | Noise_i = numpy.random.normal(DC_level,stdev,Samples) | |
448 | Noise = numpy.zeros(Samples,dtype=complex) |
|
448 | Noise = numpy.zeros(Samples,dtype=complex) | |
449 | Noise.real = Noise_r |
|
449 | Noise.real = Noise_r | |
450 | Noise.imag = Noise_i |
|
450 | Noise.imag = Noise_i | |
451 | #·······················PULSOS·············· |
|
451 | #·······················PULSOS·············· | |
452 | Pulso = numpy.zeros(pulse_size,dtype=complex) |
|
452 | Pulso = numpy.zeros(pulse_size,dtype=complex) | |
453 | Pulso.real = pulses[k%num_codes] |
|
453 | Pulso.real = pulses[k%num_codes] | |
454 | Pulso.imag = pulses[k%num_codes] |
|
454 | Pulso.imag = pulses[k%num_codes] | |
455 | #····················· PULSES+NOISE·········· |
|
455 | #····················· PULSES+NOISE·········· | |
456 | InBuffer = numpy.zeros(Samples,dtype=complex) |
|
456 | InBuffer = numpy.zeros(Samples,dtype=complex) | |
457 | InBuffer[m_nR:m_nR+ps] = Pulso |
|
457 | InBuffer[m_nR:m_nR+ps] = Pulso | |
458 | InBuffer = Noise+ InBuffer |
|
458 | InBuffer = Noise+ InBuffer | |
459 | #····················· ANGLE ······························· |
|
459 | #····················· ANGLE ······························· | |
460 |
|
460 | InBuffer.real[m_nR:m_nR+ps] = InBuffer.real[m_nR:m_nR+ps]*(math.cos( self.fAngle)*5) | ||
461 |
|
||||
462 |
|
||||
463 |
|
||||
464 | InBuffer.imag[m_nR:m_nR+ps] = InBuffer.imag[m_nR:m_nR+ps]*(math.sin( self.fAngle)*5) |
|
461 | InBuffer.imag[m_nR:m_nR+ps] = InBuffer.imag[m_nR:m_nR+ps]*(math.sin( self.fAngle)*5) | |
465 | InBuffer=InBuffer |
|
462 | InBuffer=InBuffer | |
466 | self.datablock[i][k]= InBuffer |
|
463 | self.datablock[i][k]= InBuffer | |
467 | #plot_cts(InBuffer,H0=H0,DH0=DH0 |
|
464 | #plot_cts(InBuffer,H0=H0,DH0=DH0) | |
468 |
|
||||
469 |
|
||||
470 | #wave_fft(x=InBuffer,plot_show=True) |
|
465 | #wave_fft(x=InBuffer,plot_show=True) | |
471 | #time.sleep(1) |
|
466 | #time.sleep(1) | |
472 | #················DOPPLER SIGNAL............................................... |
|
467 | #················DOPPLER SIGNAL............................................... | |
473 | time_vec = numpy.linspace(0,(prof_gen-1)*ippSec,int(prof_gen))+self.nReadBlocks*ippSec*prof_gen |
|
468 | time_vec = numpy.linspace(0,(prof_gen-1)*ippSec,int(prof_gen))+self.nReadBlocks*ippSec*prof_gen | |
474 | fd = Fdoppler #+(600.0/120)*self.nReadBlocks |
|
469 | fd = Fdoppler #+(600.0/120)*self.nReadBlocks | |
475 | d_signal = 650*numpy.array(numpy.exp(1.0j*2.0*math.pi*fd*time_vec),dtype=numpy.complex64) |
|
470 | d_signal = 650*numpy.array(numpy.exp(1.0j*2.0*math.pi*fd*time_vec),dtype=numpy.complex64) | |
476 | #·················· DATABLOCK + DOPPLER············........................... |
|
471 | #·················· DATABLOCK + DOPPLER············........................... | |
477 | HD=int(Hdoppler/self.AcqDH_0) |
|
472 | HD=int(Hdoppler/self.AcqDH_0) | |
478 | self.datablock[0,:,HD]=self.datablock[0,:,HD]+ d_signal # RESULT |
|
473 | self.datablock[0,:,HD]=self.datablock[0,:,HD]+ d_signal # RESULT | |
479 | ''' |
|
474 | ''' | |
480 | a= numpy.zeros(10) |
|
475 | a= numpy.zeros(10) | |
481 | for i in range(10): |
|
476 | for i in range(10): | |
482 | a[i]=i+self.nReadBlocks+20 |
|
477 | a[i]=i+self.nReadBlocks+20 | |
483 | for i in a: |
|
478 | for i in a: | |
484 | self.datablock[0,:,int(i)]=self.datablock[0,:,int(i)]+ d_signal # RESULT |
|
479 | self.datablock[0,:,int(i)]=self.datablock[0,:,int(i)]+ d_signal # RESULT | |
485 | ''' |
|
480 | ''' |
General Comments 0
You need to be logged in to leave comments.
Login now