def filter(self):
path = os.getcwd()+'/trialGraspEventDetection_dataFiles'
self.Fgr = np.sum(self.values[:, 9:15], axis=1) # SAI
self.Fgl = np.sum(self.values[:, 0:7], axis=1) # SAI
# can use this to plot in matlab graspeventdetection_plot.m
np.savetxt(path+'/SAI_Fgr.txt', self.Fgr)
# can use this to plot in matlab
np.savetxt(path+'/SAI_Fgl.txt', self.Fgl)
# 0.55*pi rad/samples
b1, a1 = signal.butter(1, 0.55, 'high', analog=False)
self.f_acc_x = signal.lfilter(b1, a1, self.acc_x, axis=-1, zi=None)
self.f_acc_y = signal.lfilter(b1, a1, self.acc_y, axis=-1, zi=None)
self.f_acc_z = signal.lfilter(b1, a1, self.acc_z, axis=-1, zi=None)
# self.f_eff = signal.lfilter(b1, a1, self.eff, axis=-1, zi=None)
# type(eff)
self.FAII = np.sqrt(np.square(self.f_acc_x) +
np.square(self.f_acc_y) +
np.square(self.f_acc_z))
# can use this to plot in matlab
np.savetxt(path+'/FAII.txt', self.FAII)
# subtract base values from the values array
self.values1 = self.values - self.values.min(axis=0)
# pass the filter for each sensor
self.fvalues1 = np.zeros(self.values1.shape)
# 0.48*pi rad/samples
b, a = signal.butter(1, 0.48, 'high', analog=False)
for i in range(16):
self.fvalues1[:, i] = signal.lfilter(b, a, self.values1[:, i],
axis=-1, zi=None)
self.FAI = np.sum(self.fvalues1, axis=1)
# can use this to plot in matlab
np.savetxt(path+'/FAI.txt', self.FAI)
getAccEff.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录