Fix count active/sedentary bout bug
parent
bdcaf5a9c1
commit
7a32acdd45
|
@ -32,9 +32,6 @@ else:
|
||||||
#Sedentary Bout when you have less than 10 steps in a minute
|
#Sedentary Bout when you have less than 10 steps in a minute
|
||||||
#Active Bout when you have greater or equal to 10 steps in a minute
|
#Active Bout when you have greater or equal to 10 steps in a minute
|
||||||
resampledData['active_sedentary'] = np.where(resampledData['steps']<int(threshold_active_bout),'sedentary','active')
|
resampledData['active_sedentary'] = np.where(resampledData['steps']<int(threshold_active_bout),'sedentary','active')
|
||||||
|
|
||||||
activeData = resampledData[resampledData['active_sedentary']=="active"]
|
|
||||||
sedentaryData = resampledData[resampledData['active_sedentary']=="sedentary"]
|
|
||||||
|
|
||||||
#Time Calculations of sedentary/active bouts:
|
#Time Calculations of sedentary/active bouts:
|
||||||
resampledData['active_sedentary_groups'] = (resampledData.active_sedentary != resampledData.active_sedentary.shift()).cumsum().values
|
resampledData['active_sedentary_groups'] = (resampledData.active_sedentary != resampledData.active_sedentary.shift()).cumsum().values
|
||||||
|
@ -65,10 +62,10 @@ else:
|
||||||
finalDataset["step_" + str(day_segment) + "_stdallsteps"] = resampledData['steps'].resample('D').std()
|
finalDataset["step_" + str(day_segment) + "_stdallsteps"] = resampledData['steps'].resample('D').std()
|
||||||
|
|
||||||
if("countsedentarybout" in sedentary_bout):
|
if("countsedentarybout" in sedentary_bout):
|
||||||
finalDataset["step_" + str(day_segment) + "_countsedentarybout"] = sedentaryData['active_sedentary'].resample('D').count()
|
finalDataset["step_" + str(day_segment) + "_countsedentarybout"] = resampledData[resampledData["active_sedentary"] == "sedentary"]["active_sedentary_groups"].resample("D").nunique()
|
||||||
|
|
||||||
if("countactivebout" in active_bout):
|
if("countactivebout" in active_bout):
|
||||||
finalDataset["step_" + str(day_segment) + "_countactivebout"] = activeData['active_sedentary'].resample('D').count()
|
finalDataset["step_" + str(day_segment) + "_countactivebout"] = resampledData[resampledData["active_sedentary"] == "active"]["active_sedentary_groups"].resample("D").nunique()
|
||||||
|
|
||||||
if("maxdurationsedentarybout" in sedentary_bout):
|
if("maxdurationsedentarybout" in sedentary_bout):
|
||||||
finalDataset["step_" + str(day_segment) + "_maxdurationsedentarybout"] = statsMinutes[statsMinutes['active_sedentary']=='sedentary']['max']
|
finalDataset["step_" + str(day_segment) + "_maxdurationsedentarybout"] = statsMinutes[statsMinutes['active_sedentary']=='sedentary']['max']
|
||||||
|
|
Loading…
Reference in New Issue