Hi Kaz,
You should be able to just use the code in ADCore/ADApp/pluginSrc/fft.c. It is only 132 lines of code, and has no external dependencies, so it can even run on VxWorks and RTEMS. It contains these 2 functions:
void fft_1D(double data[], unsigned long nn, int isign);
void fft_ND(double data[], unsigned long nn[], int ndim, int isign);
These functions do the FFT in-place. data[] is really a complex array, with each element of data[] consisting of 2 doubles, the first containing the real part and the second containing the imaginary part.
For your application the data from the electrometer will be put in the real part of data[], the imaginary part will be set to 0. isign should be 1. nn is the array dimensions which must be a power of 2. On return data[] will contain
the complex FFT, with both real and imaginary values.
Mark
Hello Mark,
Indeed my inquiry is related to TetrAMM. The TetrAMM has two interfaces: Cat6 ethernet beamline network, and LC fiber (connected to BEST FPGA feedback system). The digital current measurement data flow through
both interfaces simultaneously.
The 1G Ethernet communication is process by quadEM module and provides many areaDetector features including the upcoming FFT update.
In addition, CAENels released open version of the BEST ioc this month, and I have started using it.
GitHub:
https://github.com/CAENels/best-epics-ioc
The view through BEST FPGA system allows information about implemented (piezo) feedback, in addition to passive monitoring that quadEM allows. However, the BEST IOC is missing some useful features like FFT. Adding FFT would enhance it.
Kaz
Hi Kaz,
This is from the areaDetector/ADCore release notes for the upcoming R2-5 release. These items are available now in the master branch on github.
****************************************
### NDPluginFFT
* New plugin to compute 1-D or 2-D Fast Fourier transforms. It exports 1-D or 2-D
NDArrays containing the absolute value of the FFT. It creates 1-D waveform
records of the input, and the real, imaginary, and absolute values of the first row of the FFT.
It also creates 1-D waveform records of the time and frequency axes, which are useful if the 1-D
input represents a time-series. The waveform records are convenient for plotting in OPI screens.
* The FFT algorithm requires that the input array dimensions be a power of 2, but the plugin
will pad the array to the next larger power of 2 if the input array does not meet this
requirement.
* The simDetector test application in
[areaDetector/ADExample](https://github.com/areaDetector/ADExample)
has a new simulation mode that generates images based on the sums and/or products of 4 sine waves.
This application is useful for testing and demonstrating the NDPluginFFT plugin.
****************************************
This is from the areaDetector/ADExample notes for the upcoming R2-2 release. These items are available now in the master branch on github.
****************************************
* Created a new driver in ADExample/exampleApp/ADCSimDetectorSrc.
This driver generates times-series data for 8 signals as a 2-D array [8, NumTimePoints].
The signals are common waveforms (sine, cosine, square wave, sawtooth, random noise, etc.)
The driver was written in part to test the new NDPluginTimeSeries and NDPluginFFT plugins
in ADCore R2-5. But it can also serve as a starting point for writing drivers that are used
to collect time-series data like ADCs, waveform digitizers, etc.
There is a new iocs/iocADCSimDetector directory that creates an application for testing
the driver.
* Added a new sine-wave simulation mode to simDetector. This simulation mode constructs images
as the sum or products of two sine waves in the X and Y directions. It was designed in part
to test the new NDPluginFFT plugin in ADCore R2-5.
****************************************
Mark
Hi all,
My waveform (1024 current reading in [A], @1s) needs to be processed for frequencies using FFT method. The current values are in range between pA and mA ranges.
There is an existing tech-talk exchange on FFT from about 5 years ago that discuss FFT3, fftw, and waveProc.
FFT3 based:
http://www.aps.anl.gov/epics/tech-talk/2011/msg01143.php
http://www.fftw.org/fftw3_doc/Complex-DFTs.html#Complex-DFTs
The github fftw development:
https://github.com/FFTW/fftw3
The waveProc is bit dated (2004?)
http://www.aps.anl.gov/epics/download/modules/index.php
Any newer solutions and suggestions?
Kazimierz Gofron
NSLS-II Controls Group
Brookhaven National Laboratory
(p) +1 (631) 344 5283
(f) +1 (631) 344 8085
(e) [email protected]
(w) www.bnl.gov/nsls2