forked from Prattbuw/Treadmill_Paper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfill_nans.py
More file actions
35 lines (27 loc) · 719 Bytes
/
fill_nans.py
File metadata and controls
35 lines (27 loc) · 719 Bytes
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
import h5py
import os
import math
#matplotlib inline
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import pandas as pd
import seaborn as sea
import scipy.signal
import read_data as rd
import organize_data as od
import fill_nans as fill
import velocity as vel
import swing_stance as s_s
from scipy import signal
def fill_nans(points):
A = points
if np.isnan(points).all()==True:
A = np.zeros([len(points)])
elif np.isnan(points).all()==False:
ok = ~np.isnan(A)
xp = ok.ravel().nonzero()[0]
fp = A[~np.isnan(A)]
x = np.isnan(A).ravel().nonzero()[0]
A[np.isnan(A)] = np.interp(x, xp, fp)
return A