Guest User

Untitled

a guest
Nov 24th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #The three-dimension data collected (X,Y,Z) were transformed into a
  2. #single-dimensional Signal Magnitude Vector SMV (aka The Resultant)
  3. #SMV = x2 + Y2 + Z2
  4.  
  5. X2 = X['X']*X['X']
  6. Y2 = X['Y']*X['Y']
  7. Z2 = X['Z']*X['Z']
  8.  
  9. #print X['X'].head(2) #Confirmed worked
  10. #print X2.head(2) #Confirmed worked
  11.  
  12. combine = [X2,Y2,Z2, Y]
  13. parent = pd.concat(combine, axis=1)
  14. parent['ADD'] = parent.sum(axis=1) #Sum X2,Y2,Z2
  15. sqr = np.sqrt(parent['ADD']) #Square Root of Sum Above
  16. sqr.name = 'SMV'
  17.  
  18. combine2 = [sqr, Y] #Reduce Dataset to SMV and Class
  19. parent2 = pd.concat(combine2, axis=1)
  20. print parent2.head(4)
  21.  
  22. "************************* Begin Fourier ****************************"
  23.  
  24. from scipy import fftpack
  25.  
  26. X = fftpack.fft(sqr)
  27. f_s = 80 #80 Hertz
  28. samp = 1024 #samples per segment divided by 12.8 secs signal length
  29. n = X.size
  30. timestep = 10
  31. freqs = fftpack.fftfreq(n, d=timestep)
Add Comment
Please, Sign In to add comment