From c5cbd628ce0f2ee7806954f20446f679e69a1fd1 2017-08-28 17:23:31 From: José Chávez Date: 2017-08-28 17:23:31 Subject: [PATCH] merge from master --- diff --git a/.gitignore b/.gitignore index 622afa0..f9d380c 100644 --- a/.gitignore +++ b/.gitignore @@ -100,10 +100,19 @@ ENV/ # eclipse .project .pydevproject +<<<<<<< HEAD # vscode .vscode schainpy/scripts/ -schaingui/node_modules/ \ No newline at end of file +schaingui/node_modules/ +======= +.svn/ +*.png +*.pyc +schainpy/scripts + +schaingui/node_modules +>>>>>>> master diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..e976b89 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,69 @@ +{ + "configurations": [ + { + "name": "Mac", + "includePath": [ + "/usr/include", + "/usr/local/include", + "${workspaceRoot}" + ], + "defines": [], + "intelliSenseMode": "clang-x64", + "browse": { + "path": [ + "/usr/include", + "/usr/local/include", + "${workspaceRoot}" + ], + "limitSymbolsToIncludedHeaders": true, + "databaseFilename": "" + } + }, + { + "name": "Linux", + "includePath": [ + "/usr/include/c++/4.8.4", + "/usr/include/x86_64-linux-gnu/c++/4.8", + "/usr/local/include", + "/usr/include", + "/usr/include/x86_64-linux-gnu", + "${workspaceRoot}" + ], + "defines": [], + "intelliSenseMode": "clang-x64", + "browse": { + "path": [ + "/usr/include/c++/4.8.4", + "/usr/include/x86_64-linux-gnu/c++/4.8", + "/usr/local/include", + "/usr/include", + "/usr/include/x86_64-linux-gnu", + "${workspaceRoot}" + ], + "limitSymbolsToIncludedHeaders": true, + "databaseFilename": "" + } + }, + { + "name": "Win32", + "includePath": [ + "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include", + "${workspaceRoot}" + ], + "defines": [ + "_DEBUG", + "UNICODE" + ], + "intelliSenseMode": "msvc-x64", + "browse": { + "path": [ + "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/*", + "${workspaceRoot}" + ], + "limitSymbolsToIncludedHeaders": true, + "databaseFilename": "" + } + } + ], + "version": 2 +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7d5f7a9 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "files.associations": { + "arrayobject.h": "c", + "ndarrayobject.h": "c", + "complex": "c" + } +} \ No newline at end of file diff --git a/README.md b/README.md index b8960ef..5704c9f 100644 --- a/README.md +++ b/README.md @@ -129,4 +129,4 @@ op.addParameter(name='wintitle', value='RTI', format='str') controller.start() -``` +``` \ No newline at end of file diff --git a/schainpy/controller.py b/schainpy/controller.py index 1493858..d295720 100644 --- a/schainpy/controller.py +++ b/schainpy/controller.py @@ -333,10 +333,10 @@ class OperationConf(): def getParameterValue(self, parameterName): parameterObj = self.getParameterObj(parameterName) - + # if not parameterObj: - # return None - + # return None + value = parameterObj.getValue() return value @@ -654,11 +654,11 @@ class ProcUnitConf(): def printattr(self): print "%s[%s]: name = %s, datatype = %s, inputId = %s" %(self.ELEMENTNAME, - self.id, - self.name, - self.datatype, - self.inputId) - + self.id, + self.name, + self.datatype, + self.inputId) + for opConfObj in self.opConfObjList: opConfObj.printattr() @@ -714,13 +714,13 @@ class ProcUnitConf(): sts = self.procUnitObj.call(opType = opConfObj.type, opName = opConfObj.name, opId = opConfObj.id, - ) - - # total_time = time.time() - ini - # - # if total_time > 0.002: - # print "%s::%s took %f seconds" %(self.name, opConfObj.name, total_time) - + **kwargs) + + # total_time = time.time() - ini + # + # if total_time > 0.002: + # print "%s::%s took %f seconds" %(self.name, opConfObj.name, total_time) + is_ok = is_ok or sts return is_ok @@ -866,18 +866,18 @@ class ReadUnitConf(ProcUnitConf): opObj.addParameter(name=key, value=value, format=type(value).__name__) return opObj - + # def makeXml(self, projectElement): - # + # # procUnitElement = SubElement(projectElement, self.ELEMENTNAME) # procUnitElement.set('id', str(self.id)) # procUnitElement.set('name', self.name) # procUnitElement.set('datatype', self.datatype) # procUnitElement.set('inputId', str(self.inputId)) - # + # # for opConfObj in self.opConfObjList: # opConfObj.makeXml(procUnitElement) - + def readXml(self, upElement): self.id = upElement.get('id') @@ -1119,8 +1119,8 @@ class Project(): self.id = self.projectElement.get('id') self.name = self.projectElement.get('name') - self.description = self.projectElement.get('description') - + self.description = self.projectElement.get('description') + readUnitElementList = self.projectElement.iter(ReadUnitConf().getElementName()) for readUnitElement in readUnitElementList: @@ -1150,8 +1150,8 @@ class Project(): def printattr(self): print "Project[%s]: name = %s, description = %s" %(self.id, - self.name, - self.description) + self.name, + self.description) for procUnitConfObj in self.procUnitConfObjDict.values(): procUnitConfObj.printattr() @@ -1188,9 +1188,9 @@ class Project(): import socket err = traceback.format_exception(sys.exc_info()[0], - sys.exc_info()[1], - sys.exc_info()[2]) - + sys.exc_info()[1], + sys.exc_info()[2]) + print "***** Error occurred in %s *****" %(procUnitConfObj.name) print "***** %s" %err[-1] @@ -1221,10 +1221,10 @@ class Project(): adminObj = schainpy.admin.SchainNotify() adminObj.sendAlert(message=message, - subject=subject, - subtitle=subtitle, - filename=self.filename) - + subject=subject, + subtitle=subtitle, + filename=self.filename) + def isPaused(self): return 0 diff --git a/schainpy/controller_api.py b/schainpy/controller_api.py index d8d87b9..2d1775e 100644 --- a/schainpy/controller_api.py +++ b/schainpy/controller_api.py @@ -14,8 +14,8 @@ class ControllerThread(threading.Thread, Project): self.setDaemon(True) self.lock = threading.Lock() - self.control = {'stop':False, 'pause':False} - + self.control = { 'stop':False, 'pause':False } + def __del__(self): self.control['stop'] = True @@ -90,7 +90,7 @@ class ControllerThread(threading.Thread, Project): continue if thisOpObj.name in plotterList: - thisOpObj.type = "plotter" + thisOpObj.type = "other" def setPlotterQueue(self, plotter_queue): diff --git a/schainpy/model/graphics/jroplotter.py b/schainpy/model/graphics/jroplotter.py index 1a632b0..118ca9b 100644 --- a/schainpy/model/graphics/jroplotter.py +++ b/schainpy/model/graphics/jroplotter.py @@ -124,7 +124,7 @@ class PlotManager(): subtitle = "%s:\n" %(name) subtitle += "Hostname: %s\n" %socket.gethostbyname(socket.gethostname()) subtitle += "Working directory: %s\n" %os.path.abspath("./") -# subtitle += "Configuration file: %s\n" %self.filename + # subtitle += "Configuration file: %s\n" %self.filename subtitle += "Time: %s\n" %str(datetime.datetime.now()) adminObj = schainpy.admin.SchainNotify() diff --git a/schainpy/model/io/jroIO_base.py b/schainpy/model/io/jroIO_base.py index 24f94aa..2b4315b 100644 --- a/schainpy/model/io/jroIO_base.py +++ b/schainpy/model/io/jroIO_base.py @@ -625,7 +625,7 @@ class JRODataReader(JRODataIO): dateList, pathList = self.findDatafiles(path, startDate, endDate, expLabel, ext, walk, include_path=True) if dateList == []: -# print "[Reading] Date range selected invalid [%s - %s]: No *%s files in %s)" %(startDate, endDate, ext, path) + # print "[Reading] Date range selected invalid [%s - %s]: No *%s files in %s)" %(startDate, endDate, ext, path) return None, None if len(dateList) > 1: @@ -637,8 +637,8 @@ class JRODataReader(JRODataIO): datetimeList = [] for thisPath in pathList: -# thisPath = pathList[pathDict[file]] - + # thisPath = pathList[pathDict[file]] + fileList = glob.glob1(thisPath, "*%s" %ext) fileList.sort() @@ -767,7 +767,7 @@ class JRODataReader(JRODataIO): idFile += 1 if not(idFile < len(self.filenameList)): self.flagNoMoreFiles = 1 -# print "[Reading] No more Files" + # print "[Reading] No more Files" return 0 filename = self.filenameList[idFile] @@ -785,7 +785,7 @@ class JRODataReader(JRODataIO): self.fileSize = fileSize self.fp = fp -# print "[Reading] Setting the file: %s"%self.filename + # print "[Reading] Setting the file: %s"%self.filename return 1 @@ -868,14 +868,14 @@ class JRODataReader(JRODataIO): if self.fp != None: self.fp.close() self.fp = open(fullfilename, 'rb') self.flagNoMoreFiles = 0 -# print '[Reading] Setting the file: %s' % fullfilename + # print '[Reading] Setting the file: %s' % fullfilename else: self.fileSize = 0 self.filename = None self.flagIsNewFile = 0 self.fp = None self.flagNoMoreFiles = 1 -# print '[Reading] No more files to read' + # print '[Reading] No more files to read' return fileOk_flag @@ -929,7 +929,7 @@ class JRODataReader(JRODataIO): return 1 if self.fileSize == self.fileSizeByHeader: -# self.flagEoF = True + # self.flagEoF = True return 0 print "[Reading] Waiting %0.2f seconds for the next block, try %03d ..." % (self.delay, nTries+1) @@ -983,13 +983,13 @@ class JRODataReader(JRODataIO): else: self.fp.seek(self.fp.tell() - neededsize) break - -# csize = self.fileSize - self.fp.tell() -# neededsize = self.processingHeaderObj.blockSize + self.basicHeaderSize -# factor = int(csize/neededsize) -# if factor > 0: -# self.fp.seek(self.fp.tell() + factor*neededsize) - + + # csize = self.fileSize - self.fp.tell() + # neededsize = self.processingHeaderObj.blockSize + self.basicHeaderSize + # factor = int(csize/neededsize) + # if factor > 0: + # self.fp.seek(self.fp.tell() + factor*neededsize) + self.flagIsNewFile = 0 self.__isFirstTimeOnline = 0 @@ -997,10 +997,10 @@ class JRODataReader(JRODataIO): #if self.server is None: if self.fp == None: return 0 - -# if self.online: -# self.__jumpToLastBlock() - + + # if self.online: + # self.__jumpToLastBlock() + if self.flagIsNewFile: self.lastUTTime = self.basicHeaderObj.utc return 1 @@ -1063,8 +1063,8 @@ class JRODataReader(JRODataIO): if self.verbose: print "[Reading] Block No. %d/%d -> %s" %(self.nReadBlocks, - self.processingHeaderObj.dataBlocksPerFile, - self.dataOut.datatime.ctime()) + self.processingHeaderObj.dataBlocksPerFile, + self.dataOut.datatime.ctime()) return 1 def __readFirstHeader(self): @@ -1095,8 +1095,8 @@ class JRODataReader(JRODataIO): self.dtype = datatype_str #self.ippSeconds = 2 * 1000 * self.radarControllerHeaderObj.ipp / self.c self.fileSizeByHeader = self.processingHeaderObj.dataBlocksPerFile * self.processingHeaderObj.blockSize + self.firstHeaderSize + self.basicHeaderSize*(self.processingHeaderObj.dataBlocksPerFile - 1) -# self.dataOut.channelList = numpy.arange(self.systemHeaderObj.numChannels) -# self.dataOut.channelIndexList = numpy.arange(self.systemHeaderObj.numChannels) + # self.dataOut.channelList = numpy.arange(self.systemHeaderObj.numChannels) + # self.dataOut.channelIndexList = numpy.arange(self.systemHeaderObj.numChannels) self.getBlockDimension() def __verifyFile(self, filename, msgFlag=True): @@ -1329,11 +1329,11 @@ class JRODataReader(JRODataIO): skip=skip, queue=queue) if not(pathList): - # print "[Reading] No *%s files in %s (%s - %s)"%(ext, path, - # datetime.datetime.combine(startDate,startTime).ctime(), - # datetime.datetime.combine(endDate,endTime).ctime()) + # print "[Reading] No *%s files in %s (%s - %s)"%(ext, path, + # datetime.datetime.combine(startDate,startTime).ctime(), + # datetime.datetime.combine(endDate,endTime).ctime()) - # sys.exit(-1) + # sys.exit(-1) self.fileIndex = -1 self.pathList = [] @@ -1378,10 +1378,10 @@ class JRODataReader(JRODataIO): self.filenameList = [] return - # self.getBasicHeader() + # self.getBasicHeader() - if last_set != None: - self.dataOut.last_block = last_set * self.processingHeaderObj.dataBlocksPerFile + self.basicHeaderObj.dataBlock + if last_set != None: + self.dataOut.last_block = last_set * self.processingHeaderObj.dataBlocksPerFile + self.basicHeaderObj.dataBlock return def getBasicHeader(self): diff --git a/schainpy/model/utils/jroutils_ftp.py b/schainpy/model/utils/jroutils_ftp.py index 0aa361f..87ab15b 100644 --- a/schainpy/model/utils/jroutils_ftp.py +++ b/schainpy/model/utils/jroutils_ftp.py @@ -638,18 +638,20 @@ class SendToServer(ProcessingUnit): return fullfilenameList def run(self, **kwargs): - if not self.isConfig: self.init = time.time() self.setup(**kwargs) self.isConfig = True - + + if not self.clientObj.is_alive(): + print "[Remote Server]: Restarting connection " + self.setup(**kwargs) + if time.time() - self.init >= self.period: fullfilenameList = self.findFiles() if self.clientObj.updateFileList(fullfilenameList): print "[Remote Server]: Sending the next files ", str(fullfilenameList) - self.init = time.time() def close(self): diff --git a/schainpy/scripts/optimun_offset.py b/schainpy/scripts/optimun_offset.py index 4ce8f4c..fa6e660 100644 --- a/schainpy/scripts/optimun_offset.py +++ b/schainpy/scripts/optimun_offset.py @@ -93,7 +93,11 @@ def filterOffsets(offsets0, stdvLimit): #---------------------- Setup --------------------------- +<<<<<<< HEAD path = '/home/nanosat/Pictures/JASMET30_mp/201608/phase' +======= +path = '/home/jespinoza/Pictures/JASMET30/201608/phase' +>>>>>>> master stdvLimit = 0.5 #---------------------- Script ---------------------------