From 29f68a73892141074e86ca8b1f775d411baeb332 2018-07-31 19:06:22 From: Juan C. Espinoza Date: 2018-07-31 19:06:22 Subject: [PATCH] Review last commit --- diff --git a/schainpy/cli/cli.py b/schainpy/cli/cli.py index 5c0aa9b..4a42a70 100644 --- a/schainpy/cli/cli.py +++ b/schainpy/cli/cli.py @@ -70,9 +70,9 @@ PREFIX = 'experiment' @click.argument('command', default='run', required=True) @click.argument('nextcommand', default=None, required=False, type=str) def main(command, nextcommand, version): - """COMMAND LINE INTERFACE FOR SIGNAL CHAIN - JICAMARCA RADIO OBSERVATORY \n + """COMMAND LINE INTERFACE FOR SIGNAL CHAIN - JICAMARCA RADIO OBSERVATORY V3.0\n Available commands.\n - --xml: runs a schain XML generated file\n + xml: runs a schain XML generated file\n run: runs any python script starting 'experiment_'\n generate: generates a template schain script\n search: return avilable operations, procs or arguments of the give operation/proc\n""" @@ -153,16 +153,24 @@ def runschain(nextcommand): def basicInputs(): inputs = {} - inputs['desc'] = click.prompt( - 'Enter a description', default="A schain project", type=str) inputs['name'] = click.prompt( 'Name of the project', default="project", type=str) + inputs['desc'] = click.prompt( + 'Enter a description', default="A schain project", type=str) + inputs['multiprocess'] = click.prompt( + '''Select data type: + + - Voltage (*.r): [1] + - Spectra (*.pdata): [2] + - Voltage and Spectra (*.r): [3] + + -->''', type=int) inputs['path'] = click.prompt('Data path', default=os.getcwd( ), type=click.Path(exists=True, resolve_path=True)) inputs['startDate'] = click.prompt( 'Start date', default='1970/01/01', type=str) inputs['endDate'] = click.prompt( - 'End date', default='2017/12/31', type=str) + 'End date', default='2018/12/31', type=str) inputs['startHour'] = click.prompt( 'Start hour', default='00:00:00', type=str) inputs['endHour'] = click.prompt('End hour', default='23:59:59', type=str) @@ -172,13 +180,13 @@ def basicInputs(): def generate(): inputs = basicInputs() - inputs['multiprocess'] = click.confirm('Is this a multiprocess script?') - if inputs['multiprocess']: - inputs['nProcess'] = click.prompt( - 'How many process?', default=cpu_count(), type=int) - current = templates.multiprocess.format(**inputs) - else: - current = templates.basic.format(**inputs) + + if inputs['multiprocess'] == 1: + current = templates.voltage.format(**inputs) + elif inputs['multiprocess'] == 2: + current = templates.spectra.format(**inputs) + elif inputs['multiprocess'] == 3: + current = templates.voltagespectra.format(**inputs) scriptname = '{}_{}.py'.format(PREFIX, inputs['name']) script = open(scriptname, 'w') try: diff --git a/schainpy/cli/templates.py b/schainpy/cli/templates.py index 29ad580..a93fb19 100644 --- a/schainpy/cli/templates.py +++ b/schainpy/cli/templates.py @@ -1,38 +1,217 @@ -basic = '''from schainpy.controller import Project +voltage = '''import os, sys, time +from schainpy.controller import Project + + +def main(): + desc = "{desc}" + controller = Project() + controller.setup(id='200', name="{name}", description=desc) + + read_unit = controller.addReadUnit(datatype='Voltage', + path="{path}", + startDate="{startDate}", + endDate="{endDate}", + startTime="{startHour}", + endTime="{endHour}", + online=0, + verbose=1, + walk=0, + delay=180, + ) + + code = '[[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], [-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], [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], [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], [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], [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], [-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], [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], [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], [-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], [-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], [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], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1]]' + nCode = '128' + nBaud = '3' + + + proc_voltage = controller.addProcUnit(name='VoltageProc', inputId=read_unit.getId()) + + op1 = proc_voltage.addOperation(name='selectChannels', optype='self') + op1.addParameter(name='channelList', value='0, 1, 2, 3', format='intlist') + + op2 = proc_voltage.addOperation(name='filterByHeights', optype='self') + op2.addParameter(name='window', value='4', format='int') + + op3 = proc_voltage.addOperation(name='ProfileSelector', optype='other') + op3.addParameter(name='profileRangeList', value='32, 159', format='intList') + + op4 = proc_voltage.addOperation(name='Decoder', optype='other') + op4.addParameter(name='code', value=code, format='intlist') + op4.addParameter(name='nCode', value=nCode, format='int') + op4.addParameter(name='nBaud', value=nBaud, format='int') + op4.addParameter(name='mode', value='0', format='int') + + op5 = proc_voltage.addOperation(name='Scope', optype='external') + op5.addParameter(name='id', value='30', format='int') + + + + + + controller.start() + +if __name__ == '__main__': + import time + start_time = time.time() + main() + print("--- %s seconds ---" % (time.time() - start_time)) -desc = "{desc}" -project = Project() -project.setup(id='200', name="{name}", description=desc) - -voltage_reader = project.addReadUnit(datatype='VoltageReader', - path="{path}", - startDate="{startDate}", - endDate="{endDate}", - startTime="{startHour}", - endTime="{endHour}", - online=0, - verbose=1, - walk=1, - ) - -voltage_proc = project.addProcUnit(datatype='VoltageProc', inputId=voltage_reader.getId()) - -profile = voltage_proc.addOperation(name='ProfileSelector', optype='other') -profile.addParameter(name='profileRangeList', value='120,183', format='intlist') - -rti = voltage_proc.addOperation(name='RTIPlot', optype='other') -rti.addParameter(name='wintitle', value='Jicamarca Radio Observatory', format='str') -rti.addParameter(name='showprofile', value='0', format='int') -rti.addParameter(name='xmin', value='0', format='int') -rti.addParameter(name='xmax', value='24', format='int') -rti.addParameter(name='figpath', value="{figpath}", format='str') -rti.addParameter(name='wr_period', value='5', format='int') -rti.addParameter(name='exp_code', value='22', format='int') - - -project.start() ''' + +spectra = '''import os, sys, time +from schainpy.controller import Project + + +def main(): + desc = "{desc}" + controller = Project() + controller.setup(id='300', name="{name}", description=desc) + + read_unit = controller.addReadUnit(datatype='Spectra', + path="{path}", + startDate="{startDate}", + endDate="{endDate}", + startTime="{startHour}", + endTime="{endHour}", + online=0, + verbose=1, + walk=0, + delay=180, + ) + + proc_spectra = controller.addProcUnit(datatype='Spectra', inputId=read_unit.getId()) + proc_spectra.addParameter(name='nFFTPoints', value='128', format='int') + proc_spectra.addParameter(name='nProfiles', value='128', format='int') + proc_spectra.addParameter(name='pairsList', value='(0, 1), (2, 3)', format='pairslist') + + op1 = proc_spectra.addOperation(name='IncohInt', optype='other') + op1.addParameter(name='n', value='4', format='int') + + op2 = proc_spectra.addOperation(name='CrossSpectraPlot', optype='external') + op2.addParameter(name='id', value='10', format='int') + op2.addParameter(name='zmin', value='10.0', format='float') + op2.addParameter(name='zmax', value='35.0', format='float') + + + op3 = proc_spectra.addOperation(name='RTIPlot', optype='external') + op3.addParameter(name='id', value='20', format='int') + op3.addParameter(name='wintitle', value='RTI', format='str') + op3.addParameter(name='xmin', value='0', format='float') + op3.addParameter(name='xmax', value='24', format='float') + op3.addParameter(name='zmin', value='12', format='int') + op3.addParameter(name='zmax', value='32', format='int') + op3.addParameter(name='showprofile', value='1', format='int') + op3.addParameter(name='timerange', value=str(24*60*60), format='int') + + op4 = proc_spectra.addOperation(name='CoherenceMap', optype='external') + op4.addParameter(name='id', value='30', format='int') + op4.addParameter(name='xmin', value='0.0', format='float') + op4.addParameter(name='xmax', value='24.0', format='float') + + + controller.start() + +if __name__ == '__main__': + import time + start_time = time.time() + main() + print("--- %s seconds ---" % (time.time() - start_time)) + +''' + +voltagespectra = '''import os, sys, time +from schainpy.controller import Project + + +def main(): + desc = "{desc}" + controller = Project() + controller.setup(id='400', name="{name}", description=desc) + + read_unit = controller.addReadUnit(datatype='Voltage', + path="{path}", + startDate="{startDate}", + endDate="{endDate}", + startTime="{startHour}", + endTime="{endHour}", + online=0, + verbose=1, + walk=0, + delay=180, + ) + + code = '[[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], [-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], [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], [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], [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], [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], [-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], [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], [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], [-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], [-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], [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], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [1, 1, -1], [-1, -1, 1], [-1, -1, 1], [-1, -1, 1], [1, 1, -1]]' + nCode = '128' + nBaud = '3' + + + proc_voltage = controller.addProcUnit(name='VoltageProc', inputId=read_unit.getId()) + + op1 = proc_voltage.addOperation(name='selectChannels', optype='self') + op1.addParameter(name='channelList', value='0, 1, 2, 3', format='intlist') + + op2 = proc_voltage.addOperation(name='filterByHeights', optype='self') + op2.addParameter(name='window', value='4', format='int') + + op3 = proc_voltage.addOperation(name='ProfileSelector', optype='other') + op3.addParameter(name='profileRangeList', value='32, 159', format='intList') + + op4 = proc_voltage.addOperation(name='Decoder', optype='other') + op4.addParameter(name='code', value=code, format='intlist') + op4.addParameter(name='nCode', value=nCode, format='int') + op4.addParameter(name='nBaud', value=nBaud, format='int') + op4.addParameter(name='mode', value='0', format='int') + + + + proc_spectra = controller.addProcUnit(datatype='Spectra', inputId=proc_voltage.getId()) + proc_spectra.addParameter(name='nFFTPoints', value='128', format='int') + proc_spectra.addParameter(name='nProfiles', value='128', format='int') + proc_spectra.addParameter(name='pairsList', value='(0, 1), (2, 3)', format='pairslist') + + op5 = proc_spectra.addOperation(name='IncohInt', optype='other') + op5.addParameter(name='n', value='4', format='int') + + op6 = proc_spectra.addOperation(name='CrossSpectraPlot', optype='external') + op6.addParameter(name='id', value='10', format='int') + op6.addParameter(name='zmin', value='10.0', format='float') + op6.addParameter(name='zmax', value='35.0', format='float') + + + op7 = proc_spectra.addOperation(name='RTIPlot', optype='external') + op7.addParameter(name='id', value='20', format='int') + op7.addParameter(name='wintitle', value='RTI', format='str') + op7.addParameter(name='xmin', value='0', format='float') + op7.addParameter(name='xmax', value='24', format='float') + op7.addParameter(name='zmin', value='12', format='int') + op7.addParameter(name='zmax', value='32', format='int') + op7.addParameter(name='showprofile', value='1', format='int') + op7.addParameter(name='timerange', value=str(24*60*60), format='int') + + op8 = proc_spectra.addOperation(name='CoherenceMap', optype='external') + op8.addParameter(name='id', value='30', format='int') + op8.addParameter(name='xmin', value='0.0', format='float') + op8.addParameter(name='xmax', value='24.0', format='float') + + + controller.start() + +if __name__ == '__main__': + import time + start_time = time.time() + main() + print("--- %s seconds ---" % (time.time() - start_time)) + +''' + + + + + + + + multiprocess = '''from schainpy.controller import Project, MPProject from time import sleep desc = "{desc}" @@ -61,10 +240,10 @@ sleep(2) ################ # DATA EMITTER # ################ -project = Project() -project.setup(id='200', name="{name}", description=desc) +controller = Project() +controller.setup(id='200', name="{name}", description=desc) -spectra_reader = project.addReadUnit(datatype='SpectraReader', +spectra_reader = controller.addReadUnit(datatype='SpectraReader', path="{path}", startDate={startDate}, endDate={endDate}, @@ -75,16 +254,16 @@ spectra_reader = project.addReadUnit(datatype='SpectraReader', walk=1, ) -spectra_proc = project.addProcUnit(datatype='Spectra', inputId=spectra_reader.getId()) +spectra_proc = controller.addProcUnit(datatype='Spectra', inputId=spectra_reader.getId()) -parameters_proc = project.addProcUnit(datatype='ParametersProc', inputId=spectra_proc.getId()) +parameters_proc = controller.addProcUnit(datatype='ParametersProc', inputId=spectra_proc.getId()) moments = parameters_proc.addOperation(name='SpectralMoments', optype='other') publish = parameters_proc.addOperation(name='PublishData', optype='other') publish.addParameter(name='zeromq', value=1, format='int') publish.addParameter(name='verbose', value=0, format='bool') -MPProject(project, 16) +MPProject(controller, 16) ''' diff --git a/schainpy/controller.py b/schainpy/controller.py index a9371b2..8e39197 100644 --- a/schainpy/controller.py +++ b/schainpy/controller.py @@ -275,7 +275,7 @@ class ParameterConf(): parmElement.set('name', self.name) parmElement.set('value', self.value) parmElement.set('format', self.format) - + def readXml(self, parmElement): self.id = parmElement.get('id') @@ -289,7 +289,7 @@ class ParameterConf(): def printattr(self): - print('Parameter[%s]: name = %s, value = %s, format = %s' % (self.id, self.name, self.value, self.format)) + print('Parameter[%s]: name = %s, value = %s, format = %s, project_id = %s' % (self.id, self.name, self.value, self.format, self.project_id)) class OperationConf(): @@ -422,12 +422,13 @@ class OperationConf(): for parmConfObj in self.parmConfObjList: parmConfObj.makeXml(opElement) - def readXml(self, opElement): + def readXml(self, opElement, project_id): self.id = opElement.get('id') self.name = opElement.get('name') self.type = opElement.get('type') self.priority = opElement.get('priority') + self.project_id = str(project_id) #yong # Compatible with old signal chain version # Use of 'run' method instead 'init' @@ -453,11 +454,12 @@ class OperationConf(): def printattr(self): - print('%s[%s]: name = %s, type = %s, priority = %s' % (self.ELEMENTNAME, + print('%s[%s]: name = %s, type = %s, priority = %s, project_id = %s' % (self.ELEMENTNAME, self.id, self.name, self.type, - self.priority)) + self.priority, + self.project_id)) for parmConfObj in self.parmConfObjList: parmConfObj.printattr() @@ -465,7 +467,7 @@ class OperationConf(): def createObject(self): className = eval(self.name) - + if self.type == 'other': opObj = className() elif self.type == 'external': @@ -634,12 +636,13 @@ class ProcUnitConf(): for opConfObj in self.opConfObjList: opConfObj.makeXml(procUnitElement) - def readXml(self, upElement): + def readXml(self, upElement, project_id): self.id = upElement.get('id') self.name = upElement.get('name') self.datatype = upElement.get('datatype') self.inputId = upElement.get('inputId') + self.project_id = str(project_id) if self.ELEMENTNAME == 'ReadUnit': self.datatype = self.datatype.replace('Reader', '') @@ -656,16 +659,17 @@ class ProcUnitConf(): for opElement in opElementList: opConfObj = OperationConf() - opConfObj.readXml(opElement) + opConfObj.readXml(opElement, project_id) self.opConfObjList.append(opConfObj) def printattr(self): - print('%s[%s]: name = %s, datatype = %s, inputId = %s' % (self.ELEMENTNAME, + print('%s[%s]: name = %s, datatype = %s, inputId = %s, project_id = %s' % (self.ELEMENTNAME, self.id, self.name, self.datatype, - self.inputId)) + self.inputId, + self.project_id)) for opConfObj in self.opConfObjList: opConfObj.printattr() @@ -846,11 +850,12 @@ class ReadUnitConf(ProcUnitConf): return opObj - def readXml(self, upElement): + def readXml(self, upElement, project_id): self.id = upElement.get('id') self.name = upElement.get('name') self.datatype = upElement.get('datatype') + self.project_id = str(project_id) #yong if self.ELEMENTNAME == 'ReadUnit': self.datatype = self.datatype.replace('Reader', '') @@ -861,7 +866,7 @@ class ReadUnitConf(ProcUnitConf): for opElement in opElementList: opConfObj = OperationConf() - opConfObj.readXml(opElement) + opConfObj.readXml(opElement, project_id) self.opConfObjList.append(opConfObj) if opConfObj.name == 'run': @@ -1109,7 +1114,7 @@ class Project(Process): for readUnitElement in readUnitElementList: readUnitConfObj = ReadUnitConf() - readUnitConfObj.readXml(readUnitElement) + readUnitConfObj.readXml(readUnitElement, self.id) self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj procUnitElementList = self.projectElement.iter( @@ -1117,7 +1122,7 @@ class Project(Process): for procUnitElement in procUnitElementList: procUnitConfObj = ProcUnitConf() - procUnitConfObj.readXml(procUnitElement) + procUnitConfObj.readXml(procUnitElement, self.id) self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj self.filename = abs_file @@ -1126,9 +1131,10 @@ class Project(Process): def __str__(self): - print('Project[%s]: name = %s, description = %s' % (self.id, + print('Project[%s]: name = %s, description = %s, project_id = %s' % (self.id, self.name, - self.description)) + self.description, + self.project_id)) for procUnitConfObj in self.procUnitConfObjDict.values(): print(procUnitConfObj) diff --git a/schainpy/model/io/bltrIO_param.py b/schainpy/model/io/bltrIO_param.py index ba86596..b6b1dc3 100644 --- a/schainpy/model/io/bltrIO_param.py +++ b/schainpy/model/io/bltrIO_param.py @@ -91,9 +91,9 @@ class BLTRParamReader(JRODataReader, ProcessingUnit): ext = '.sswma' - def __init__(self, **kwargs): + def __init__(self): - ProcessingUnit.__init__(self, **kwargs) + ProcessingUnit.__init__(self) self.dataOut = Parameters() self.counter_records = 0 @@ -245,7 +245,7 @@ class BLTRParamReader(JRODataReader, ProcessingUnit): self.nranges = header_rec['nranges'][0] self.fp.seek(pointer) self.height = numpy.empty((self.nmodes, self.nranges)) - self.snr = numpy.empty((self.nmodes, self.nchannels, self.nranges)) + self.snr = numpy.empty((self.nmodes, int(self.nchannels), self.nranges)) self.buffer = numpy.empty((self.nmodes, 3, self.nranges)) self.flagDiscontinuousBlock = 0 @@ -267,9 +267,9 @@ class BLTRParamReader(JRODataReader, ProcessingUnit): header_structure = numpy.dtype( REC_HEADER_STRUCTURE.descr + [ - ('antenna_coord', 'f4', (2, self.nchannels)), - ('rx_gains', 'u4', (self.nchannels,)), - ('rx_analysis', 'u4', (self.nchannels,)) + ('antenna_coord', 'f4', (2, int(self.nchannels))), + ('rx_gains', 'u4', (int(self.nchannels),)), + ('rx_analysis', 'u4', (int(self.nchannels),)) ] ) @@ -295,6 +295,7 @@ class BLTRParamReader(JRODataReader, ProcessingUnit): status_value - Array data is set to NAN for values that are not equal to status_value ''' + self.nchannels = int(self.nchannels) data_structure = numpy.dtype( DATA_STRUCTURE.descr + [ @@ -364,4 +365,5 @@ class BLTRParamReader(JRODataReader, ProcessingUnit): self.set_output() - return 1 \ No newline at end of file + return 1 + \ No newline at end of file diff --git a/schainpy/model/proc/bltrproc_parameters.py b/schainpy/model/proc/bltrproc_parameters.py index fbc5f54..30fcc63 100644 --- a/schainpy/model/proc/bltrproc_parameters.py +++ b/schainpy/model/proc/bltrproc_parameters.py @@ -76,12 +76,13 @@ class BLTRParametersProc(ProcessingUnit): self.dataOut.data_param[i][SNRavgdB <= snr_threshold] = numpy.nan # TODO +@MPDecorator class OutliersFilter(Operation): - def __init__(self, **kwargs): + def __init__(self): ''' ''' - Operation.__init__(self, **kwargs) + Operation.__init__(self) def run(self, svalue2, method, factor, filter, npoints=9): ''' diff --git a/schainpy/model/proc/jroproc_spectra.py b/schainpy/model/proc/jroproc_spectra.py index 4a2435c..db71e0d 100644 --- a/schainpy/model/proc/jroproc_spectra.py +++ b/schainpy/model/proc/jroproc_spectra.py @@ -136,6 +136,8 @@ class SpectraProc(ProcessingUnit): if self.dataIn.type == "Voltage": + self.dataOut.flagNoData = True + if nFFTPoints == None: raise ValueError("This SpectraProc.run() need nFFTPoints input variable") @@ -942,8 +944,7 @@ class IncohInt(Operation): dataOut.data_spc = avgdata_spc dataOut.data_cspc = avgdata_cspc - dataOut.data_dc = avgdata_dc - + dataOut.data_dc = avgdata_dc dataOut.nIncohInt *= self.n dataOut.utctime = avgdatatime dataOut.flagNoData = False diff --git a/schainpy/model/proc/jroproc_voltage.py b/schainpy/model/proc/jroproc_voltage.py index 3757f25..3fea9a5 100644 --- a/schainpy/model/proc/jroproc_voltage.py +++ b/schainpy/model/proc/jroproc_voltage.py @@ -229,13 +229,13 @@ class VoltageProc(ProcessingUnit): """ Si la data es obtenida por bloques, dimension = [nChannels, nProfiles, nHeis] """ - buffer = self.dataOut.data[:, :, 0:self.dataOut.nHeights-r] + buffer = self.dataOut.data[:, :, 0:int(self.dataOut.nHeights-r)] buffer = buffer.reshape(self.dataOut.nChannels,self.dataOut.nProfiles,self.dataOut.nHeights/window,window) buffer = numpy.sum(buffer,3) else: - buffer = self.dataOut.data[:,0:self.dataOut.nHeights-r] - buffer = buffer.reshape(self.dataOut.nChannels,self.dataOut.nHeights/window,window) + buffer = self.dataOut.data[:,0:int(self.dataOut.nHeights-r)] + buffer = buffer.reshape(self.dataOut.nChannels,int(self.dataOut.nHeights/window),int(window)) buffer = numpy.sum(buffer,2) self.dataOut.data = buffer @@ -799,7 +799,6 @@ class ProfileConcat(Operation): self.start_index = self.start_index + self.nHeights def run(self, dataOut, m): - dataOut.flagNoData = True if not self.isConfig: @@ -908,7 +907,7 @@ class ProfileSelector(Operation): dataOut.profileIndex = dataOut.nProfiles - 1 dataOut.flagNoData = False - return True + return dataOut """ data dimension = [nChannels, nHeis] @@ -924,7 +923,7 @@ class ProfileSelector(Operation): dataOut.flagNoData = False self.incProfileIndex() - return True + return dataOut if profileRangeList != None: @@ -939,7 +938,7 @@ class ProfileSelector(Operation): dataOut.flagNoData = False self.incProfileIndex() - return True + return dataOut if rangeList != None: @@ -967,7 +966,7 @@ class ProfileSelector(Operation): break - return True + return dataOut if beam != None: #beam is only for AMISR data @@ -977,7 +976,7 @@ class ProfileSelector(Operation): self.incProfileIndex() - return True + return dataOut raise ValueError("ProfileSelector needs profileList, profileRangeList or rangeList parameter")