@@ -3,7 +3,7 Base clases to create Processing units and operations, the MPDecorator | |||||
3 | must be used in plotting and writing operations to allow to run as an |
|
3 | must be used in plotting and writing operations to allow to run as an | |
4 | external process. |
|
4 | external process. | |
5 | ''' |
|
5 | ''' | |
6 |
|
6 | # repositorio master | ||
7 | import inspect |
|
7 | import inspect | |
8 | import zmq |
|
8 | import zmq | |
9 | import time |
|
9 | import time |
@@ -10,7 +10,6 to work with Spectra data type | |||||
10 |
|
10 | |||
11 | import time |
|
11 | import time | |
12 | import itertools |
|
12 | import itertools | |
13 |
|
||||
14 | import numpy |
|
13 | import numpy | |
15 | # repositorio |
|
14 | # repositorio | |
16 | from schainpy.model.proc.jroproc_base import ProcessingUnit, MPDecorator, Operation |
|
15 | from schainpy.model.proc.jroproc_base import ProcessingUnit, MPDecorator, Operation | |
@@ -155,7 +154,6 class SpectraProc(ProcessingUnit): | |||||
155 |
|
154 | |||
156 | if self.dataIn.flagDataAsBlock: |
|
155 | if self.dataIn.flagDataAsBlock: | |
157 | nVoltProfiles = self.dataIn.data.shape[1] |
|
156 | nVoltProfiles = self.dataIn.data.shape[1] | |
158 |
|
||||
159 | if nVoltProfiles == nProfiles: |
|
157 | if nVoltProfiles == nProfiles: | |
160 | self.buffer = self.dataIn.data.copy() |
|
158 | self.buffer = self.dataIn.data.copy() | |
161 | self.profIndex = nVoltProfiles |
|
159 | self.profIndex = nVoltProfiles | |
@@ -171,6 +169,19 class SpectraProc(ProcessingUnit): | |||||
171 | self.profIndex += nVoltProfiles |
|
169 | self.profIndex += nVoltProfiles | |
172 | self.id_min += nVoltProfiles |
|
170 | self.id_min += nVoltProfiles | |
173 | self.id_max += nVoltProfiles |
|
171 | self.id_max += nVoltProfiles | |
|
172 | elif nVoltProfiles > nProfiles: | |||
|
173 | self.reader.bypass = True | |||
|
174 | if self.profIndex == 0: | |||
|
175 | self.id_min = 0 | |||
|
176 | self.id_max = nProfiles | |||
|
177 | ||||
|
178 | self.buffer = self.dataIn.data[:, self.id_min:self.id_max,:] | |||
|
179 | self.profIndex += nProfiles | |||
|
180 | self.id_min += nProfiles | |||
|
181 | self.id_max += nProfiles | |||
|
182 | if self.id_max == nVoltProfiles: | |||
|
183 | self.reader.bypass = False | |||
|
184 | ||||
174 | else: |
|
185 | else: | |
175 | raise ValueError("The type object %s has %d profiles, it should just has %d profiles" % ( |
|
186 | raise ValueError("The type object %s has %d profiles, it should just has %d profiles" % ( | |
176 | self.dataIn.type, self.dataIn.data.shape[1], nProfiles)) |
|
187 | self.dataIn.type, self.dataIn.data.shape[1], nProfiles)) | |
@@ -191,6 +202,7 class SpectraProc(ProcessingUnit): | |||||
191 | self.__getFft() |
|
202 | self.__getFft() | |
192 | self.dataOut.flagNoData = False |
|
203 | self.dataOut.flagNoData = False | |
193 | self.firstdatatime = None |
|
204 | self.firstdatatime = None | |
|
205 | if not self.reader.bypass: | |||
194 | self.profIndex = 0 |
|
206 | self.profIndex = 0 | |
195 | else: |
|
207 | else: | |
196 | raise ValueError("The type of input object '%s' is not valid".format( |
|
208 | raise ValueError("The type of input object '%s' is not valid".format( | |
@@ -274,16 +286,13 class SpectraProc(ProcessingUnit): | |||||
274 | if val >= beacon_dB[0]: |
|
286 | if val >= beacon_dB[0]: | |
275 | beacon_heiIndexList.append(avg_dB.tolist().index(val)) |
|
287 | beacon_heiIndexList.append(avg_dB.tolist().index(val)) | |
276 |
|
288 | |||
277 | #data_spc = data_spc[:,:,beacon_heiIndexList] |
|
|||
278 | data_cspc = None |
|
289 | data_cspc = None | |
279 | if self.dataOut.data_cspc is not None: |
|
290 | if self.dataOut.data_cspc is not None: | |
280 | data_cspc = self.dataOut.data_cspc[:, :, minIndex:maxIndex + 1] |
|
291 | data_cspc = self.dataOut.data_cspc[:, :, minIndex:maxIndex + 1] | |
281 | #data_cspc = data_cspc[:,:,beacon_heiIndexList] |
|
|||
282 |
|
292 | |||
283 | data_dc = None |
|
293 | data_dc = None | |
284 | if self.dataOut.data_dc is not None: |
|
294 | if self.dataOut.data_dc is not None: | |
285 | data_dc = self.dataOut.data_dc[:, minIndex:maxIndex + 1] |
|
295 | data_dc = self.dataOut.data_dc[:, minIndex:maxIndex + 1] | |
286 | #data_dc = data_dc[:,beacon_heiIndexList] |
|
|||
287 |
|
296 | |||
288 | self.dataOut.data_spc = data_spc |
|
297 | self.dataOut.data_spc = data_spc | |
289 | self.dataOut.data_cspc = data_cspc |
|
298 | self.dataOut.data_cspc = data_cspc | |
@@ -698,6 +707,30 class removeInterference(Operation): | |||||
698 | return self.dataOut |
|
707 | return self.dataOut | |
699 |
|
708 | |||
700 |
|
709 | |||
|
710 | class deflip(Operation): | |||
|
711 | ||||
|
712 | def run(self, dataOut): | |||
|
713 | # arreglo 1: (num_chan, num_profiles, num_heights) | |||
|
714 | self.dataOut = dataOut | |||
|
715 | ||||
|
716 | # JULIA-oblicua, indice 2 | |||
|
717 | # arreglo 2: (num_profiles, num_heights) | |||
|
718 | jspectra = self.dataOut.data_spc[2] | |||
|
719 | jspectra_tmp=numpy.zeros(jspectra.shape) | |||
|
720 | num_profiles=jspectra.shape[0] | |||
|
721 | freq_dc = int(num_profiles / 2) | |||
|
722 | # Flip con for | |||
|
723 | for j in range(num_profiles): | |||
|
724 | jspectra_tmp[num_profiles-j-1]= jspectra[j] | |||
|
725 | # Intercambio perfil de DC con perfil inmediato anterior | |||
|
726 | jspectra_tmp[freq_dc-1]= jspectra[freq_dc-1] | |||
|
727 | jspectra_tmp[freq_dc]= jspectra[freq_dc] | |||
|
728 | # canal modificado es re-escrito en el arreglo de canales | |||
|
729 | self.dataOut.data_spc[2] = jspectra_tmp | |||
|
730 | ||||
|
731 | return self.dataOut | |||
|
732 | ||||
|
733 | ||||
701 | class IncohInt(Operation): |
|
734 | class IncohInt(Operation): | |
702 |
|
735 | |||
703 | __profIndex = 0 |
|
736 | __profIndex = 0 |
General Comments 0
You need to be logged in to leave comments.
Login now