How to take FFT of csv file containing data with time

Hi!

I want to take four transform over time of lift data that I calculated using openfoam. Since paraview can not read data calculated as function objects in openfoam, I have converted the coeffcients.dat file into a csv file and opened it into paraview. Now I want to take FFT of lift data over time but I don’t know how to do it.

Please guide.

Thanks!

FFT on table has recently been added to ParaView, please try a nightly download from paraview.org.

@timothee.chabat

1 Like

Actually the Table FFT filter has been added in ParaView 5.10 so you can just download the latest release of ParaView. Step to plot your FFT :

  • open your CSV data, apply
  • Hit Ctrl + Space and search for “Table FFT”, Enter. You can now configure some properties for this filter :
    • Create Frequency Column : weither or not to generate a frequency data array. Note that to this filter exptect to have a column called Time in the input in order to compute the sampling frequency. A current limitation of the filter is that you cannot set the sampling frequency yourself.
    • the windowing function
    • if your data is not imaginary, I advise to enable “Optimize for Real Input” (in the advanced options)
    • also in the advanced options, you can choose to average your FFT using fixed-size block of sliding FFT windows (this can make your FFT way faster if you have lot of samples)
  • Once you have setup your FFT, Apply
  • You should now have a plot of your FFT
    • to change the X axis data and the plotted data go to the Display Properties
    • to enable the log scale for the X axis got to the View Properties
2 Likes

Thanks for your reply
I was able to download latest paraview version.
I opened a csv file containting a time column, deselected undesired columns from toggle column and selected only coefficient data along with time data. But when I apply table FFT over it, it gives me error:

Warning: In /builds/gitlab-kitware-sciviz-ci/build/superbuild/paraview/src/VTK/Filters/General/vtkTableFFT.cxx, line 221
vtkTableFFT (0x16ba3a0): ‘Time’ information not found, we will assume a 10’000 Hz sampling rate

Why is it saying time information was not found when I have time column in csv data? or am I missing something
Also, it’s dividing all of my data into x y z and magnitude… why is that so

You can safely ignore the warning message, it is just about the limitation I talked about in my previous message.

Is your time column named “time” (case-independant) ? If not then the filter will not be able to detect it.

Vector field cannot be saved in CSV as the file format does not support having multiple components for a single column, if that’s what you mean. Else
I’m not sure what you’re talking about. Could you share your csv file or a subset of it ?

1 Like

Yes my time column is labelled time

Thanks for your help

Just one thing more, can paraview show stats of FFT like dominant frequency?

There is no FFT stats per se currently in ParaView (but there is some work in progress about it, maybe for PV 5.12 :slightly_smiling_face: ) but you can still use the other tools such as Find Data for things like dominant frequency.

Go to ViewFind Data

  • Data Producer: FFT table filter
  • Elemnt Type: Column
  • Array: FFT_data(magnitude)
  • is max
  • Find Data

and you will find below the point which has the max FFT amplitude.

1 Like

@Bushra since you seems like doing some post-procesing on FFT and things like that, maybe this thread can interest you :slightly_smiling_face: Acoustic visualization and post-process : request for feedback and use cases

1 Like

@timothee.chabat Thanks for the useful FFT module! I have a related VTK question:

I want to perform FFT on a realtime stream of complex data that I will feed into a line plot (vtkPlot). I have this stream represented as std::vector<std::complex>. However, I want to be able to use vtkTableFFT but I just cant figure out how to parse a std::complex for input into vtkTableFFT.

Similarly, I have tried using kiss_fft_cpx instead of std::complex as in vtkFFT but I am stumped with how to represent this type in a vtkTableFFT/vtkTable.

Hello @Jehimon ,

actually vtkTableFFT is currently not able to process complex numbers inputs (an MR is on the way though :slightly_smiling_face: : https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9274) so you’d need to use the vtkFFT class. Just construct a std::vector<vtkFFT::ComplexNumber> and then directly use vtkFFT::Fft(std::vector<vtkFFT::ComplexNumber> input).

Note that if your data is already in the STD world and you don’t need to use the Welch method implemented in the vtkTableFFT filter, it will be faster and less memory-consuming to directly use ``vtkFFT::Fft` and then transmorm the result into a vtkTable yourself.

1 Like