-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen_GG_plot.py
47 lines (33 loc) · 1.43 KB
/
gen_GG_plot.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
45
46
47
import matplotlib.pyplot as plt
import utils
import pandas as pd
#from gen_lineplot import gen_lineplot
#from get_start_stop import get_start_stop
def gen_GG_plot(file, file_path):
#start for loop here for each file
#pull the variables from the file
accel_X = file.get('SBG_Accel_X')
accel_Y = file.get('SBG_Accel_Y')
#get start and stop time from user
start, stop = utils.get_start_stop(accel_Y)
#reduce the data to the timestamps of interest
accel_X_sub = accel_X.cut(start, stop)
accel_Y_sub = accel_Y.cut(start, stop)
#Ask the user if they want to smooth the data
accel_X_smoothed, accel_Y_smoothed = utils.smooth([accel_X_sub, accel_Y_sub])
#Ask the user if they would like to include peak values
go_peak = input("Would you like to display the RAW min and max peak values? (y/n)\n")
if go_peak == 'y':
peak_dict = utils.get_peak(file, ['SBG_Accel_X', 'SBG_Accel_Y'], start, stop)
#create the GG plot
plot_GG(accel_X_smoothed, accel_Y_smoothed, file_path, start, stop)
return
def plot_GG (accel_X, accel_Y, file_path, start, stop):
plt.figure()
plt.scatter(accel_Y, accel_X, marker='o', color='b')
plt.xlabel('SBG_Accel_Y (m/s^2)')
plt.ylabel('SBG_Accel_X (m/s^2)')
plt.suptitle('GG Plot for file: ' + file_path)
plt.title('(timestamp: ' + str(start) + '-' + str(stop) + ')')
plt.show()
return