Esempio n. 1
0
	def __init__(self, dbfile, qstr):
		self.AnalysisDBFile=dbfile 
		# self.queryString=qstr 

		# Always export all columns except the RecIdx and TimeSeries. Ignore a user provided qstr for now.
		self.queryString = "select "+", ".join([ col[1] for col in rawQuery(self.AnalysisDBFile, "PRAGMA table_info(metadata);") ][1:-1])+" from metadata"

		self.responseDict={}
Esempio n. 2
0
    def __init__(self, dbfile, qstr):
        self.AnalysisDBFile = dbfile
        # self.queryString=qstr

        # Always export all columns except the RecIdx and TimeSeries. Ignore a user provided qstr for now.
        self.queryString = "select " + ", ".join([
            col[1] for col in rawQuery(self.AnalysisDBFile,
                                       "PRAGMA table_info(metadata);")
        ][1:-1]) + " from metadata"

        self.responseDict = {}
Esempio n. 3
0
def analysisLog():
	global gAnalysisSessions

	try:
		params = dict(request.get_json())
		
		sessionID=params['sessionID']
		dbfile=gAnalysisSessions.getSessionAttribute(sessionID, 'databaseFile')

		logstr=(rawQuery(dbfile, "select logstring from analysislog")[0][0]).replace(str(mosaic.WebServerDataLocation), "<Data Root>")

		return jsonify(respondingURL='analysis-log', logText=logstr), 200
	except (sessionManager.SessionNotFoundError, KeyError):
		return jsonify( respondingURL='analysis-statistics', errType='MissingSIDError', errSummary="A valid session ID was not found.", errText="A valid session ID was not found." ), 500
Esempio n. 4
0
	def _analysisProgress(self):
		try:
			self.analysisTime=list(rawQuery(self.analysisDB, "select analysisTimeSec from analysisinfo")[0])[0]
		except:
			if self.lastEventStartTimeSec > self.analysisTime:
				self.analysisTime=self.lastEventStartTimeSec

		try:
			pctcomplete=100.*self.analysisTime/float(self.trajLength)

			if pctcomplete<0.05:
				return round(pctcomplete, 1)
			elif pctcomplete>90:
				return int(round(pctcomplete/10.0)*10.0)
			else:
				return int(round(pctcomplete))
		except:
			return "n/a"
Esempio n. 5
0
    def _analysisProgress(self):
        try:
            self.analysisTime = list(
                rawQuery(self.analysisDB,
                         "select analysisTimeSec from analysisinfo")[0])[0]
        except:
            if self.lastEventStartTimeSec > self.analysisTime:
                self.analysisTime = self.lastEventStartTimeSec

        try:
            pctcomplete = 100. * self.analysisTime / float(self.trajLength)

            if pctcomplete < 0.05:
                return round(pctcomplete, 1)
            elif pctcomplete > 90:
                return int(round(pctcomplete / 10.0) * 10.0)
            else:
                return int(round(pctcomplete))
        except:
            return "n/a"
Esempio n. 6
0
	def _generateQueryString(self, eventNumber):
		# Generate the query string based on the algorithm in the database
		queryStringDict={
			"adept2State" 	: "select ProcessingStatus, TimeSeries, RCConstant1, RCConstant2, EventStart, EventEnd, BlockedCurrent, OpenChCurrent from metadata",
			"adept" 		: "select ProcessingStatus, TimeSeries, RCConstant, EventDelay, CurrentStep, OpenChCurrent from metadata",
			"cusumPlus" 	: "select ProcessingStatus, TimeSeries, EventDelay, CurrentStep, OpenChCurrent from metadata"
		}
		
		eventFilterCode={
			"normal"		: "normal",
			"warning"		: "w%",
			"error"			: "e%"
		}

		typeClause=" or ".join([ "ProcessingStatus like '{0}'".format(eventFilterCode[eventType]) for eventType in self.eventFilter ])

		self.recordCount=rawQuery(self.analysisDB, "select COUNT(recIDX) from metadata where "+typeClause)[0][0]

		qstr=queryStringDict[self.procAlgorithm]+ " where " + typeClause +" limit 1 offset {0}".format(eventNumber-1)

		return qstr
Esempio n. 7
0
def analysisLog():
    global gAnalysisSessions

    try:
        params = dict(request.get_json())

        sessionID = params['sessionID']
        dbfile = gAnalysisSessions.getSessionAttribute(sessionID,
                                                       'databaseFile')

        logstr = (rawQuery(dbfile,
                           "select logstring from analysislog")[0][0]).replace(
                               str(mosaic.WebServerDataLocation),
                               "<Data Root>")

        return jsonify(respondingURL='analysis-log', logText=logstr), 200
    except (sessionManager.SessionNotFoundError, KeyError):
        return jsonify(respondingURL='analysis-statistics',
                       errType='MissingSIDError',
                       errSummary="A valid session ID was not found.",
                       errText="A valid session ID was not found."), 500
Esempio n. 8
0
	def __init__(self, analysisDB, index, eventFilter):
		self.analysisDB = analysisDB
		self.eventFilter=eventFilter

		if len(eventFilter)==0:
			raise EmptyEventFilterError

		self.FsHz, self.procAlgorithm = rawQuery(self.analysisDB, "select FsHz, ProcessingAlgorithm from analysisinfo")[0]
		self.errTextObject=errors.errors()
		self.recordCount=0

		# setup hash tables and funcs used in this class
		self.qstr=self._generateQueryString(index)
		self._setupDict()
		self._setupFitFuncs()

		self.returnMessageJSON={
			"warning": "",
			"recordCount": self.recordCount,
			"eventNumber": index,
			"errorText": ""
		}