I have an UFF file which consists of Vibration data. The objective is to convert the timewaveform signal to frequency domain.
I have written a python script to convert the timewave form signal to frequency domain using scipy.fft. I have an UFF file. I am importing that uff using pyuff. I am validating the output of my python script with another software's output (BKV's WTG analyzer)
Python script
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import pyuff
from scipy.fft import fft, fftfreq
uff_file=pyuff.UFF('new1.uff')
data = uff_file.read_sets()
#Taking the second dataset from the data dictionary and plotting the timewaveform
avg=np.mean(data[1]['data'])
new_y=data[1]['data']-avg
plt.plot(data[1]['x'], (new_y),linestyle='-', color='c')
plt.xlabel('secs')
plt.ylabel(data[1]['id5'])
plt.xlim([min(data[1]['x']),max(data[1]['x'])+0.25])
plt.show()
[Python Plot](https://i.stack.imgur.com/Ye3LU.png)
[WTG Analyzer](https://i.stack.imgur.com/Lm3mf.png)
#The above plot matches exactly with the timewaveform of the WTG analyzer#
#Performing FFT#
x=data[1]['x']
y=new_y
N=262144 #no of samples
T=1.024/25600 #time interval
yf=(abs(fft(y)))
xf=abs(fftfreq(N,T))
plt.plot(xf,yf)
plt.grid()
plt.show()
[Python FFT Plot](https://i.stack.imgur.com/7BRwV.png)
[WTG Analyzers Autospectrum plot](https://i.stack.imgur.com/prJnW.png)
The time domain waveforms, which match are shown below:
The values which I get after executing the FFT doesn't match with that of the WTG analyzer (see below).
I have tried all possible things like dividing the output of y axis with the number of samples, rfft, etc. But nothing is matching the output of the WTG analyzer. I want to have the exact output as that of the WTG Analyzer.
Thanks