-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevents_analysis.py
44 lines (31 loc) · 1.01 KB
/
events_analysis.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 29 10:20:53 2023
@author: Sameer Bhatti
Conclusion: Really high times means they are off medication but really low
times does not necessarily mean they are on medication
"""
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
def read_csv(path_to_csv):
df = pd.read_csv(path_to_csv)
return df
def plot_times(dataframe):
times = list(dataframe['Completion'] - dataframe['Init'])
plt.figure()
plt.title(str(dataframe['Type'].values[0]))
plt.ylabel('Time (s)')
plt.xlabel('Occurrence')
plt.plot(np.linspace(1, len(times), len(times)), times)
plt.show()
if __name__ == "__main__":
input_file = '/Users/Documents/kaggle/parkinsons_fog/data/events.csv'
df = read_csv(input_file)
sh = df.loc[df['Type'] == 'StartHesitation']
w = df.loc[df['Type'] == 'Walking']
t = df.loc[df['Type'] == 'Turn']
plot_times(sh)
plot_times(w)
plot_times(t)