diff --git a/schainpy/model/io/jroIO_base.py b/schainpy/model/io/jroIO_base.py index 22595f5..0ba732d 100644 --- a/schainpy/model/io/jroIO_base.py +++ b/schainpy/model/io/jroIO_base.py @@ -344,6 +344,8 @@ class JRODataIO: blocksize = None + getblock = False + def __init__(self): raise ValueError, "Not implemented" @@ -934,7 +936,8 @@ class JRODataReader(JRODataIO): ext = None, online = False, delay = 60, - walk = True): + walk = True, + getblock = False): if path == None: raise ValueError, "The path is not valid" @@ -991,7 +994,7 @@ class JRODataReader(JRODataIO): self.delay = delay ext = ext.lower() self.ext = ext - + self.getblock = getblock if not(self.setNextFile()): if (startDate!=None) and (endDate!=None): print "No files in range: %s - %s" %(datetime.datetime.combine(startDate,startTime).ctime(), datetime.datetime.combine(endDate,endTime).ctime()) diff --git a/schainpy/model/io/jroIO_voltage.py b/schainpy/model/io/jroIO_voltage.py index 5d4a06c..3c6d273 100644 --- a/schainpy/model/io/jroIO_voltage.py +++ b/schainpy/model/io/jroIO_voltage.py @@ -309,13 +309,18 @@ class VoltageReader(JRODataReader, ProcessingUnit): self.dataOut.flagNoData = True return 0 - self.dataOut.data = self.datablock[:,self.profileIndex,:] + if self.getblock: + self.dataOut.data = self.datablock + self.profileIndex = self.processingHeaderObj.profilesPerBlock + else: + self.dataOut.data = self.datablock[:,self.profileIndex,:] + self.profileIndex += 1 self.dataOut.flagNoData = False self.getBasicHeader() - self.profileIndex += 1 + self.dataOut.realtime = self.online diff --git a/schainpy/model/proc/jroproc_spectra.py b/schainpy/model/proc/jroproc_spectra.py index fef9f4b..7ad0cdc 100644 --- a/schainpy/model/proc/jroproc_spectra.py +++ b/schainpy/model/proc/jroproc_spectra.py @@ -14,6 +14,8 @@ class SpectraProc(ProcessingUnit): self.firstdatatime = None self.profIndex = 0 self.dataOut = Spectra() + self.id_min = None + self.id_max = None def __updateObjFromInput(self): @@ -103,12 +105,9 @@ class SpectraProc(ProcessingUnit): if nFFTPoints == None: raise ValueError, "This SpectraProc.run() need nFFTPoints input variable" - nProfiles = nFFTPoints - -# if pairsList == None: -# nPairs = 0 -# else: -# nPairs = len(pairsList) + if nProfiles == None: + raise ValueError, "This SpectraProc.run() need nProfiles input variable" + if ippFactor == None: ippFactor = 1 @@ -116,17 +115,32 @@ class SpectraProc(ProcessingUnit): self.dataOut.nFFTPoints = nFFTPoints self.dataOut.pairsList = pairsList -# self.dataOut.nPairs = nPairs - + if self.buffer == None: self.buffer = numpy.zeros((self.dataIn.nChannels, nProfiles, self.dataIn.nHeights), - dtype='complex') + dtype='complex') + self.id_min = 0 + self.id_max = self.dataIn.data.shape[1] - - self.buffer[:,self.profIndex,:] = self.dataIn.data.copy() - self.profIndex += 1 + if len(self.dataIn.data.shape) == 2: + self.buffer[:,self.profIndex,:] = self.dataIn.data.copy() + self.profIndex += 1 + else: + if self.dataIn.data.shape[1] == nProfiles: + self.buffer = self.dataIn.data.copy() + self.profIndex = nProfiles + elif self.dataIn.data.shape[1] < nProfiles: + self.buffer[:,self.id_min:self.id_max,:] = self.dataIn.data + self.profIndex += self.dataIn.data.shape[1] + self.id_min += self.dataIn.data.shape[1] + self.id_max += self.dataIn.data.shape[1] + else: + raise ValueError, "The type object %s has %d profiles, it should be equal to %d profiles"%(self.dataIn.type,self.dataIn.data.shape[1],nProfiles) + self.dataOut.flagNoData = True + return 0 + if self.firstdatatime == None: self.firstdatatime = self.dataIn.utctime @@ -911,115 +925,3 @@ class IncohInt(Operation): #dataOut.timeInterval = dataOut.ippSeconds * dataOut.nCohInt * dataOut.nIncohInt * dataOut.nFFTPoints dataOut.timeInterval = self.__timeInterval*self.n dataOut.flagNoData = False - -class ProfileConcat(Operation): - - isConfig = False - buffer = None - - def __init__(self): - - Operation.__init__(self) - self.profileIndex = 0 - - def reset(self): - self.buffer = numpy.zeros_like(self.buffer) - self.start_index = 0 - self.times = 1 - - def setup(self, data, m, n=1): - self.buffer = numpy.zeros((data.shape[0],data.shape[1]*m),dtype=type(data[0,0])) - self.profiles = data.shape[1] - self.start_index = 0 - self.times = 1 - - def concat(self, data): - - self.buffer[:,self.start_index:self.profiles*self.times] = data.copy() - self.start_index = self.start_index + self.profiles - - def run(self, dataOut, m): - - dataOut.flagNoData = True - - if not self.isConfig: - self.setup(dataOut.data, m, 1) - self.isConfig = True - - self.concat(dataOut.data) - self.times += 1 - if self.times > m: - dataOut.data = self.buffer - self.reset() - dataOut.flagNoData = False - # se deben actualizar mas propiedades del header y del objeto dataOut, por ejemplo, las alturas - deltaHeight = dataOut.heightList[1] - dataOut.heightList[0] - xf = dataOut.heightList[0] + dataOut.nHeights * deltaHeight * 5 - dataOut.heightList = numpy.arange(dataOut.heightList[0], xf, deltaHeight) - -class ProfileSelector(Operation): - - profileIndex = None - # Tamanho total de los perfiles - nProfiles = None - - def __init__(self): - - Operation.__init__(self) - self.profileIndex = 0 - - def incIndex(self): - self.profileIndex += 1 - - if self.profileIndex >= self.nProfiles: - self.profileIndex = 0 - - def isProfileInRange(self, minIndex, maxIndex): - - if self.profileIndex < minIndex: - return False - - if self.profileIndex > maxIndex: - return False - - return True - - def isProfileInList(self, profileList): - - if self.profileIndex not in profileList: - return False - - return True - - def run(self, dataOut, profileList=None, profileRangeList=None, beam=None): - - dataOut.flagNoData = True - self.nProfiles = dataOut.nProfiles - - if profileList != None: - if self.isProfileInList(profileList): - dataOut.flagNoData = False - - self.incIndex() - return 1 - - - elif profileRangeList != None: - minIndex = profileRangeList[0] - maxIndex = profileRangeList[1] - if self.isProfileInRange(minIndex, maxIndex): - dataOut.flagNoData = False - - self.incIndex() - return 1 - elif beam != None: - if self.isProfileInList(dataOut.beamRangeDict[beam]): - dataOut.flagNoData = False - - self.incIndex() - return 1 - - else: - raise ValueError, "ProfileSelector needs profileList or profileRangeList" - - return 0 diff --git a/schainpy/model/proc/jroproc_voltage.py b/schainpy/model/proc/jroproc_voltage.py index f1a9a4f..4a27023 100644 --- a/schainpy/model/proc/jroproc_voltage.py +++ b/schainpy/model/proc/jroproc_voltage.py @@ -188,21 +188,33 @@ class VoltageProc(ProcessingUnit): return 1 - def filterByHeights(self, window): + def filterByHeights(self, window, axis=1): deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0] if window == None: window = (self.dataOut.radarControllerHeaderObj.txA/self.dataOut.radarControllerHeaderObj.nBaud) / deltaHeight newdelta = deltaHeight * window - r = self.dataOut.data.shape[1] % window - buffer = self.dataOut.data[:,0:self.dataOut.data.shape[1]-r] - buffer = buffer.reshape(self.dataOut.data.shape[0],self.dataOut.data.shape[1]/window,window) - buffer = numpy.sum(buffer,2) - self.dataOut.data = buffer + r = self.dataOut.data.shape[axis] % window + if axis == 1: + buffer = self.dataOut.data[:,0:self.dataOut.data.shape[axis]-r] + buffer = buffer.reshape(self.dataOut.data.shape[0],self.dataOut.data.shape[axis]/window,window) + buffer = numpy.sum(buffer,axis+1) + + elif axis == 2: + buffer = self.dataOut.data[:, :, 0:self.dataOut.data.shape[axis]-r] + buffer = buffer.reshape(self.dataOut.data.shape[0],self.dataOut.data.shape[1],self.dataOut.data.shape[axis]/window,window) + buffer = numpy.sum(buffer,axis+1) + + else: + raise ValueError, "axis value should be 1 or 2, the input value %d is not valid" % (axis) + + self.dataOut.data = buffer.copy() self.dataOut.heightList = numpy.arange(self.dataOut.heightList[0],newdelta*(self.dataOut.nHeights-r)/window,newdelta) self.dataOut.windowOfFilter = window - + + return 1 + def deFlip(self): self.dataOut.data *= self.flip self.flip *= -1. @@ -238,7 +250,7 @@ class CohInt(Operation): # self.isConfig = False - def setup(self, n=None, timeInterval=None, overlapping=False): + def setup(self, n=None, timeInterval=None, overlapping=False, byblock=False): """ Set the parameters of the integration class. @@ -254,7 +266,7 @@ class CohInt(Operation): self.__lastdatatime = 0 self.__buffer = None self.__dataReady = False - + self.byblock = byblock if n == None and timeInterval == None: raise ValueError, "n or timeInterval should be specified ..." @@ -392,14 +404,35 @@ class CohInt(Operation): self.__initime += deltatime return avgdata, avgdatatime - + + def integrateByBlock(self, dataOut): + times = int(dataOut.data.shape[1]/self.n) + avgdata = numpy.zeros((dataOut.nChannels, times, dataOut.nHeights), dtype=numpy.complex) + + id_min = 0 + id_max = self.n + + for i in range(times): + junk = dataOut.data[:,id_min:id_max,:] + avgdata[:,i,:] = junk.sum(axis=1) + id_min += self.n + id_max += self.n + + timeInterval = dataOut.ippSeconds*self.n + avgdatatime = (times - 1) * timeInterval + dataOut.utctime + self.__dataReady = True + return avgdata, avgdatatime + def run(self, dataOut, **kwargs): if not self.isConfig: self.setup(**kwargs) self.isConfig = True - - avgdata, avgdatatime = self.integrate(dataOut.data, dataOut.utctime) + + if self.byblock: + avgdata, avgdatatime = self.integrateByBlock(dataOut) + else: + avgdata, avgdatatime = self.integrate(dataOut.data, dataOut.utctime) # dataOut.timeInterval *= n dataOut.flagNoData = True @@ -421,12 +454,17 @@ class Decoder(Operation): nCode = None nBaud = None + def __init__(self): Operation.__init__(self) + + self.times = None + self.osamp = None + self.__setValues = False # self.isConfig = False - def setup(self, code, shape): + def setup(self, code, shape, times, osamp): self.__profIndex = 0 @@ -435,17 +473,34 @@ class Decoder(Operation): self.nCode = len(code) self.nBaud = len(code[0]) - self.__nChannels, self.__nHeis = shape + if times != None: + self.times = times - __codeBuffer = numpy.zeros((self.nCode, self.__nHeis), dtype=numpy.complex) + if ((osamp != None) and (osamp >1)): + self.osamp = osamp + self.code = numpy.repeat(code, repeats=self.osamp,axis=1) + self.nBaud = self.nBaud*self.osamp - __codeBuffer[:,0:self.nBaud] = self.code - - self.fft_code = numpy.conj(numpy.fft.fft(__codeBuffer, axis=1)) - - self.ndatadec = self.__nHeis - self.nBaud + 1 + if len(shape) == 2: + self.__nChannels, self.__nHeis = shape + + __codeBuffer = numpy.zeros((self.nCode, self.__nHeis), dtype=numpy.complex) + + __codeBuffer[:,0:self.nBaud] = self.code + + self.fft_code = numpy.conj(numpy.fft.fft(__codeBuffer, axis=1)) + + self.ndatadec = self.__nHeis - self.nBaud + 1 + + self.datadecTime = numpy.zeros((self.__nChannels, self.ndatadec), dtype=numpy.complex) + else: + self.__nChannels, self.__nProfiles, self.__nHeis = shape + + self.ndatadec = self.__nHeis - self.nBaud + 1 + + self.datadecTime = numpy.zeros((self.__nChannels, self.__nProfiles, self.ndatadec), dtype=numpy.complex) - self.datadecTime = numpy.zeros((self.__nChannels, self.ndatadec), dtype=numpy.complex) + def convolutionInFreq(self, data): @@ -480,12 +535,30 @@ class Decoder(Operation): return self.datadecTime - def run(self, dataOut, code=None, nCode=None, nBaud=None, mode = 0): + def convolutionByBlockInTime(self, data): + junk = numpy.lib.stride_tricks.as_strided(self.code, (self.times, self.code.size), (0, self.code.itemsize)) + junk = junk.flatten() + code_block = numpy.reshape(junk, (self.nCode*self.times,self.nBaud)) + + for i in range(self.__nChannels): + for j in range(self.__nProfiles): + self.datadecTime[i,j,:] = numpy.correlate(data[i,j,:], code_block[j,:], mode='valid') + + return self.datadecTime + + def run(self, dataOut, code=None, nCode=None, nBaud=None, mode = 0, times=None, osamp=None): if code == None: code = dataOut.code else: code = numpy.array(code).reshape(nCode,nBaud) + + + + if not self.isConfig: + + self.setup(code, dataOut.data.shape, times, osamp) + dataOut.code = code dataOut.nCode = nCode dataOut.nBaud = nBaud @@ -493,10 +566,6 @@ class Decoder(Operation): dataOut.radarControllerHeaderObj.nCode = nCode dataOut.radarControllerHeaderObj.nBaud = nBaud - - if not self.isConfig: - - self.setup(code, dataOut.data.shape) self.isConfig = True if mode == 0: @@ -507,6 +576,18 @@ class Decoder(Operation): if mode == 2: datadec = self.convolutionInFreqOpt(dataOut.data) + + if mode == 3: + datadec = self.convolutionByBlockInTime(dataOut.data) + + if not(self.__setValues): + dataOut.code = self.code + dataOut.nCode = self.nCode + dataOut.nBaud = self.nBaud + dataOut.radarControllerHeaderObj.code = self.code + dataOut.radarControllerHeaderObj.nCode = self.nCode + dataOut.radarControllerHeaderObj.nBaud = self.nBaud + self.__setValues = True dataOut.data = datadec @@ -522,3 +603,149 @@ class Decoder(Operation): return 1 # dataOut.flagDeflipData = True #asumo q la data no esta sin flip + + +class ProfileConcat(Operation): + + isConfig = False + buffer = None + + def __init__(self): + + Operation.__init__(self) + self.profileIndex = 0 + + def reset(self): + self.buffer = numpy.zeros_like(self.buffer) + self.start_index = 0 + self.times = 1 + + def setup(self, data, m, n=1): + self.buffer = numpy.zeros((data.shape[0],data.shape[1]*m),dtype=type(data[0,0])) + self.profiles = data.shape[1] + self.start_index = 0 + self.times = 1 + + def concat(self, data): + + self.buffer[:,self.start_index:self.profiles*self.times] = data.copy() + self.start_index = self.start_index + self.profiles + + def run(self, dataOut, m): + + dataOut.flagNoData = True + + if not self.isConfig: + self.setup(dataOut.data, m, 1) + self.isConfig = True + + self.concat(dataOut.data) + self.times += 1 + if self.times > m: + dataOut.data = self.buffer + self.reset() + dataOut.flagNoData = False + # se deben actualizar mas propiedades del header y del objeto dataOut, por ejemplo, las alturas + deltaHeight = dataOut.heightList[1] - dataOut.heightList[0] + xf = dataOut.heightList[0] + dataOut.nHeights * deltaHeight * 5 + dataOut.heightList = numpy.arange(dataOut.heightList[0], xf, deltaHeight) + +class ProfileSelector(Operation): + + profileIndex = None + # Tamanho total de los perfiles + nProfiles = None + + def __init__(self): + + Operation.__init__(self) + self.profileIndex = 0 + + def incIndex(self): + self.profileIndex += 1 + + if self.profileIndex >= self.nProfiles: + self.profileIndex = 0 + + def isProfileInRange(self, minIndex, maxIndex): + + if self.profileIndex < minIndex: + return False + + if self.profileIndex > maxIndex: + return False + + return True + + def isProfileInList(self, profileList): + + if self.profileIndex not in profileList: + return False + + return True + + def run(self, dataOut, profileList=None, profileRangeList=None, beam=None, byblock=False): + + dataOut.flagNoData = True + self.nProfiles = dataOut.nProfiles + + if byblock: + + if profileList != None: + dataOut.data = dataOut.data[:,profileList,:] + pass + else: + pmin = profileRangeList[0] + pmax = profileRangeList[1] + dataOut.data = dataOut.data[:,pmin:pmax+1,:] + dataOut.flagNoData = False + self.profileIndex = 0 + return 1 + + if profileList != None: + if self.isProfileInList(profileList): + dataOut.flagNoData = False + + self.incIndex() + return 1 + + + elif profileRangeList != None: + minIndex = profileRangeList[0] + maxIndex = profileRangeList[1] + if self.isProfileInRange(minIndex, maxIndex): + dataOut.flagNoData = False + + self.incIndex() + return 1 + elif beam != None: #beam is only for AMISR data + if self.isProfileInList(dataOut.beamRangeDict[beam]): + dataOut.flagNoData = False + + self.incIndex() + return 1 + + else: + raise ValueError, "ProfileSelector needs profileList or profileRangeList" + + return 0 + + + +class Reshaper(Operation): + def __init__(self): + Operation.__init__(self) + self.updateNewHeights = False + + def run(self, dataOut, shape): + shape_tuple = tuple(shape) + dataOut.data = numpy.reshape(dataOut.data, shape_tuple) + dataOut.flagNoData = False + + if not(self.updateNewHeights): + old_nheights = dataOut.nHeights + new_nheights = dataOut.data.shape[2] + factor = new_nheights / old_nheights + deltaHeight = dataOut.heightList[1] - dataOut.heightList[0] + xf = dataOut.heightList[0] + dataOut.nHeights * deltaHeight * factor + dataOut.heightList = numpy.arange(dataOut.heightList[0], xf, deltaHeight) \ No newline at end of file diff --git a/schainpy/test/mst_isr_eej_blocks.py b/schainpy/test/mst_isr_eej_blocks.py new file mode 100644 index 0000000..104bf7a --- /dev/null +++ b/schainpy/test/mst_isr_eej_blocks.py @@ -0,0 +1,217 @@ +import os, sys +import timeit + +path = os.path.split(os.getcwd())[0] +sys.path.append(path) + +from controller import * + +desc = "MST-ISR-EEJ Experiment Test" +filename = "mst_isr_eej_blocks.xml" + +controllerObj = Project() + +controllerObj.setup(id = '191', name='test01', description=desc) + +path='/remote/ewdrifts/RAW_EXP/EW_DRIFT_FARADAY/EW_Drift' + +path = '/media/administrator/New Volume/DATA/MST_ISR' + +path = '/home/administrator/Documents/mst_isr_eej' + +readUnitConfObj = controllerObj.addReadUnit(datatype='VoltageReader', + path=path, + startDate='2014/01/09', + endDate='2014/01/09', + startTime='00:00:00', + endTime='23:59:59', + online=0, + delay=10, + walk=0, + getblock=1) + +opObj11 = readUnitConfObj.addOperation(name='printNumberOfBlock') +# ################ EEJ #################################### +procUnitConfObjEEJ = controllerObj.addProcUnit(datatype='VoltageProc', inputId=readUnitConfObj.getId()) + +opObj11 = procUnitConfObjEEJ.addOperation(name='ProfileSelector', optype='other') +opObj11.addParameter(name='profileRangeList', value='120,183', format='intlist') +opObj11.addParameter(name='byblock', value='1', format='bool') + +opObj11 = procUnitConfObjEEJ.addOperation(name='Decoder', optype='other') +opObj11.addParameter(name='code', value='1,-1', format='floatlist') +opObj11.addParameter(name='nCode', value='2', format='int') +opObj11.addParameter(name='nBaud', value='1', format='int') +opObj11.addParameter(name='mode', value='3', format='int') +opObj11.addParameter(name='times', value='32', format='int') + +# opObj11 = procUnitConfObjEEJ.addOperation(name='CohInt', optype='other') +# opObj11.addParameter(name='n', value='2', format='int') + +procUnitConfObjEEJSpecta = controllerObj.addProcUnit(datatype='SpectraProc', inputId=procUnitConfObjEEJ.getId()) +procUnitConfObjEEJSpecta.addParameter(name='nFFTPoints', value='64', format='int') +procUnitConfObjEEJSpecta.addParameter(name='nProfiles', value='64', format='int') + +opObj11 = procUnitConfObjEEJSpecta.addOperation(name='IncohInt', optype='other') +#opObj11.addParameter(name='timeInterval', value='10', format='float') +opObj11.addParameter(name='n', value='36', format='float') + +opObj11 = procUnitConfObjEEJSpecta.addOperation(name='SpectraPlot', optype='other') +opObj11.addParameter(name='id', value='100', format='int') +opObj11.addParameter(name='wintitle', value='EEJ', format='str') +# opObj11.addParameter(name='zmin', value='20', format='int') +# opObj11.addParameter(name='zmax', value='60', format='int')# opObj11.addParameter(name='ftp', value='1', format='int') +# opObj11.addParameter(name='save', value='1', format='int') +# opObj11.addParameter(name='figpath', value='/home/operaciones/Pictures/MST-ISR', format='str') +# opObj11.addParameter(name='wr_period', value='15', format='int') +# opObj11.addParameter(name='ftp', value='1', format='int') +# opObj11.addParameter(name='server', value='jro-app.igp.gob.pe', format='str') +# opObj11.addParameter(name='folder', value='/home/wmaster/graficos', format='str') +# opObj11.addParameter(name='username', value='wmaster', format='str') +# opObj11.addParameter(name='password', value='mst2010vhf', format='str') +# opObj11.addParameter(name='ftp_wei', value='0', format='int') +# opObj11.addParameter(name='exp_code', value='22', format='int') +# opObj11.addParameter(name='sub_exp_code', value='0', format='int') +# opObj11.addParameter(name='plot_pos', value='0', format='int') + + +# opObj11 = procUnitConfObjEEJSpecta.addOperation(name='RTIPlot', optype='other') +# opObj11.addParameter(name='id', value='101', format='int') +# opObj11.addParameter(name='wintitle', value='EEJ', format='str') +# opObj11.addParameter(name='showprofile', value='0', format='int') +# opObj11.addParameter(name='xmin', value='0', format='int') +# opObj11.addParameter(name='xmax', value='24', format='int') +# opObj11.addParameter(name='save', value='1', format='int') +# opObj11.addParameter(name='figpath', value='/home/operaciones/Pictures/MST-ISR', format='str') +# opObj11.addParameter(name='wr_period', value='15', format='int') +# opObj11.addParameter(name='ftp', value='1', format='int') +# opObj11.addParameter(name='server', value='jro-app.igp.gob.pe', format='str') +# opObj11.addParameter(name='folder', value='/home/wmaster/graficos', format='str') +# opObj11.addParameter(name='username', value='wmaster', format='str') +# opObj11.addParameter(name='password', value='mst2010vhf', format='str') +# opObj11.addParameter(name='ftp_wei', value='0', format='int') +# opObj11.addParameter(name='exp_code', value='22', format='int') +# opObj11.addParameter(name='sub_exp_code', value='0', format='int') +# opObj11.addParameter(name='plot_pos', value='0', format='int') + +################ MST #################################### +procUnitConfObjMST = controllerObj.addProcUnit(datatype='VoltageProc', inputId=readUnitConfObj.getId()) + +opObj11 = procUnitConfObjMST.addOperation(name='ProfileSelector', optype='other') +profileIndex = '0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119' +#profileIndex = '0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19' +opObj11.addParameter(name='profileList', value=profileIndex, format='intlist') +opObj11.addParameter(name='byblock', value='1', format='bool') + +opObj11 = procUnitConfObjMST.addOperation(name='Decoder', optype='other') +opObj11.addParameter(name='mode',value='3',format='int') +opObj11.addParameter(name='times',value='10',format='int') + +opObj11 = procUnitConfObjMST.addOperation(name='CohInt', optype='other') +opObj11.addParameter(name='n', value='20', format='int') +opObj11.addParameter(name='byblock', value='1', format='bool') + +procUnitConfObjMSTSpectra = controllerObj.addProcUnit(datatype='SpectraProc', inputId=procUnitConfObjMST.getId()) +procUnitConfObjMSTSpectra.addParameter(name='nFFTPoints', value='64', format='int') +procUnitConfObjMSTSpectra.addParameter(name='nProfiles', value='64', format='int') + +opObj11 = procUnitConfObjMSTSpectra.addOperation(name='IncohInt', optype='other') +opObj11.addParameter(name='n', value='2', format='float') + +opObj11 = procUnitConfObjMSTSpectra.addOperation(name='SpectraPlot', optype='other') +opObj11.addParameter(name='id', value='200', format='int') +opObj11.addParameter(name='wintitle', value='MST', format='str') +# opObj11.addParameter(name='zmin', value='35', format='int') +# opObj11.addParameter(name='zmax', value='60', format='int') +# opObj11.addParameter(name='save', value='1', format='int') +# opObj11.addParameter(name='figpath', value='/home/operaciones/Pictures/MST-ISR', format='str') +# opObj11.addParameter(name='wr_period', value='5', format='int') +# opObj11.addParameter(name='ftp', value='1', format='int') +# opObj11.addParameter(name='server', value='jro-app.igp.gob.pe', format='str') +# opObj11.addParameter(name='folder', value='/home/wmaster/graficos', format='str') +# opObj11.addParameter(name='username', value='wmaster', format='str') +# opObj11.addParameter(name='password', value='mst2010vhf', format='str') +# opObj11.addParameter(name='ftp_wei', value='0', format='int') +# opObj11.addParameter(name='exp_code', value='19', format='int') +# opObj11.addParameter(name='sub_exp_code', value='0', format='int') +# opObj11.addParameter(name='plot_pos', value='0', format='int') +# +# opObj11 = procUnitConfObjMSTSpectra.addOperation(name='RTIPlot', optype='other') +# opObj11.addParameter(name='id', value='201', format='int') +# opObj11.addParameter(name='wintitle', value='MST', format='str') +# opObj11.addParameter(name='showprofile', value='0', format='int') +# opObj11.addParameter(name='xmin', value='0', format='int') +# opObj11.addParameter(name='xmax', value='24', format='int') +# opObj11.addParameter(name='zmin', value='35', format='int') +# opObj11.addParameter(name='zmax', value='60', format='int') +# opObj11.addParameter(name='save', value='1', format='int') +# opObj11.addParameter(name='figpath', value='/home/operaciones/Pictures/MST-ISR', format='str') +# opObj11.addParameter(name='wr_period', value='5', format='int') +# opObj11.addParameter(name='ftp', value='1', format='int') +# opObj11.addParameter(name='server', value='jro-app.igp.gob.pe', format='str') +# opObj11.addParameter(name='folder', value='/home/wmaster/graficos', format='str') +# opObj11.addParameter(name='username', value='wmaster', format='str') +# opObj11.addParameter(name='password', value='mst2010vhf', format='str') +# opObj11.addParameter(name='ftp_wei', value='0', format='int') +# opObj11.addParameter(name='exp_code', value='19', format='int') +# opObj11.addParameter(name='sub_exp_code', value='0', format='int') +# opObj11.addParameter(name='plot_pos', value='0', format='int') + +# ################ ISR #################################### +procUnitConfObjISR = controllerObj.addProcUnit(datatype='VoltageProc', inputId=readUnitConfObj.getId()) + +opObj11 = procUnitConfObjISR.addOperation(name='ProfileSelector', optype='other') +# profileIndex = '20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99' +# opObj11.addParameter(name='profileList', value=profileIndex, format='intlist') +opObj11.addParameter(name='profileRangeList', value='20,99', format='intlist') +opObj11.addParameter(name='byblock', value='1', format='bool') + +# opObj11 = procUnitConfObjISR.addOperation(name='ProfileConcat', optype='other') +# opObj11.addParameter(name='m', value='5', format='int') + +opObj11 = procUnitConfObjISR.addOperation(name='Reshaper', optype='other') #Esta Operacion opera sobre bloques y reemplaza el ProfileConcat que opera sobre perfiles +opObj11.addParameter(name='shape', value='4,16,6750', format='intlist') + +opObj11 = procUnitConfObjISR.addOperation(name='filterByHeights') +opObj11.addParameter(name='window', value='20', format='int') +opObj11.addParameter(name='axis', value='2', format='int') + +barker3x1 = '1,1,-1,-1,-1,1' +#barker3x5 = '1,1,1,1,1, 1,1,1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1' + +opObj11 = procUnitConfObjISR.addOperation(name='Decoder', optype='other') +opObj11.addParameter(name='code', value=barker3x1, format='floatlist') +opObj11.addParameter(name='nCode', value='2', format='int') +#opObj11.addParameter(name='nBaud', value='15', format='int') +opObj11.addParameter(name='nBaud', value='3', format='int') +opObj11.addParameter(name='mode', value='3', format='int') +opObj11.addParameter(name='times', value='8', format='int') +opObj11.addParameter(name='osamp', value='5', format='int') + + +procUnitConfObjISRSpectra = controllerObj.addProcUnit(datatype='SpectraProc', inputId=procUnitConfObjISR.getId()) +procUnitConfObjISRSpectra.addParameter(name='nFFTPoints', value='16', format='int') +procUnitConfObjISRSpectra.addParameter(name='nProfiles', value='16', format='int') + +opObj11 = procUnitConfObjISRSpectra.addOperation(name='IncohInt', optype='other') +opObj11.addParameter(name='n', value='36', format='float') + +opObj11 = procUnitConfObjISRSpectra.addOperation(name='SpectraPlot', optype='other') +opObj11.addParameter(name='id', value='300', format='int') +opObj11.addParameter(name='wintitle', value='ISR', format='str') +# opObj11.addParameter(name='save', value='1', format='bool') +# opObj11.addParameter(name='figpath', value='/home/administrator/Pictures/mst_isr_eej', format='str') + + +print "Escribiendo el archivo XML" +controllerObj.writeXml(filename) +print "Leyendo el archivo XML" +controllerObj.readXml(filename) + +controllerObj.createObjects() +controllerObj.connectObjects() + +#timeit.timeit('controllerObj.run()', number=2) + +controllerObj.run() +#print fib(5) \ No newline at end of file