##// END OF EJS Templates
minor changes spectra plot
joabAM -
r1558:0436325fab68
parent child
Show More
@@ -514,7 +514,7 class Spectra(JROData):
514 for channel in range(self.nChannels):
514 for channel in range(self.nChannels):
515 daux = self.data_spc[channel,xmin_index:xmax_index, ymin_index:ymax_index]
515 daux = self.data_spc[channel,xmin_index:xmax_index, ymin_index:ymax_index]
516
516
517 noise[channel] = hildebrand_sekhon(daux, self.max_nIncohInt)
517 noise[channel] = hildebrand_sekhon(daux, self.max_nIncohInt[channel])
518
518
519 return noise
519 return noise
520
520
@@ -61,18 +61,23 class SpectraPlot(Plot):
61 noise = 10*numpy.log10(dataOut.getNoise()/norm)
61 noise = 10*numpy.log10(dataOut.getNoise()/norm)
62
62
63
63
64 z = []
64 z = numpy.zeros((dataOut.nChannels, dataOut.nFFTPoints, dataOut.nHeights))
65 for ch in range(dataOut.nChannels):
65 for ch in range(dataOut.nChannels):
66 if hasattr(dataOut.normFactor,'shape'):
66 if hasattr(dataOut.normFactor,'ndim'):
67 z.append(numpy.divide(dataOut.data_spc[ch],dataOut.normFactor[ch]))
67 if dataOut.normFactor.ndim > 1:
68 z[ch] = (numpy.divide(dataOut.data_spc[ch],dataOut.normFactor[ch]))
69
70 else:
71 z[ch] = (numpy.divide(dataOut.data_spc[ch],dataOut.normFactor))
68 else:
72 else:
69 z.append(numpy.divide(dataOut.data_spc[ch],dataOut.normFactor))
73 z[ch] = (numpy.divide(dataOut.data_spc[ch],dataOut.normFactor))
74
70
75
71 z = numpy.asarray(z)
72 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
76 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
73 spc = 10*numpy.log10(z)
77 spc = 10*numpy.log10(z)
74
78
75 data['spc'] = spc
79 data['spc'] = spc
80 print(spc[0].shape)
76 data['rti'] = spc.mean(axis=1)
81 data['rti'] = spc.mean(axis=1)
77 data['noise'] = noise
82 data['noise'] = noise
78 meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
83 meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
@@ -492,13 +492,20 class AMISRReader(ProcessingUnit):
492 #Dimensions : nChannels, nProfiles, nSamples
492 #Dimensions : nChannels, nProfiles, nSamples
493 new_block = numpy.empty((nblocks, nchan, numpy.int_(self.newProfiles), nsamples), dtype="complex64")
493 new_block = numpy.empty((nblocks, nchan, numpy.int_(self.newProfiles), nsamples), dtype="complex64")
494 ############################################
494 ############################################
495 profPerCH = int(self.profPerBlockRAW / (self.nFFT * self.nChannels))
495 profPerCH = int(self.profPerBlockRAW / (self.nFFT* self.nChannels))
496
496
497 for thisChannel in range(nchan):
497 for thisChannel in range(nchan):
498
498
499 idx_ch = [thisChannel+k*nchan for k in range(profPerCH)]
499 idx_ch = [thisChannel+(k*nchan*self.nFFT) for k in range(profPerCH)]
500 idx_ch = numpy.array(idx_ch, dtype=int)
500 if self.nFFT > 1:
501 #print(thisChannel,idx_ch)
501 aux = [numpy.arange(i, i+self.nFFT) for i in idx_ch]
502 idx_ch = None
503 idx_ch =aux
504 idx_ch = numpy.array(idx_ch, dtype=int).flatten()
505 else:
506 idx_ch = numpy.array(idx_ch, dtype=int)
507
508 #print(thisChannel,profPerCH,idx_ch)
502 #print(numpy.where(channels==self.beamCode[thisChannel])[0])
509 #print(numpy.where(channels==self.beamCode[thisChannel])[0])
503 #new_block[:,thisChannel,:,:] = self.dataset[:,numpy.where(channels==self.beamCode[thisChannel])[0],:]
510 #new_block[:,thisChannel,:,:] = self.dataset[:,numpy.where(channels==self.beamCode[thisChannel])[0],:]
504 new_block[:,thisChannel,:,:] = self.dataset[:,idx_ch,:]
511 new_block[:,thisChannel,:,:] = self.dataset[:,idx_ch,:]
@@ -574,10 +574,11 class HDFWriter(Operation):
574 grp = fp.create_group('Metadata')
574 grp = fp.create_group('Metadata')
575
575
576 for i in range(len(self.metadataList)):
576 for i in range(len(self.metadataList)):
577 if not hasattr(self.dataOut, self.metadataList[i]):
577 attribute = self.metadataList[i]
578 log.warning('Metadata: `{}` not found'.format(self.metadataList[i]), self.name)
578 if not hasattr(self.dataOut,attribute ):
579 log.warning('Metadata: `{}` not found'.format(attribute), self.name)
579 continue
580 continue
580 value = getattr(self.dataOut, self.metadataList[i])
581 value = getattr(self.dataOut, attribute)
581 if isinstance(value, bool):
582 if isinstance(value, bool):
582 if value is True:
583 if value is True:
583 value = 1
584 value = 1
@@ -71,7 +71,7 class ParametersProc(ProcessingUnit):
71 self.dataOut.useLocalTime = self.dataIn.useLocalTime
71 self.dataOut.useLocalTime = self.dataIn.useLocalTime
72 self.dataOut.radar_ipp = self.dataIn.radar_ipp
72 self.dataOut.radar_ipp = self.dataIn.radar_ipp
73 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
73 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
74 self.dataOut.radarControllerHeaderTxt = self.dataOut.radarControllerHeaderObj.toString()
74 #self.dataOut.radarControllerHeaderTxt = self.dataOut.radarControllerHeaderObj.toString()
75 self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy()
75 self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy()
76 self.dataOut.channelList = self.dataIn.channelList
76 self.dataOut.channelList = self.dataIn.channelList
77 self.dataOut.heightList = self.dataIn.heightList
77 self.dataOut.heightList = self.dataIn.heightList
@@ -142,7 +142,7 class ParametersProc(ProcessingUnit):
142 self.dataOut.nFFTPoints = self.dataIn.nFFTPoints
142 self.dataOut.nFFTPoints = self.dataIn.nFFTPoints
143 self.dataOut.ippFactor = self.dataIn.ippFactor
143 self.dataOut.ippFactor = self.dataIn.ippFactor
144 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
144 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
145 self.dataOut.radarControllerHeaderTxt = self.dataOut.radarControllerHeaderObj.toString()
145 #self.dataOut.radarControllerHeaderTxt = self.dataOut.radarControllerHeaderObj.toString()
146 self.dataOut.ipp = self.dataIn.ipp
146 self.dataOut.ipp = self.dataIn.ipp
147 self.dataOut.radar_ipp = self.dataIn.radar_ipp
147 self.dataOut.radar_ipp = self.dataIn.radar_ipp
148 self.dataOut.sampled_heightsFFT = self.dataIn.sampled_heightsFFT
148 self.dataOut.sampled_heightsFFT = self.dataIn.sampled_heightsFFT
@@ -1303,9 +1303,9 class SpectralMoments(Operation):
1303 max_spec = aux.max()
1303 max_spec = aux.max()
1304 m = aux.tolist().index(max_spec)
1304 m = aux.tolist().index(max_spec)
1305
1305
1306 if hasattr(normFactor, "shape"):
1306 if hasattr(normFactor, "ndim"):
1307 norm = normFactor[ind]
1307 if normFactor.ndim > 1:
1308
1308 norm = normFactor[ind]
1309 # Smooth
1309 # Smooth
1310 if (smooth == 0):
1310 if (smooth == 0):
1311 spec2 = spec
1311 spec2 = spec
@@ -1350,9 +1350,7 class SpectralMoments(Operation):
1350 spec2 *= (norm*norm) #compensation for sats remove
1350 spec2 *= (norm*norm) #compensation for sats remove
1351 #snr = (spec2.mean()-n0)/n0
1351 #snr = (spec2.mean()-n0)/n0
1352 snr = (spec2.mean())/n0
1352 snr = (spec2.mean())/n0
1353 #print(snr)
1353
1354 # if snr < 1.0: # By definition SNR must be higher than 1
1355 # snr = 0
1356
1354
1357 # vec_power[ind] = power #D. Scipión replaced with the line below
1355 # vec_power[ind] = power #D. Scipión replaced with the line below
1358 vec_power[ind] = total_power
1356 vec_power[ind] = total_power
General Comments 0
You need to be logged in to leave comments. Login now