本文整理汇总了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]
示例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