0
플랫 CSV 파일 (백만 행 +)에 저장된 X, Y, Z 가속도계 데이터에서 우세 주파수, 보조 우세 주파수를 계산하고 싶습니다.롤링 윈도우, 우세 주파수 번데기 가속도계 데이터
것은 내가 NumPy와 알고 있지만, scipy를 사용하려고 해요 - 하나 할 것입니다. 필자는 X, Y, Z를 SMV 형식 (단일 크기 벡터)으로 변환했으며 푸리에 변환을 적용한 다음 fftfreq를 사용하여 주파수를 얻고 싶습니다. 저를 물리 친 비트는 n과 timestep입니다. 내 샘플 레이트, 허츠, 나는 (10 개의 데이터 행)하지만보고 싶지 롤링 윈도우의 크기가 아래 스크립트에 이것을 적용하는 방법을 아주 확실하지 :
#The three-dimension data collected (X,Y,Z) were transformed into a
#single-dimensional Signal Magnitude Vector SMV (aka The Resultant)
#SMV = x2 + Y2 + Z2
X2 = X['X']*X['X']
Y2 = X['Y']*X['Y']
Z2 = X['Z']*X['Z']
#print X['X'].head(2) #Confirmed worked
#print X2.head(2) #Confirmed worked
combine = [X2,Y2,Z2, Y]
parent = pd.concat(combine, axis=1)
parent['ADD'] = parent.sum(axis=1) #Sum X2,Y2,Z2
sqr = np.sqrt(parent['ADD']) #Square Root of Sum Above
sqr.name = 'SMV'
combine2 = [sqr, Y] #Reduce Dataset to SMV and Class
parent2 = pd.concat(combine2, axis=1)
print parent2.head(4)
"************************* Begin Fourier ****************************"
from scipy import fftpack
X = fftpack.fft(sqr)
f_s = 80 #80 Hertz
samp = 1024 #samples per segment divided by 12.8 secs signal length
n = X.size
timestep = 10
freqs = fftpack.fftfreq(n, d=timestep)