##// END OF EJS Templates
Update jroproc_base.py Queue size y jroproc_spectra.py
Alexander Valdez -
r1668:8880a814f9ea
parent child
Show More
@@ -3,7 +3,7 Base clases to create Processing units and operations, the MPDecorator
3 3 must be used in plotting and writing operations to allow to run as an
4 4 external process.
5 5 '''
6
6 # repositorio master
7 7 import inspect
8 8 import zmq
9 9 import time
@@ -10,7 +10,6 to work with Spectra data type
10 10
11 11 import time
12 12 import itertools
13
14 13 import numpy
15 14 # repositorio
16 15 from schainpy.model.proc.jroproc_base import ProcessingUnit, MPDecorator, Operation
@@ -155,7 +154,6 class SpectraProc(ProcessingUnit):
155 154
156 155 if self.dataIn.flagDataAsBlock:
157 156 nVoltProfiles = self.dataIn.data.shape[1]
158
159 157 if nVoltProfiles == nProfiles:
160 158 self.buffer = self.dataIn.data.copy()
161 159 self.profIndex = nVoltProfiles
@@ -171,6 +169,19 class SpectraProc(ProcessingUnit):
171 169 self.profIndex += nVoltProfiles
172 170 self.id_min += nVoltProfiles
173 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 185 else:
175 186 raise ValueError("The type object %s has %d profiles, it should just has %d profiles" % (
176 187 self.dataIn.type, self.dataIn.data.shape[1], nProfiles))
@@ -191,6 +202,7 class SpectraProc(ProcessingUnit):
191 202 self.__getFft()
192 203 self.dataOut.flagNoData = False
193 204 self.firstdatatime = None
205 if not self.reader.bypass:
194 206 self.profIndex = 0
195 207 else:
196 208 raise ValueError("The type of input object '%s' is not valid".format(
@@ -274,16 +286,13 class SpectraProc(ProcessingUnit):
274 286 if val >= beacon_dB[0]:
275 287 beacon_heiIndexList.append(avg_dB.tolist().index(val))
276 288
277 #data_spc = data_spc[:,:,beacon_heiIndexList]
278 289 data_cspc = None
279 290 if self.dataOut.data_cspc is not None:
280 291 data_cspc = self.dataOut.data_cspc[:, :, minIndex:maxIndex + 1]
281 #data_cspc = data_cspc[:,:,beacon_heiIndexList]
282 292
283 293 data_dc = None
284 294 if self.dataOut.data_dc is not None:
285 295 data_dc = self.dataOut.data_dc[:, minIndex:maxIndex + 1]
286 #data_dc = data_dc[:,beacon_heiIndexList]
287 296
288 297 self.dataOut.data_spc = data_spc
289 298 self.dataOut.data_cspc = data_cspc
@@ -698,6 +707,30 class removeInterference(Operation):
698 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 734 class IncohInt(Operation):
702 735
703 736 __profIndex = 0
General Comments 0
You need to be logged in to leave comments. Login now