@@ -20,14 +20,14 from Model.Spectra import Spectra | |||
|
20 | 20 | class Spectrum: |
|
21 | 21 | colorplotObj = None |
|
22 | 22 | |
|
23 |
def __init__(self, |
|
|
23 | def __init__(self, spectraObj, index): | |
|
24 | 24 | self.__isPlotConfig = False |
|
25 | 25 | self.__isPlotIni = False |
|
26 | 26 | self.__xrange = None |
|
27 | 27 | self.__yrange = None |
|
28 | 28 | self.nsubplots = 0 |
|
29 | 29 | self.indexPlot = index |
|
30 |
self.spectraObj = |
|
|
30 | self.spectraObj = spectraObj | |
|
31 | 31 | |
|
32 | 32 | def setup(self,indexPlot, nsubplots, winTitle='', colormap="br_green", showColorbar=False, showPowerProfile=False, XAxisAsTime=False): |
|
33 | 33 | """ |
@@ -137,8 +137,8 class Spectrum: | |||
|
137 | 137 | if xmax == None: xmax = x[-1] |
|
138 | 138 | if ymin == None: ymin = y[0] |
|
139 | 139 | if ymax == None: ymax = y[-1] |
|
140 |
if zmin == None: zmin = |
|
|
141 |
if zmax == None: zmax = |
|
|
140 | if zmin == None: zmin = datadB.min() | |
|
141 | if zmax == None: zmax = datadB.max() | |
|
142 | 142 | |
|
143 | 143 | self.createObjects(xmin,xmax,ymin,ymax,zmin,zmax,titleList,xlabelList,ylabelList) |
|
144 | 144 | self.__isPlotIni = True |
@@ -148,6 +148,10 class SpectraProcessor: | |||
|
148 | 148 | |
|
149 | 149 | def init(self): |
|
150 | 150 | |
|
151 | self.nHeights = self.dataInObj.nHeights | |
|
152 | self.dataOutObj.nHeights = self.nHeights | |
|
153 | self.dataOutObj.heightList = self.dataInObj.heightList | |
|
154 | ||
|
151 | 155 | self.integratorObjIndex = 0 |
|
152 | 156 | self.decoderObjIndex = 0 |
|
153 | 157 | self.writerObjIndex = 0 |
@@ -158,7 +162,7 class SpectraProcessor: | |||
|
158 | 162 | if self.buffer == None: |
|
159 | 163 | self.buffer = numpy.zeros((self.nChannels, |
|
160 | 164 | self.nFFTPoints, |
|
161 | self.nHeights), | |
|
165 | self.dataInObj.nHeights), | |
|
162 | 166 | dtype='complex') |
|
163 | 167 | |
|
164 | 168 | self.buffer[:,self.profIndex,:] = self.dataInObj.data |
@@ -246,7 +246,7 class VoltageProcessor: | |||
|
246 | 246 | |
|
247 | 247 | self.integratorObjIndex += 1 |
|
248 | 248 | |
|
249 |
def decoder(self,code=None, |
|
|
249 | def decoder(self,code=None, mode = 0): | |
|
250 | 250 | |
|
251 | 251 | if self.dataOutObj.flagNoData: |
|
252 | 252 | return 0 |
@@ -259,13 +259,12 class VoltageProcessor: | |||
|
259 | 259 | self.addDecoder(code,ncode,nbaud) |
|
260 | 260 | |
|
261 | 261 | myDecodObj = self.decoderObjList[self.decoderObjIndex] |
|
262 |
myDecodObj.exe(data=self.dataOutObj.data, |
|
|
262 | data, ndata = myDecodObj.exe(data=self.dataOutObj.data,mode=mode) | |
|
263 | 263 | |
|
264 | if myDecodObj.flag: | |
|
265 |
|
|
|
264 | self.dataOutObj.data = data | |
|
265 | self.dataOutObj.nHeights = ndata | |
|
266 | self.dataOutObj.heightList = self.dataInObj.heightList[:ndata] | |
|
266 | 267 |
|
|
267 | else: | |
|
268 | self.dataOutObj.flagNoData = True | |
|
269 | 268 | |
|
270 | 269 | self.decoderObjIndex += 1 |
|
271 | 270 | |
@@ -502,6 +501,7 class Decoder: | |||
|
502 | 501 | def __init__(self,code, ncode, nbaud): |
|
503 | 502 | |
|
504 | 503 | self.data = None |
|
504 | self.ndata = None | |
|
505 | 505 | self.profCounter = 1 |
|
506 | 506 | self.nCode = ncode |
|
507 | 507 | self.nBaud = nbaud |
@@ -509,16 +509,20 class Decoder: | |||
|
509 | 509 | self.code = code #this is a List |
|
510 | 510 | self.flag = False |
|
511 | 511 | |
|
512 |
def exe(self, data, ndata=None, |
|
|
512 | def exe(self, data, ndata=None, mode = 0): | |
|
513 | 513 | |
|
514 | 514 | if ndata == None: ndata = data.shape[1] |
|
515 | 515 | |
|
516 |
if |
|
|
516 | if mode == 0: | |
|
517 | 517 | self.convolutionInFreq(data,ndata) |
|
518 | 518 | |
|
519 |
if |
|
|
519 | if mode == 1: | |
|
520 | 520 | self.convolutionInTime(data, ndata) |
|
521 | 521 |
|
|
522 | self.ndata = ndata - self.nBaud + 1 | |
|
523 | ||
|
524 | return self.data, self.ndata | |
|
525 | ||
|
522 | 526 | def convolutionInFreq(self,data, ndata): |
|
523 | 527 | |
|
524 | 528 | newcode = numpy.zeros(ndata) |
@@ -535,7 +539,8 class Decoder: | |||
|
535 | 539 | |
|
536 | 540 | conv = fft_data*fft_code |
|
537 | 541 | |
|
538 |
|
|
|
542 | data = numpy.fft.ifft(conv,axis=1) | |
|
543 | self.data = data[:,:-self.nBaud+1] | |
|
539 | 544 | self.flag = True |
|
540 | 545 | |
|
541 | 546 | if self.profCounter == self.nCode: |
@@ -551,7 +556,7 class Decoder: | |||
|
551 | 556 | self.codeIndex += 1 |
|
552 | 557 | conv = data.copy() |
|
553 | 558 | for i in range(nchannel): |
|
554 |
conv[i,:] = numpy.correlate(data[i,:], newcode |
|
|
559 | conv[i,:] = numpy.correlate(data[i,:], newcode) | |
|
555 | 560 | |
|
556 | 561 | self.data = conv |
|
557 | 562 | self.flag = True |
@@ -585,9 +590,9 class CoherentIntegrator: | |||
|
585 | 590 | self.timeIntervalInSeconds = timeInterval * 60. #if (type(timeInterval)!=integer) -> change this line |
|
586 | 591 | |
|
587 | 592 | if ((timeInterval==None) and (N==None)): |
|
588 |
|
|
|
589 | sys.exit(0) | |
|
590 |
|
|
|
593 | raise ValueError, "N = None ; timeInterval = None" | |
|
594 | ||
|
595 | if timeInterval == None: | |
|
591 | 596 | self.timeFlag = False |
|
592 | 597 | else: |
|
593 | 598 | self.timeFlag = True |
General Comments 0
You need to be logged in to leave comments.
Login now