當前位置: 首頁>>代碼示例>>Python>>正文


Python Session.getMetaDataOnly方法代碼示例

本文整理匯總了Python中Session.Session.getMetaDataOnly方法的典型用法代碼示例。如果您正苦於以下問題:Python Session.getMetaDataOnly方法的具體用法?Python Session.getMetaDataOnly怎麽用?Python Session.getMetaDataOnly使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Session.Session的用法示例。


在下文中一共展示了Session.getMetaDataOnly方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: getHeatMapSessions

# 需要導入模塊: from Session import Session [as 別名]
# 或者: from Session.Session import getMetaDataOnly [as 別名]
	def getHeatMapSessions(self,_json=True):
		_h = []
		_e = []
		_t = []
		_nSessions = 0 
		_x = 0
		for _folder in reversed(os.listdir(self._dataFolder)):
			for _device in self.devices:
				if _device in _folder: #get only the folders from his/her device
					_file = self._dataFolder + _folder 
					_d = Session(_file)
					_mdata = _d.getMetaDataOnly()
					_avgHR = _mdata["session"]["statistics"]["HR_avg"]
					_avgEDA = _mdata["session"]["statistics"]["EDA_avg"]
					_avgTEMP = _mdata["session"]["statistics"]["TEMP_avg"]
					_HM_HR= {}
					_HM_EDA= {}
					_HM_TEMP= {}
					if(_avgHR > 90):
						_HM_HR["sessionId"] = _folder 
						_HM_HR["date"] = int(_folder[:-7])
						_HM_HR["value"] = 60 + _x #silly hack to get links on the heatmap
					else:
						_HM_HR["sessionId"] = _folder 
						_HM_HR["date"] = int(_folder[:-7])
						_HM_HR["value"] = 2 + _x 
					print _HM_HR
					_h.append(_HM_HR)
					if(_avgEDA > 5):
						_HM_EDA["sessionId"] = _folder 
						_HM_EDA["date"] = int(_folder[:-7])
						_HM_EDA["value"] = 60 + _x 
					else:
						_HM_EDA["sessionId"] = _folder 
						_HM_EDA["date"] = int(_folder[:-7])
						_HM_EDA["value"] = 2+ _x 
					_e.append(_HM_EDA)
					if(_avgTEMP > 37.5):
						_HM_TEMP["sessionId"] = _folder 
						_HM_TEMP["date"] = int(_folder[:-7])
						_HM_TEMP["value"] = 60+ _x 
					else:
						_HM_TEMP["sessionId"] = _folder 
						_HM_TEMP["date"] = int(_folder[:-7])
						_HM_TEMP["value"] = 2+ _x 
					_t.append(_HM_TEMP)
					_x +=1

		if(_json):
			return [json.dumps(_h),json.dumps(_e),json.dumps(_t)]
		else:
			return [_HM_HR,_HM_EDA,_HM_TEMP]
開發者ID:panzerfausten,項目名稱:empatica_assigment_app,代碼行數:54,代碼來源:Data.py

示例2: getSessions

# 需要導入模塊: from Session import Session [as 別名]
# 或者: from Session.Session import getMetaDataOnly [as 別名]
	def getSessions(self,_json=True):
		_availableSessions = {"sessions":[],"count":0}
		_nSessions = 0 
		for _folder in reversed(os.listdir(self._dataFolder)):
			for _device in self.devices:
				if _device in _folder: #get only the folders from his/her device
					_file = self._dataFolder + _folder 
					_d = Session(_file)
					_availableSessions["sessions"].append(_d.getMetaDataOnly())
					_nSessions += 1
		_availableSessions["count"] = _nSessions

		if(_json):
			return json.dumps(_availableSessions)
		else:
			return _availableSessions
開發者ID:panzerfausten,項目名稱:empatica_assigment_app,代碼行數:18,代碼來源:Data.py


注:本文中的Session.Session.getMetaDataOnly方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。