areaDetector  3-13
EPICS areaDetector framework
NDPluginFFT.h
Go to the documentation of this file.
1 
10 #ifndef NDPluginFFT_H
11 #define NDPluginFFT_H
12 
13 #include "NDPluginDriver.h"
14 
15 #define FFTTimeAxisString "FFT_TIME_AXIS" /* (asynFloat64Array, r/o) Time axis array */
16 #define FFTFreqAxisString "FFT_FREQ_AXIS" /* (asynFloat64Array, r/o) Frequency axis array */
17 #define FFTTimePerPointString "FFT_TIME_PER_POINT" /* (asynFloat64, r/o) Time per time point from driver */
18 #define FFTDirectionString "FFT_DIRECTION" /* (asynInt32, r/w) FFT direction */
19 #define FFTSuppressDCString "FFT_SUPPRESS_DC" /* (asynInt32, r/w) FFT DC offset suppression */
20 #define FFTNumAverageString "FFT_NUM_AVERAGE" /* (asynInt32, r/w) # of FFTs to average */
21 #define FFTNumAveragedString "FFT_NUM_AVERAGED" /* (asynInt32, r/o) # of FFTs averaged */
22 #define FFTResetAverageString "FFT_RESET_AVERAGE" /* (asynInt32, r/w) Reset FFT average */
23 #define FFTTimeSeriesString "FFT_TIME_SERIES" /* (asynFloat64Array, r/o) Time series data */
24 #define FFTRealString "FFT_REAL" /* (asynFloat64Array, r/o) Real part of FFT */
25 #define FFTImaginaryString "FFT_IMAGINARY" /* (asynFloat64Array, r/o) Imaginary part of FFT */
26 #define FFTAbsValueString "FFT_ABS_VALUE" /* (asynFloat64Array, r/o) Absolute value of FFT */
27 
28 typedef struct {
29  int rank;
30  int nTimeXIn;
31  int nTimeYIn;
32  int nTimeX;
33  int nTimeY;
34  int nFreqX;
35  int nFreqY;
38  double *timeSeries;
39  double *FFTComplex;
40  double *FFTReal;
41  double *FFTImaginary;
42  double *FFTAbsValue;
43 } fftPvt_t;
44 
47 public:
48  NDPluginFFT(const char *portName, int queueSize, int blockingCallbacks,
49  const char *NDArrayPort, int NDArrayAddr,
50  int maxBuffers, size_t maxMemory,
51  int priority, int stackSize, int maxThreads);
52 
53  //These methods override the virtual methods in the base class
54  void processCallbacks(NDArray *pArray);
55 
56 protected:
57 
59  #define FIRST_NDPLUGIN_FFT_PARAM P_FFTTimeAxis
67 
69  int P_FFTReal;
72 
73 private:
74  template <typename epicsType> void convertToDoubleT(NDArray *pArray, fftPvt_t *pPvt);
75  void allocateArrays(fftPvt_t *pPvt, bool sizeChanged);
76  void createAxisArrays(fftPvt_t *pPvt);
77  void computeFFT_1D(fftPvt_t *pPvt);
78  void computeFFT_2D(fftPvt_t *pPvt);
79  void doArrayCallbacks(fftPvt_t *pPvt);
80  int nextPow2(int v);
81 
82  int numAverage_;
83  int uniqueId_;
84  int nTimeXIn_;
85  int nTimeYIn_;
86  // Note FFTAbsValue_ is guaranteed to be size nFreqX_ * nFreqY_
87  // These could change between when a thread began computing the FFT and when it does the callbacks
88  int nFreqX_;
89  int nFreqY_;
90  double *FFTAbsValue_;
91  double timePerPoint_; /* Actual time between points in input arrays */
92  double *timeAxis_;
93  double *freqAxis_;
94 };
95 
96 #endif //NDPluginFFT_H
#define NDPLUGIN_API
Definition: NDPluginAPI.h:41
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition: NDArray.h:99
Class from which actual plugin drivers are derived; derived from asynNDArrayDriver.
Definition: NDPluginDriver.h:57
virtual void processCallbacks(NDArray *pArray)=0
Compute FFTs on signals.
Definition: NDPluginFFT.h:46
int P_FFTNumAverage
Definition: NDPluginFFT.h:64
int P_FFTResetAverage
Definition: NDPluginFFT.h:66
int P_FFTDirection
Definition: NDPluginFFT.h:62
int P_FFTTimePerPoint
Definition: NDPluginFFT.h:61
int P_FFTAbsValue
Definition: NDPluginFFT.h:71
int P_FFTReal
Definition: NDPluginFFT.h:69
int P_FFTImaginary
Definition: NDPluginFFT.h:70
int P_FFTTimeSeries
Definition: NDPluginFFT.h:68
int P_FFTSuppressDC
Definition: NDPluginFFT.h:63
int P_FFTTimeAxis
Definition: NDPluginFFT.h:58
int P_FFTFreqAxis
Definition: NDPluginFFT.h:60
int P_FFTNumAveraged
Definition: NDPluginFFT.h:65
Definition: NDPluginFFT.h:28
int nTimeX
Definition: NDPluginFFT.h:32
double * timeSeries
Definition: NDPluginFFT.h:38
int nTimeY
Definition: NDPluginFFT.h:33
double * FFTImaginary
Definition: NDPluginFFT.h:41
double * FFTAbsValue
Definition: NDPluginFFT.h:42
int nFreqX
Definition: NDPluginFFT.h:34
int rank
Definition: NDPluginFFT.h:29
int numAverage
Definition: NDPluginFFT.h:37
int nFreqY
Definition: NDPluginFFT.h:35
double * FFTReal
Definition: NDPluginFFT.h:40
int nTimeXIn
Definition: NDPluginFFT.h:30
double * FFTComplex
Definition: NDPluginFFT.h:39
int nTimeYIn
Definition: NDPluginFFT.h:31
int suppressDC
Definition: NDPluginFFT.h:36