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