##// END OF EJS Templates
jrodata se cambio los atrituos de pulsepair,jroplot_voltage se cambio el ploteo de la potencial y la senal, jroIO_simulator se anadio la modificacion de bloquesporarchivo y perfilesporbloque,jro_proc_voltage se corrigio el calculo de noise con remocion DC y se asignaron nuevos nombres al dataOut, jroproc_parameters se anadio los nuevos atributos del dataOut jroproc_voltage pulsepair,test_sim0009.py es el nuevo test de escritura
avaldez -
r1311:816ce18b0db1 v3-devel-julio
parent child
Show More

The requested changes are too big and content was truncated. Show full diff

@@ -359,10 +359,12 class JROData(GenericData):
359 class Voltage(JROData):
359 class Voltage(JROData):
360
360
361 # data es un numpy array de 2 dmensiones (canales, alturas)
361 # data es un numpy array de 2 dmensiones (canales, alturas)
362 data = None
362 data = None
363 data_intensity = None
363 dataPP_POW = None
364 data_velocity = None
364 dataPP_DOP = None
365 data_specwidth = None
365 dataPP_WIDTH = None
366 dataPP_SNR = None
367
366 def __init__(self):
368 def __init__(self):
367 '''
369 '''
368 Constructor
370 Constructor
@@ -421,6 +423,35 class Voltage(JROData):
421
423
422 return noise
424 return noise
423
425
426 def getNoisebyHildebrandDC(self, channel=None,DC=0):
427 """
428 Determino el nivel de ruido usando el metodo Hildebrand-Sekhon
429
430 Return:
431 noiselevel
432 """
433
434 if channel != None:
435 data = self.data[channel]-DC
436 nChannels = 1
437 else:
438 data = self.data
439 nChannels = self.nChannels
440
441 noise = numpy.zeros(nChannels)
442 power = data * numpy.conjugate(data)
443
444 for thisChannel in range(nChannels):
445 if nChannels == 1:
446 daux = power[:].real
447 else:
448 daux = power[thisChannel, :].real
449 noise[thisChannel] = hildebrand_sekhon(daux, self.nCohInt)
450
451 return noise
452
453
454
424 def getNoise(self, type=1, channel=None):
455 def getNoise(self, type=1, channel=None):
425
456
426 if type == 1:
457 if type == 1:
@@ -1262,15 +1293,19 class PlotterData(object):
1262 self.flagDataAsBlock = dataOut.flagDataAsBlock
1293 self.flagDataAsBlock = dataOut.flagDataAsBlock
1263 self.nProfiles = dataOut.nProfiles
1294 self.nProfiles = dataOut.nProfiles
1264 if plot == 'pp_power':
1295 if plot == 'pp_power':
1265 buffer = dataOut.data_intensity
1296 buffer = dataOut.dataPP_POWER
1297 self.flagDataAsBlock = dataOut.flagDataAsBlock
1298 self.nProfiles = dataOut.nProfiles
1299 if plot == 'pp_signal':
1300 buffer = dataOut.dataPP_POW
1266 self.flagDataAsBlock = dataOut.flagDataAsBlock
1301 self.flagDataAsBlock = dataOut.flagDataAsBlock
1267 self.nProfiles = dataOut.nProfiles
1302 self.nProfiles = dataOut.nProfiles
1268 if plot == 'pp_velocity':
1303 if plot == 'pp_velocity':
1269 buffer = dataOut.data_velocity
1304 buffer = dataOut.dataPP_DOP
1270 self.flagDataAsBlock = dataOut.flagDataAsBlock
1305 self.flagDataAsBlock = dataOut.flagDataAsBlock
1271 self.nProfiles = dataOut.nProfiles
1306 self.nProfiles = dataOut.nProfiles
1272 if plot == 'pp_specwidth':
1307 if plot == 'pp_specwidth':
1273 buffer = dataOut.data_specwidth
1308 buffer = dataOut.dataPP_WIDTH
1274 self.flagDataAsBlock = dataOut.flagDataAsBlock
1309 self.flagDataAsBlock = dataOut.flagDataAsBlock
1275 self.nProfiles = dataOut.nProfiles
1310 self.nProfiles = dataOut.nProfiles
1276
1311
@@ -156,6 +156,8 class ScopePlot(Plot):
156 thisDatetime = datetime.datetime.utcfromtimestamp(self.data.times[-1])
156 thisDatetime = datetime.datetime.utcfromtimestamp(self.data.times[-1])
157 if self.CODE == "pp_power":
157 if self.CODE == "pp_power":
158 scope = self.data['pp_power']
158 scope = self.data['pp_power']
159 elif self.CODE == "pp_signal":
160 scope = self.data["pp_signal"]
159 elif self.CODE == "pp_velocity":
161 elif self.CODE == "pp_velocity":
160 scope = self.data["pp_velocity"]
162 scope = self.data["pp_velocity"]
161 elif self.CODE == "pp_specwidth":
163 elif self.CODE == "pp_specwidth":
@@ -191,6 +193,13 class ScopePlot(Plot):
191 thisDatetime,
193 thisDatetime,
192 wintitle
194 wintitle
193 )
195 )
196 if self.CODE=="pp_signal":
197 self.plot_weatherpower(self.data.heights,
198 scope[:,i,:],
199 channels,
200 thisDatetime,
201 wintitle
202 )
194 if self.CODE=="pp_velocity":
203 if self.CODE=="pp_velocity":
195 self.plot_weathervelocity(scope[:,i,:],
204 self.plot_weathervelocity(scope[:,i,:],
196 self.data.heights,
205 self.data.heights,
@@ -230,6 +239,13 class ScopePlot(Plot):
230 thisDatetime,
239 thisDatetime,
231 wintitle
240 wintitle
232 )
241 )
242 if self.CODE=="pp_signal":
243 self.plot_weatherpower(self.data.heights,
244 scope,
245 channels,
246 thisDatetime,
247 wintitle
248 )
233 if self.CODE=="pp_velocity":
249 if self.CODE=="pp_velocity":
234 self.plot_weathervelocity(scope,
250 self.plot_weathervelocity(scope,
235 self.data.heights,
251 self.data.heights,
@@ -249,7 +265,7 class ScopePlot(Plot):
249
265
250 class PulsepairPowerPlot(ScopePlot):
266 class PulsepairPowerPlot(ScopePlot):
251 '''
267 '''
252 Plot for
268 Plot for P= S+N
253 '''
269 '''
254
270
255 CODE = 'pp_power'
271 CODE = 'pp_power'
@@ -259,7 +275,7 class PulsepairPowerPlot(ScopePlot):
259
275
260 class PulsepairVelocityPlot(ScopePlot):
276 class PulsepairVelocityPlot(ScopePlot):
261 '''
277 '''
262 Plot for
278 Plot for VELOCITY
263 '''
279 '''
264 CODE = 'pp_velocity'
280 CODE = 'pp_velocity'
265 plot_name = 'PulsepairVelocity'
281 plot_name = 'PulsepairVelocity'
@@ -268,9 +284,19 class PulsepairVelocityPlot(ScopePlot):
268
284
269 class PulsepairSpecwidthPlot(ScopePlot):
285 class PulsepairSpecwidthPlot(ScopePlot):
270 '''
286 '''
271 Plot for
287 Plot for WIDTH
272 '''
288 '''
273 CODE = 'pp_specwidth'
289 CODE = 'pp_specwidth'
274 plot_name = 'PulsepairSpecwidth'
290 plot_name = 'PulsepairSpecwidth'
275 plot_type = 'scatter'
291 plot_type = 'scatter'
276 buffering = False
292 buffering = False
293
294 class PulsepairSignalPlot(ScopePlot):
295 '''
296 Plot for S
297 '''
298
299 CODE = 'pp_signal'
300 plot_name = 'PulsepairSignal'
301 plot_type = 'scatter'
302 buffering = False
@@ -360,21 +360,27 class SimulatorReader(JRODataReader, ProcessingUnit):
360 fd = Fdoppler #+(600.0/120)*self.nReadBlocks
360 fd = Fdoppler #+(600.0/120)*self.nReadBlocks
361 d_signal = Adoppler*numpy.array(numpy.exp(1.0j*2.0*math.pi*fd*time_vec),dtype=numpy.complex64)
361 d_signal = Adoppler*numpy.array(numpy.exp(1.0j*2.0*math.pi*fd*time_vec),dtype=numpy.complex64)
362 #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·SeΓ±al con ancho espectralΒ·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·
362 #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·SeΓ±al con ancho espectralΒ·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·
363 #specw_sig = numpy.linspace(-149,150,300)
363 if prof_gen%2==0:
364 #w = 8
364 min = int(prof_gen/2.0-1.0)
365 #A = 20
365 max = int(prof_gen/2.0)
366 #specw_sig = specw_sig/w
366 else:
367 #specw_sig = numpy.sinc(specw_sig)
367 min = int(prof_gen/2.0)
368 #specw_sig = A*numpy.array(specw_sig,dtype=numpy.complex64)
368 max = int(prof_gen/2.0)
369 specw_sig = numpy.linspace(-min,max,prof_gen)
370 w = 4
371 A = 20
372 specw_sig = specw_sig/w
373 specw_sig = numpy.sinc(specw_sig)
374 specw_sig = A*numpy.array(specw_sig,dtype=numpy.complex64)
369 #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· DATABLOCK + DOPPLERΒ·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·
375 #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· DATABLOCK + DOPPLERΒ·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·
370 HD=int(Hdoppler/self.AcqDH_0)
376 HD=int(Hdoppler/self.AcqDH_0)
371 for i in range(12):
377 for i in range(12):
372 self.datablock[0,:,HD+i]=self.datablock[0,:,HD+i]+ d_signal# RESULT
378 self.datablock[0,:,HD+i]=self.datablock[0,:,HD+i]+ d_signal# RESULT
373 #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· DATABLOCK + DOPPLER*Sinc(x)Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·
379 #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· DATABLOCK + DOPPLER*Sinc(x)Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·
374 #HD=int(Hdoppler/self.AcqDH_0)
380 HD=int(Hdoppler/self.AcqDH_0)
375 #HD=int(HD/2)
381 HD=int(HD/2)
376 #for i in range(12):
382 for i in range(12):
377 # self.datablock[0,:,HD+i]=self.datablock[0,:,HD+i]+ specw_sig*d_signal# RESULT
383 self.datablock[0,:,HD+i]=self.datablock[0,:,HD+i]+ specw_sig*d_signal# RESULT
378
384
379 def readBlock(self):
385 def readBlock(self):
380
386
@@ -421,7 +427,8 class SimulatorReader(JRODataReader, ProcessingUnit):
421 FixPP_CohInt= 1,Tau_0= 250,AcqH0_0 = 70 ,AcqDH_0=1.25, Bauds= 32,
427 FixPP_CohInt= 1,Tau_0= 250,AcqH0_0 = 70 ,AcqDH_0=1.25, Bauds= 32,
422 FixRCP_TXA = 40, FixRCP_TXB = 50, fAngle = 2.0*math.pi*(1/16),DC_level= 50,
428 FixRCP_TXA = 40, FixRCP_TXB = 50, fAngle = 2.0*math.pi*(1/16),DC_level= 50,
423 stdev= 8,Num_Codes = 1 , Dyn_snCode = None, samples=200,
429 stdev= 8,Num_Codes = 1 , Dyn_snCode = None, samples=200,
424 channels=2,Fdoppler=20,Hdoppler=36,Adoppler=500,nTotalReadFiles=10000,
430 channels=2,Fdoppler=20,Hdoppler=36,Adoppler=500,
431 profilesPerBlock=300,dataBlocksPerFile=120,nTotalReadFiles=10000,
425 **kwargs):
432 **kwargs):
426
433
427 self.set_kwargs(**kwargs)
434 self.set_kwargs(**kwargs)
@@ -447,14 +454,14 class SimulatorReader(JRODataReader, ProcessingUnit):
447 codeType=0, nCode=Num_Codes, nBaud=32, code=Dyn_snCode,
454 codeType=0, nCode=Num_Codes, nBaud=32, code=Dyn_snCode,
448 flip1=0, flip2=0,Taus=Tau_0)
455 flip1=0, flip2=0,Taus=Tau_0)
449
456
450 self.set_PH(dtype=0, blockSize=0, profilesPerBlock=300,
457 self.set_PH(dtype=0, blockSize=0, profilesPerBlock=profilesPerBlock,
451 dataBlocksPerFile=120, nWindows=1, processFlags=numpy.array([1024]), nCohInt=1,
458 dataBlocksPerFile=dataBlocksPerFile, nWindows=1, processFlags=numpy.array([1024]), nCohInt=1,
452 nIncohInt=1, totalSpectra=0, nHeights=samples, firstHeight=AcqH0_0,
459 nIncohInt=1, totalSpectra=0, nHeights=samples, firstHeight=AcqH0_0,
453 deltaHeight=AcqDH_0, samplesWin=samples, spectraComb=0, nCode=0,
460 deltaHeight=AcqDH_0, samplesWin=samples, spectraComb=0, nCode=0,
454 code=0, nBaud=None, shif_fft=False, flag_dc=False,
461 code=0, nBaud=None, shif_fft=False, flag_dc=False,
455 flag_cspc=False, flag_decode=False, flag_deflip=False)
462 flag_cspc=False, flag_decode=False, flag_deflip=False)
456
463
457 self.set_SH(nSamples=samples, nProfiles=300, nChannels=channels)
464 self.set_SH(nSamples=samples, nProfiles=profilesPerBlock, nChannels=channels)
458
465
459 self.readFirstHeader()
466 self.readFirstHeader()
460
467
1 NO CONTENT: modified file
NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
@@ -2,7 +2,8 import sys
2 import numpy,math
2 import numpy,math
3 from scipy import interpolate
3 from scipy import interpolate
4 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator
4 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator
5 from schainpy.model.data.jrodata import Voltage
5 from schainpy.model.data.jrodata import Voltage,hildebrand_sekhon
6 from schainpy.model.data import _noise
6 from schainpy.utils import log
7 from schainpy.utils import log
7 from time import time
8 from time import time
8
9
@@ -1338,9 +1339,6 class PulsePairVoltage(Operation):
1338 n,
1339 n,
1339 dataOut.nHeights),
1340 dataOut.nHeights),
1340 dtype='complex')
1341 dtype='complex')
1341 #self.noise = numpy.zeros([self.__nch,self.__nHeis])
1342 #for i in range(self.__nch):
1343 # self.noise[i]=dataOut.getNoise(channel=i)
1344
1342
1345 def putData(self,data):
1343 def putData(self,data):
1346 '''
1344 '''
@@ -1355,95 +1353,118 class PulsePairVoltage(Operation):
1355 Return the PULSEPAIR and the profiles used in the operation
1353 Return the PULSEPAIR and the profiles used in the operation
1356 Affected : self.__profileIndex
1354 Affected : self.__profileIndex
1357 '''
1355 '''
1356 #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· Remove DCΒ·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·
1358 if self.removeDC==True:
1357 if self.removeDC==True:
1359 mean = numpy.mean(self.__buffer,1)
1358 mean = numpy.mean(self.__buffer,1)
1360 tmp = mean.reshape(self.__nch,1,self.__nHeis)
1359 tmp = mean.reshape(self.__nch,1,self.__nHeis)
1361 dc= numpy.tile(tmp,[1,self.__nProf,1])
1360 dc= numpy.tile(tmp,[1,self.__nProf,1])
1362 self.__buffer = self.__buffer - dc
1361 self.__buffer = self.__buffer - dc
1362 #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Calculo de Potencia Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·
1363 pair0 = self.__buffer*numpy.conj(self.__buffer)
1364 pair0 = pair0.real
1365 lag_0 = numpy.sum(pair0,1)
1366 #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Calculo de Ruido x canalΒ·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·
1367 self.noise = numpy.zeros(self.__nch)
1368 for i in range(self.__nch):
1369 daux = numpy.sort(pair0[i,:,:],axis= None)
1370 self.noise[i]=hildebrand_sekhon( daux ,self.nCohInt)
1371
1372 self.noise = self.noise.reshape(self.__nch,1)
1373 self.noise = numpy.tile(self.noise,[1,self.__nHeis])
1374 noise_buffer = self.noise.reshape(self.__nch,1,self.__nHeis)
1375 noise_buffer = numpy.tile(noise_buffer,[1,self.__nProf,1])
1376 #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· Potencia recibida= P , Potencia senal = S , Ruido= NΒ·Β·
1377 #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· P= S+N ,P=lag_0/N Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·
1378 #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· Power Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·
1379 data_power = lag_0/(self.n*self.nCohInt)
1380 #------------------ Senal Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·
1381 data_intensity = pair0 - noise_buffer
1382 data_intensity = numpy.sum(data_intensity,axis=1)*(self.n*self.nCohInt)#*self.nCohInt)
1383 #data_intensity = (lag_0-self.noise*self.n)*(self.n*self.nCohInt)
1384 for i in range(self.__nch):
1385 for j in range(self.__nHeis):
1386 if data_intensity[i][j] < 0:
1387 data_intensity[i][j] = numpy.min(numpy.absolute(data_intensity[i][j]))
1363
1388
1364 lag_0 = numpy.sum(self.__buffer*numpy.conj(self.__buffer),1)
1389 #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· Calculo de Frecuencia y Velocidad dopplerΒ·Β·Β·Β·Β·Β·Β·Β·
1365 data_intensity = lag_0/(self.n*self.nCohInt)#*self.nCohInt)
1366
1367 pair1 = self.__buffer[:,:-1,:]*numpy.conjugate(self.__buffer[:,1:,:])
1390 pair1 = self.__buffer[:,:-1,:]*numpy.conjugate(self.__buffer[:,1:,:])
1368 lag_1 = numpy.sum(pair1,1)
1391 lag_1 = numpy.sum(pair1,1)
1369 #angle = numpy.angle(numpy.sum(pair1,1))*180/(math.pi)
1392 data_freq = (-1/(2.0*math.pi*self.ippSec*self.nCohInt))*numpy.angle(lag_1)
1370 data_velocity = (-1.0*self.lambda_/(4*math.pi*self.ippSec))*numpy.angle(lag_1)#self.ippSec*self.nCohInt
1393 data_velocity = (self.lambda_/2.0)*data_freq
1371
1394
1372 self.noise = numpy.zeros([self.__nch,self.__nHeis])
1395 #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· Potencia promedio estimada de la SenalΒ·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·
1373 for i in range(self.__nch):
1396 lag_0 = lag_0/self.n
1374 self.noise[i]=dataOut.getNoise(channel=i)
1397 S = lag_0-self.noise
1375
1398
1376 lag_0 = lag_0.real/(self.n)
1399 #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· Frecuencia Doppler promedio Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·
1377 lag_1 = lag_1/(self.n-1)
1400 lag_1 = lag_1/(self.n-1)
1378 R1 = numpy.abs(lag_1)
1401 R1 = numpy.abs(lag_1)
1379 S = (lag_0-self.noise)
1380
1402
1403 #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· Calculo del SNRΒ·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·
1381 data_snrPP = S/self.noise
1404 data_snrPP = S/self.noise
1382 data_snrPP = numpy.where(data_snrPP<0,1,data_snrPP)
1405 for i in range(self.__nch):
1406 for j in range(self.__nHeis):
1407 if data_snrPP[i][j] < 1.e-20:
1408 data_snrPP[i][j] = 1.e-20
1383
1409
1410 #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· Calculo del ancho espectral Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·
1384 L = S/R1
1411 L = S/R1
1385 L = numpy.where(L<0,1,L)
1412 L = numpy.where(L<0,1,L)
1386 L = numpy.log(L)
1413 L = numpy.log(L)
1387
1388 tmp = numpy.sqrt(numpy.absolute(L))
1414 tmp = numpy.sqrt(numpy.absolute(L))
1389
1415 data_specwidth = (self.lambda_/(2*math.sqrt(2)*math.pi*self.ippSec*self.nCohInt))*tmp*numpy.sign(L)
1390 data_specwidth = (self.lambda_/(2*math.sqrt(2)*math.pi*self.ippSec))*tmp*numpy.sign(L)
1391 #data_specwidth = (self.lambda_/(2*math.sqrt(2)*math.pi*self.ippSec))*k
1392 n = self.__profIndex
1416 n = self.__profIndex
1393
1417
1394 self.__buffer = numpy.zeros((self.__nch, self.__nProf,self.__nHeis), dtype='complex')
1418 self.__buffer = numpy.zeros((self.__nch, self.__nProf,self.__nHeis), dtype='complex')
1395 self.__profIndex = 0
1419 self.__profIndex = 0
1396 return data_intensity,data_velocity,data_snrPP,data_specwidth,n
1420 return data_power,data_intensity,data_velocity,data_snrPP,data_specwidth,n
1397
1421
1398 def pulsePairbyProfiles(self,dataOut):
1422 def pulsePairbyProfiles(self,dataOut):
1399
1423
1400 self.__dataReady = False
1424 self.__dataReady = False
1425 data_power = None
1401 data_intensity = None
1426 data_intensity = None
1402 data_velocity = None
1427 data_velocity = None
1403 data_specwidth = None
1428 data_specwidth = None
1404 data_snrPP = None
1429 data_snrPP = None
1405 self.putData(data=dataOut.data)
1430 self.putData(data=dataOut.data)
1406 if self.__profIndex == self.n:
1431 if self.__profIndex == self.n:
1407 #self.noise = numpy.zeros([self.__nch,self.__nHeis])
1432 data_power,data_intensity, data_velocity,data_snrPP,data_specwidth, n = self.pushData(dataOut=dataOut)
1408 #for i in range(self.__nch):
1409 # self.noise[i]=data.getNoise(channel=i)
1410 #print(self.noise.shape)
1411 data_intensity, data_velocity,data_snrPP,data_specwidth, n = self.pushData(dataOut=dataOut)
1412 self.__dataReady = True
1433 self.__dataReady = True
1413
1434
1414 return data_intensity, data_velocity,data_snrPP,data_specwidth
1435 return data_power, data_intensity, data_velocity, data_snrPP, data_specwidth
1415
1436
1416 def pulsePairOp(self, dataOut, datatime= None):
1437 def pulsePairOp(self, dataOut, datatime= None):
1417
1438
1418 if self.__initime == None:
1439 if self.__initime == None:
1419 self.__initime = datatime
1440 self.__initime = datatime
1420 #print("hola")
1441 data_power, data_intensity, data_velocity, data_snrPP, data_specwidth = self.pulsePairbyProfiles(dataOut)
1421 data_intensity, data_velocity,data_snrPP,data_specwidth = self.pulsePairbyProfiles(dataOut)
1422 self.__lastdatatime = datatime
1442 self.__lastdatatime = datatime
1423
1443
1424 if data_intensity is None:
1444 if data_power is None:
1425 return None, None,None,None,None
1445 return None, None, None,None,None,None
1426
1446
1427 avgdatatime = self.__initime
1447 avgdatatime = self.__initime
1428 deltatime = datatime - self.__lastdatatime
1448 deltatime = datatime - self.__lastdatatime
1429 self.__initime = datatime
1449 self.__initime = datatime
1430
1450
1431 return data_intensity, data_velocity,data_snrPP,data_specwidth,avgdatatime
1451 return data_power, data_intensity, data_velocity, data_snrPP, data_specwidth, avgdatatime
1432
1452
1433 def run(self, dataOut,n = None,removeDC= False, overlapping= False,**kwargs):
1453 def run(self, dataOut,n = None,removeDC= False, overlapping= False,**kwargs):
1434
1454
1435 if not self.isConfig:
1455 if not self.isConfig:
1436 self.setup(dataOut = dataOut, n = n , removeDC=removeDC , **kwargs)
1456 self.setup(dataOut = dataOut, n = n , removeDC=removeDC , **kwargs)
1437 self.isConfig = True
1457 self.isConfig = True
1438 data_intensity, data_velocity,data_snrPP,data_specwidth, avgdatatime = self.pulsePairOp(dataOut, dataOut.utctime)
1458 data_power, data_intensity, data_velocity,data_snrPP,data_specwidth, avgdatatime = self.pulsePairOp(dataOut, dataOut.utctime)
1439 dataOut.flagNoData = True
1459 dataOut.flagNoData = True
1440
1460
1441 if self.__dataReady:
1461 if self.__dataReady:
1442 dataOut.nCohInt *= self.n
1462 dataOut.nCohInt *= self.n
1443 dataOut.data_intensity = data_intensity #valor para intensidad
1463 dataOut.dataPP_POW = data_intensity # S
1444 dataOut.data_velocity = data_velocity #valor para velocidad
1464 dataOut.dataPP_POWER = data_power # P
1445 dataOut.data_snrPP = data_snrPP # valor para snr
1465 dataOut.dataPP_DOP = data_velocity
1446 dataOut.data_specwidth = data_specwidth
1466 dataOut.dataPP_SNR = data_snrPP
1467 dataOut.dataPP_WIDTH = data_specwidth
1447 dataOut.PRFbyAngle = self.n #numero de PRF*cada angulo rotado que equivale a un tiempo.
1468 dataOut.PRFbyAngle = self.n #numero de PRF*cada angulo rotado que equivale a un tiempo.
1448 dataOut.utctime = avgdatatime
1469 dataOut.utctime = avgdatatime
1449 dataOut.flagNoData = False
1470 dataOut.flagNoData = False
@@ -2,8 +2,11 import os,sys
2 import datetime
2 import datetime
3 import time
3 import time
4 from schainpy.controller import Project
4 from schainpy.controller import Project
5 path = '/home/alex/Downloads/NEW_WR2/spc16removeDC'
5 #path = '/home/alex/Downloads/NEW_WR2/spc16removeDC'
6 figpath = path
6 #figpath = path
7
8 path = '/home/alex/Downloads/test_rawdata'
9 figpath = '/home/alex/Downloads/hdf5_testPP'
7 desc = "Simulator Test"
10 desc = "Simulator Test"
8
11
9 controllerObj = Project()
12 controllerObj = Project()
@@ -25,25 +28,49 readUnitConfObj = controllerObj.addReadUnit(datatype='SimulatorReader',
25 delay=0,
28 delay=0,
26 online=0,
29 online=0,
27 walk=0,
30 walk=0,
28 nTotalReadFiles=3)
31 profilesPerBlock=625,
29
32 dataBlocksPerFile=100)#,#nTotalReadFiles=2)
30 opObj11 = readUnitConfObj.addOperation(name='printInfo')
31
33
34 '''
35 readUnitConfObj = controllerObj.addReadUnit(datatype='VoltageReader',
36 path=path,
37 startDate="2020/01/01", #"2020/01/01",#today,
38 endDate= "2020/12/01", #"2020/12/30",#today,
39 startTime='00:00:00',
40 endTime='23:59:59',
41 delay=0,
42 #set=0,
43 online=0,
44 walk=1)
45 '''
46 #opObj11 = readUnitConfObj.addOperation(name='printInfo')
32 procUnitConfObjA = controllerObj.addProcUnit(datatype='VoltageProc', inputId=readUnitConfObj.getId())
47 procUnitConfObjA = controllerObj.addProcUnit(datatype='VoltageProc', inputId=readUnitConfObj.getId())
33 #opObj11 = procUnitConfObjA.addOperation(name='CohInt', optype='other')
48 #opObj11 = procUnitConfObjA.addOperation(name='CohInt', optype='other')
34 #opObj11.addParameter(name='n', value='10', format='int')
49 #opObj11.addParameter(name='n', value='4', format='int')
35
50
36 #opObj10 = procUnitConfObjA.addOperation(name='selectChannels')
51 #opObj10 = procUnitConfObjA.addOperation(name='selectChannels')
37 #opObj10.addParameter(name='channelList', value=[0])
52 #opObj10.addParameter(name='channelList', value=[0])
38 opObj11 = procUnitConfObjA.addOperation(name='PulsePairVoltage', optype='other')
53 opObj11 = procUnitConfObjA.addOperation(name='PulsePairVoltage', optype='other')
39 opObj11.addParameter(name='n', value='300', format='int')#10
54 opObj11.addParameter(name='n', value='625', format='int')#10
40 opObj11.addParameter(name='removeDC', value=1, format='int')
55 opObj11.addParameter(name='removeDC', value=1, format='int')
41
56
42 #opObj11 = procUnitConfObjA.addOperation(name='PulsepairPowerPlot', optype='other')
57 #opObj11 = procUnitConfObjA.addOperation(name='PulsepairPowerPlot', optype='other')
58 #opObj11 = procUnitConfObjA.addOperation(name='PulsepairSignalPlot', optype='other')
43
59
44 opObj11 = procUnitConfObjA.addOperation(name='PulsepairVelocityPlot', optype='other')
60
61 #opObj11 = procUnitConfObjA.addOperation(name='PulsepairVelocityPlot', optype='other')
45 #opObj11.addParameter(name='xmax', value=8)
62 #opObj11.addParameter(name='xmax', value=8)
46
63
47 opObj11 = procUnitConfObjA.addOperation(name='PulsepairSpecwidthPlot', optype='other')
64 #opObj11 = procUnitConfObjA.addOperation(name='PulsepairSpecwidthPlot', optype='other')
65
66 procUnitConfObjB= controllerObj.addProcUnit(datatype='ParametersProc',inputId=procUnitConfObjA.getId())
67
68
69 opObj10 = procUnitConfObjB.addOperation(name='ParameterWriter')
70 opObj10.addParameter(name='path',value=figpath)
71 #opObj10.addParameter(name='mode',value=0)
72 opObj10.addParameter(name='blocksPerFile',value='100',format='int')
73 opObj10.addParameter(name='metadataList',value='utctimeInit,timeInterval',format='list')
74 opObj10.addParameter(name='dataList',value='dataPP_POW,dataPP_DOP,dataPP_SNR,dataPP_WIDTH')#,format='list'
48
75
49 controllerObj.start()
76 controllerObj.start()
General Comments 0
You need to be logged in to leave comments. Login now