forked from Prattbuw/Treadmill_Paper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilter.py
More file actions
97 lines (71 loc) · 4.21 KB
/
filter.py
File metadata and controls
97 lines (71 loc) · 4.21 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import numpy as np
def filter(step_time_store, step_amp_store, frame_idx, h_vel):
control_step_amp_store = []
control_step_amp_bin_one_store = []
control_step_amp_bin_two_store = []
control_step_amp_bin_three_store = []
control_step_amp_bin_four_store = []
control_step_amp_bin_five_store = []
stim_step_amp_store = []
stim_step_amp_bin_one_store = []
stim_step_amp_bin_two_store = []
stim_step_amp_bin_three_store = []
stim_step_amp_bin_four_store = []
stim_step_amp_bin_five_store = []
for leg in range(0, len(step_time_store)):
control_step_amp= []
control_step_amp_bin_one = []
control_step_amp_bin_two = []
control_step_amp_bin_three = []
control_step_amp_bin_four = []
control_step_amp_bin_five = []
stim_step_amp = []
stim_step_amp_bin_one = []
stim_step_amp_bin_two = []
stim_step_amp_bin_three = []
stim_step_amp_bin_four = []
stim_step_amp_bin_five = []
for step in range(0,len(step_time_store[leg])):
idx = step_time_store[leg][step]
if frame_idx[idx]<=750:
control_step_amp.append(step_amp_store[leg][step])
if h_vel[idx]<=3:
control_step_amp_bin_one.append(step_amp_store[leg][step])
elif h_vel[idx]>=4 and h_vel[idx]<=10:
control_step_amp_bin_two.append(step_amp_store[leg][step])
elif h_vel[idx]>=11 and h_vel[idx]<=20:
control_step_amp_bin_three.append(step_amp_store[leg][step])
elif h_vel[idx]>=21 and h_vel[idx]<=30:
control_step_amp_bin_three.append(step_amp_store[leg][step])
elif h_vel[idx]>=31 and h_vel[idx]<=40:
control_step_amp_bin_four.append(step_amp_store[leg][step])
elif h_vel[idx]>= 41:
control_step_amp_bin_five.append(step_amp_store[leg][step])
elif frame_idx[idx]>=751:
stim_step_amp.append(step_amp_store[leg][step])
if h_vel[idx]<=3:
stim_step_amp_bin_one.append(step_amp_store[leg][step])
elif h_vel[idx]>=4 and h_vel[idx]<=10:
stim_step_amp_bin_two.append(step_amp_store[leg][step])
elif h_vel[idx]>=11 and h_vel[idx]<=20:
stim_step_amp_bin_three.append(step_amp_store[leg][step])
elif h_vel[idx]>=21 and h_vel[idx]<=30:
stim_step_amp_bin_three.append(step_amp_store[leg][step])
elif h_vel[idx]>=31 and h_vel[idx]<=40:
stim_step_amp_bin_four.append(step_amp_store[leg][step])
elif h_vel[idx]>= 41:
stim_step_amp_bin_five.append(step_amp_store[leg][step])
control_step_amp_store.append(np.array(control_step_amp))
control_step_amp_bin_one_store.append(np.array(control_step_amp_bin_one))
control_step_amp_bin_two_store.append(np.array(control_step_amp_bin_two))
control_step_amp_bin_three_store.append(np.array(control_step_amp_bin_three))
control_step_amp_bin_four_store.append(np.array(control_step_amp_bin_four))
control_step_amp_bin_five_store.append(np.array(control_step_amp_bin_five))
stim_step_amp_store.append(np.array(stim_step_amp))
stim_step_amp_bin_one_store.append(np.array(stim_step_amp_bin_one))
stim_step_amp_bin_two_store.append(np.array(stim_step_amp_bin_two))
stim_step_amp_bin_three_store.append(np.array(stim_step_amp_bin_three))
stim_step_amp_bin_four_store.append(np.array(stim_step_amp_bin_four))
stim_step_amp_bin_five_store.append(np.array(stim_step_amp_bin_five))
return control_step_amp_store, control_step_amp_bin_one_store, control_step_amp_bin_two_store,control_step_amp_bin_three_store,control_step_amp_bin_four_store, control_step_amp_bin_five_store, stim_step_amp_store, stim_step_amp_bin_one_store, stim_step_amp_bin_two_store, stim_step_amp_bin_three_store, stim_step_amp_bin_four_store, stim_step_amp_bin_five_store
#return control_step_amp_store