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