@@ -354,41 +354,27 class SimulatorReader(JRODataReader, ProcessingUnit): | |||||
354 | InBuffer.imag[m_nR:m_nR+ps] = InBuffer.imag[m_nR:m_nR+ps]*(math.sin( self.fAngle)*5) |
|
354 | InBuffer.imag[m_nR:m_nR+ps] = InBuffer.imag[m_nR:m_nR+ps]*(math.sin( self.fAngle)*5) | |
355 | InBuffer=InBuffer |
|
355 | InBuffer=InBuffer | |
356 | self.datablock[i][k]= InBuffer |
|
356 | self.datablock[i][k]= InBuffer | |
357 | #plot_cts(InBuffer,H0=H0,DH0=DH0) |
|
357 | ||
358 | #wave_fft(x=InBuffer,plot_show=True) |
|
|||
359 | #time.sleep(1) |
|
|||
360 | #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·DOPPLER SIGNAL............................................... |
|
358 | #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·DOPPLER SIGNAL............................................... | |
361 | time_vec = numpy.linspace(0,(prof_gen-1)*ippSec,int(prof_gen))+self.nReadBlocks*ippSec*prof_gen+(self.nReadFiles-1)*ippSec*prof_gen |
|
359 | time_vec = numpy.linspace(0,(prof_gen-1)*ippSec,int(prof_gen))+self.nReadBlocks*ippSec*prof_gen+(self.nReadFiles-1)*ippSec*prof_gen | |
362 | fd = Fdoppler #+(600.0/120)*self.nReadBlocks |
|
360 | fd = Fdoppler #+(600.0/120)*self.nReadBlocks | |
363 | 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) | |
364 | #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·SeΓ±al con ancho espectralΒ·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· |
|
362 | #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·SeΓ±al con ancho espectralΒ·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· | |
365 | #specw_sig = numpy.zeros(int(prof_gen),dtype=complex) |
|
363 | #specw_sig = numpy.linspace(-149,150,300) | |
366 | #specw_sig.real[200:200+100] = 1*numpy.ones(100) |
|
364 | #w = 8 | |
367 | #specw_sig.imag[200:200+100] = 1*numpy.ones(100) |
|
365 | #A = 20 | |
368 | # w=2 |
|
366 | #specw_sig = specw_sig/w | |
369 |
specw_sig = numpy. |
|
367 | #specw_sig = numpy.sinc(specw_sig) | |
370 | w = 3 |
|
368 | #specw_sig = A*numpy.array(specw_sig,dtype=numpy.complex64) | |
371 | A = 10 |
|
|||
372 | specw_sig = specw_sig/w |
|
|||
373 | specw_sig = numpy.sinc(specw_sig) |
|
|||
374 | specw_sig = A*numpy.array(specw_sig,dtype=numpy.complex64) |
|
|||
375 | #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· DATABLOCK + DOPPLERΒ·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· |
|
369 | #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· DATABLOCK + DOPPLERΒ·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· | |
376 | HD=int(Hdoppler/self.AcqDH_0) |
|
370 | HD=int(Hdoppler/self.AcqDH_0) | |
377 | for i in range(12): |
|
371 | for i in range(12): | |
378 | self.datablock[0,:,HD+i]=self.datablock[0,:,HD+i]+ d_signal# RESULT |
|
372 | self.datablock[0,:,HD+i]=self.datablock[0,:,HD+i]+ d_signal# RESULT | |
379 |
|
373 | #Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· DATABLOCK + DOPPLER*Sinc(x)Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β· | ||
380 | HD=int(Hdoppler/self.AcqDH_0) |
|
374 | #HD=int(Hdoppler/self.AcqDH_0) | |
381 | HD=int(HD/2) |
|
375 | #HD=int(HD/2) | |
382 | for i in range(12): |
|
376 | #for i in range(12): | |
383 | self.datablock[0,:,HD+i]=self.datablock[0,:,HD+i]+ specw_sig*d_signal# RESULT |
|
377 | # self.datablock[0,:,HD+i]=self.datablock[0,:,HD+i]+ specw_sig*d_signal# RESULT | |
384 |
|
||||
385 | ''' |
|
|||
386 | a= numpy.zeros(10) |
|
|||
387 | for i in range(10): |
|
|||
388 | a[i]=i+self.nReadBlocks+20 |
|
|||
389 | for i in a: |
|
|||
390 | self.datablock[0,:,int(i)]=self.datablock[0,:,int(i)]+ d_signal # RESULT |
|
|||
391 | ''' |
|
|||
392 |
|
378 | |||
393 | def readBlock(self): |
|
379 | def readBlock(self): | |
394 |
|
380 |
@@ -1338,9 +1338,9 class PulsePairVoltage(Operation): | |||||
1338 | n, |
|
1338 | n, | |
1339 | dataOut.nHeights), |
|
1339 | dataOut.nHeights), | |
1340 | dtype='complex') |
|
1340 | dtype='complex') | |
1341 | self.noise = numpy.zeros([self.__nch,self.__nHeis]) |
|
1341 | #self.noise = numpy.zeros([self.__nch,self.__nHeis]) | |
1342 | for i in range(self.__nch): |
|
1342 | #for i in range(self.__nch): | |
1343 | self.noise[i]=dataOut.getNoise(channel=i) |
|
1343 | # self.noise[i]=dataOut.getNoise(channel=i) | |
1344 |
|
1344 | |||
1345 | def putData(self,data): |
|
1345 | def putData(self,data): | |
1346 | ''' |
|
1346 | ''' | |
@@ -1350,12 +1350,11 class PulsePairVoltage(Operation): | |||||
1350 | self.__profIndex += 1 |
|
1350 | self.__profIndex += 1 | |
1351 | return |
|
1351 | return | |
1352 |
|
1352 | |||
1353 | def pushData(self): |
|
1353 | def pushData(self,dataOut): | |
1354 | ''' |
|
1354 | ''' | |
1355 | Return the PULSEPAIR and the profiles used in the operation |
|
1355 | Return the PULSEPAIR and the profiles used in the operation | |
1356 | Affected : self.__profileIndex |
|
1356 | Affected : self.__profileIndex | |
1357 | ''' |
|
1357 | ''' | |
1358 |
|
||||
1359 | if self.removeDC==True: |
|
1358 | if self.removeDC==True: | |
1360 | mean = numpy.mean(self.__buffer,1) |
|
1359 | mean = numpy.mean(self.__buffer,1) | |
1361 | tmp = mean.reshape(self.__nch,1,self.__nHeis) |
|
1360 | tmp = mean.reshape(self.__nch,1,self.__nHeis) | |
@@ -1370,73 +1369,80 class PulsePairVoltage(Operation): | |||||
1370 | #angle = numpy.angle(numpy.sum(pair1,1))*180/(math.pi) |
|
1369 | #angle = numpy.angle(numpy.sum(pair1,1))*180/(math.pi) | |
1371 | data_velocity = (-1.0*self.lambda_/(4*math.pi*self.ippSec))*numpy.angle(lag_1)#self.ippSec*self.nCohInt |
|
1370 | data_velocity = (-1.0*self.lambda_/(4*math.pi*self.ippSec))*numpy.angle(lag_1)#self.ippSec*self.nCohInt | |
1372 |
|
1371 | |||
|
1372 | self.noise = numpy.zeros([self.__nch,self.__nHeis]) | |||
|
1373 | for i in range(self.__nch): | |||
|
1374 | self.noise[i]=dataOut.getNoise(channel=i) | |||
|
1375 | ||||
1373 | lag_0 = lag_0.real/(self.n) |
|
1376 | lag_0 = lag_0.real/(self.n) | |
1374 | lag_1 = lag_1/(self.n-1) |
|
1377 | lag_1 = lag_1/(self.n-1) | |
1375 | R1 = numpy.abs(lag_1) |
|
1378 | R1 = numpy.abs(lag_1) | |
1376 | S = (lag_0-self.noise) |
|
1379 | S = (lag_0-self.noise) | |
1377 | #k = R1/S |
|
1380 | ||
1378 | #k = 1-k |
|
1381 | data_snrPP = S/self.noise | |
1379 | #k =numpy.absolute(k) |
|
1382 | data_snrPP = numpy.where(data_snrPP<0,1,data_snrPP) | |
1380 | #k =numpy.sqrt(k) |
|
1383 | ||
1381 | L = S/R1 |
|
1384 | L = S/R1 | |
1382 | #print("L",L[0]) |
|
|||
1383 | L = numpy.where(L<0,1,L) |
|
1385 | L = numpy.where(L<0,1,L) | |
1384 | L = numpy.log(L) |
|
1386 | L = numpy.log(L) | |
|
1387 | ||||
1385 | tmp = numpy.sqrt(numpy.absolute(L)) |
|
1388 | tmp = numpy.sqrt(numpy.absolute(L)) | |
|
1389 | ||||
1386 | data_specwidth = (self.lambda_/(2*math.sqrt(2)*math.pi*self.ippSec))*tmp*numpy.sign(L) |
|
1390 | data_specwidth = (self.lambda_/(2*math.sqrt(2)*math.pi*self.ippSec))*tmp*numpy.sign(L) | |
1387 | #data_specwidth = (self.lambda_/(2*math.sqrt(2)*math.pi*self.ippSec))*k |
|
1391 | #data_specwidth = (self.lambda_/(2*math.sqrt(2)*math.pi*self.ippSec))*k | |
1388 | n = self.__profIndex |
|
1392 | n = self.__profIndex | |
1389 |
|
1393 | |||
1390 | self.__buffer = numpy.zeros((self.__nch, self.__nProf,self.__nHeis), dtype='complex') |
|
1394 | self.__buffer = numpy.zeros((self.__nch, self.__nProf,self.__nHeis), dtype='complex') | |
1391 | self.__profIndex = 0 |
|
1395 | self.__profIndex = 0 | |
1392 | return data_intensity,data_velocity,data_specwidth,n |
|
1396 | return data_intensity,data_velocity,data_snrPP,data_specwidth,n | |
1393 |
|
1397 | |||
1394 | def pulsePairbyProfiles(self,data): |
|
1398 | def pulsePairbyProfiles(self,dataOut): | |
1395 |
|
1399 | |||
1396 | self.__dataReady = False |
|
1400 | self.__dataReady = False | |
1397 | data_intensity = None |
|
1401 | data_intensity = None | |
1398 | data_velocity = None |
|
1402 | data_velocity = None | |
1399 | data_specwidth = None |
|
1403 | data_specwidth = None | |
1400 | self.putData(data) |
|
1404 | data_snrPP = None | |
|
1405 | self.putData(data=dataOut.data) | |||
1401 | if self.__profIndex == self.n: |
|
1406 | if self.__profIndex == self.n: | |
1402 | #self.noise = numpy.zeros([self.__nch,self.__nHeis]) |
|
1407 | #self.noise = numpy.zeros([self.__nch,self.__nHeis]) | |
1403 | #for i in range(self.__nch): |
|
1408 | #for i in range(self.__nch): | |
1404 | # self.noise[i]=data.getNoise(channel=i) |
|
1409 | # self.noise[i]=data.getNoise(channel=i) | |
1405 | #print(self.noise.shape) |
|
1410 | #print(self.noise.shape) | |
1406 | data_intensity, data_velocity,data_specwidth, n = self.pushData() |
|
1411 | data_intensity, data_velocity,data_snrPP,data_specwidth, n = self.pushData(dataOut=dataOut) | |
1407 | self.__dataReady = True |
|
1412 | self.__dataReady = True | |
1408 |
|
1413 | |||
1409 | return data_intensity, data_velocity,data_specwidth |
|
1414 | return data_intensity, data_velocity,data_snrPP,data_specwidth | |
1410 |
|
1415 | |||
1411 | def pulsePairOp(self, data, datatime= None): |
|
1416 | def pulsePairOp(self, dataOut, datatime= None): | |
1412 |
|
1417 | |||
1413 | if self.__initime == None: |
|
1418 | if self.__initime == None: | |
1414 | self.__initime = datatime |
|
1419 | self.__initime = datatime | |
1415 |
|
1420 | #print("hola") | ||
1416 | data_intensity, data_velocity,data_specwidth = self.pulsePairbyProfiles(data) |
|
1421 | data_intensity, data_velocity,data_snrPP,data_specwidth = self.pulsePairbyProfiles(dataOut) | |
1417 | self.__lastdatatime = datatime |
|
1422 | self.__lastdatatime = datatime | |
1418 |
|
1423 | |||
1419 | if data_intensity is None: |
|
1424 | if data_intensity is None: | |
1420 |
return None, None,None, |
|
1425 | return None, None,None,None,None | |
1421 |
|
1426 | |||
1422 | avgdatatime = self.__initime |
|
1427 | avgdatatime = self.__initime | |
1423 | deltatime = datatime - self.__lastdatatime |
|
1428 | deltatime = datatime - self.__lastdatatime | |
1424 | self.__initime = datatime |
|
1429 | self.__initime = datatime | |
1425 |
|
1430 | |||
1426 | return data_intensity, data_velocity,data_specwidth,avgdatatime |
|
1431 | return data_intensity, data_velocity,data_snrPP,data_specwidth,avgdatatime | |
1427 |
|
1432 | |||
1428 | def run(self, dataOut,n = None,removeDC= False, overlapping= False,**kwargs): |
|
1433 | def run(self, dataOut,n = None,removeDC= False, overlapping= False,**kwargs): | |
1429 |
|
1434 | |||
1430 | if not self.isConfig: |
|
1435 | if not self.isConfig: | |
1431 | self.setup(dataOut = dataOut, n = n , removeDC=removeDC , **kwargs) |
|
1436 | self.setup(dataOut = dataOut, n = n , removeDC=removeDC , **kwargs) | |
1432 | self.isConfig = True |
|
1437 | self.isConfig = True | |
1433 |
data_intensity, data_velocity,data_specwidth, avgdatatime = self.pulsePairOp(dataOut |
|
1438 | data_intensity, data_velocity,data_snrPP,data_specwidth, avgdatatime = self.pulsePairOp(dataOut, dataOut.utctime) | |
1434 | dataOut.flagNoData = True |
|
1439 | dataOut.flagNoData = True | |
1435 |
|
1440 | |||
1436 | if self.__dataReady: |
|
1441 | if self.__dataReady: | |
1437 | dataOut.nCohInt *= self.n |
|
1442 | dataOut.nCohInt *= self.n | |
1438 | dataOut.data_intensity = data_intensity #valor para intensidad |
|
1443 | dataOut.data_intensity = data_intensity #valor para intensidad | |
1439 | dataOut.data_velocity = data_velocity #valor para velocidad |
|
1444 | dataOut.data_velocity = data_velocity #valor para velocidad | |
|
1445 | dataOut.data_snrPP = data_snrPP # valor para snr | |||
1440 | dataOut.data_specwidth = data_specwidth |
|
1446 | dataOut.data_specwidth = data_specwidth | |
1441 | dataOut.PRFbyAngle = self.n #numero de PRF*cada angulo rotado que equivale a un tiempo. |
|
1447 | dataOut.PRFbyAngle = self.n #numero de PRF*cada angulo rotado que equivale a un tiempo. | |
1442 | dataOut.utctime = avgdatatime |
|
1448 | dataOut.utctime = avgdatatime |
General Comments 0
You need to be logged in to leave comments.
Login now