"kneePain", "foreheadAndEyesPain", "handsAndFingerPain", "aroundEyesPain", "shoulderNeckPain", "sick_tired", "painInOtherRegion" ]].max(axis=1) # Filling the "generalmood" column for time before Participant1 started recording it data.loc[data.index < "2016-11-07", "generalmood"] = np.mean( data.loc[data.index >= "2016-11-07"]["generalmood"].tolist()) # Adjusting WhatPulse for missing data (0 values) period1 = ("2015-12-26", "2020-12-29") #("2015-12-26", "2020-02-01") data["whatPulseT_corrected"] = data["whatPulseT"] [data, reg] = check_if_zero_then_adjust_var_and_place_in_data( period1, data, "manicTimeDelta", "whatPulseT", "whatPulseT_corrected") # Selecting the time interval to look at the data data = subset_period(data, "2016-01-05", "2020-12-29") # Plotting results fig, axes = plt.subplots(nrows=6, ncols=1) # Number of clicks made on computer (both clicks and key presses) scaler = MinMaxScaler() column_list = ["whatPulseT", "whatPulseT_corrected"] data[column_list] = scaler.fit_transform(data[column_list]) data[column_list].plot(ax=axes[0]) axes[0].legend(loc='center left', bbox_to_anchor=(1, 0.5)) # Physical activities related to forearm and Elbow pain scaler = MinMaxScaler() column_list = ["surfing", "climbing", "viaFerrata", "swimming"] data[column_list] = scaler.fit_transform(data[column_list]) data[column_list].plot(ax=axes[1]) axes[1].legend(loc='center left', bbox_to_anchor=(1, 0.5))
# Transforming pain scale data["kneePain"] = transformPain(data["kneePain"]) data["handsAndFingerPain"] = transformPain(data["handsAndFingerPain"]) data["foreheadAndEyesPain"] = transformPain(data["foreheadAndEyesPain"]) data["forearmElbowPain"] = transformPain(data["forearmElbowPain"]) data["aroundEyesPain"] = transformPain(data["aroundEyesPain"]) data["shoulderNeckPain"] = transformPain(data["shoulderNeckPain"]) data["sick_tired"] = transformPain(data["sick_tired"]) data["painInOtherRegion"] = transformPain(data["painInOtherRegion"]) data["maxPainOtherThanKnee"] = data[[ "handsAndFingerPain", "foreheadAndEyesPain", "forearmElbowPain", "aroundEyesPain", "shoulderNeckPain", "sick_tired", "painInOtherRegion" ]].max(axis=1) # Selecting the time interval to look at the data data = subset_period(data, "2016-01-05", "2022-03-26") # Plotting results fig, axes = plt.subplots(nrows=6, ncols=1) # Steps scaler = MinMaxScaler() column_list = [ "fitbitDistance", "movesSteps", "googlefitSteps", "basisPeakSteps", "tracker_mean_distance" ] data[column_list] = scaler.fit_transform(data[column_list]) data[column_list].plot(ax=axes[0]) axes[0].legend(loc='center left', bbox_to_anchor=(1, 0.5)) # Cumulated elevation gain scaler = MinMaxScaler() column_list = [
import sys sys.path.insert(1, '../src/MyAIGuide/utilities') import pickle import matplotlib.pyplot as plt import numpy as np import pandas as pd from dataFrameUtilities import insert_rolling_mean_columns, subset_period input = open("../data/preprocessed/preprocessedDataParticipant1.txt", "rb") data = pickle.load(input) input.close() timeSelected = subset_period(data, "2016-09-01", "2019-10-20") # pain = selectColumns(timeSelected, ["kneePain"]) pain = insert_rolling_mean_columns(timeSelected, ["kneePain"], 21) env = insert_rolling_mean_columns(timeSelected, ["steps", "denivelation"], 21) # envRollingMean = selectColumns(env, ["stepsRollingMean", "denivelationRollingMean"]) # envBrut = selectColumns(env, ["steps", "denivelation"]) fig, axes = plt.subplots(nrows=3, ncols=1) pain["kneePain"].plot(ax=axes[0]) env[["steps", "denivelation"]].plot(ax=axes[1]) # envRollingMean.plot(ax=axes[2]) leg = plt.legend(loc="best")