-
Notifications
You must be signed in to change notification settings - Fork 10
/
fft_widget.h
110 lines (92 loc) · 3.37 KB
/
fft_widget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#ifndef FFT_WIDGET_H
#define FFT_WIDGET_H
/* Qt includes */
#include <QSharedPointer>
#include <QWidget>
#include <QGridLayout>
#include <QCheckBox>
#include <QRadioButton>
#include <QSpinBox>
#include <QTimer>
/* Live View includes */
#include "qcustomplot.h"
#include "frame_worker.h"
#include "startupOptions.h"
/*! \file
* \brief Plots a bar graph of the FFT of a time series.
* \paragraph
*
*The FFT Widget displays the Fourier Transform of three different types of data in a bar graph format.
* There are three sampling types which may be selected using the buttons underneath the plot. From the
* cuda_take documentation, here are the three different types of time series input by cuda_take:
* \paragraph
*
* \list
* 1. Frame Mean (Frame Rate sampling) - the average of all pixels in one frame is determined and
* used as a single value in the series. Thus, all the frame means combine to make a series with
* a length of 1500 frames in time.
* 2. Vertical Crosshair Profile (Row Clock sampling) - The vertical profile contains the data for
* all pixels in one column. This vertical profile is used as the time series input and the FFT
* is calculated each frame. Therefore, the image data is being sampled at the rate that rows of
* data are sent along the data bus, which is approximately 48 kHz (Pixel Clock / Number of Rows)
* 3. Tap Profile (Pixel Clock sampling) - All the pixels in a tap with dimensions 160cols x 480 rows
* is concatenated into a time series which is input to the FFT. This enables detection of periodic
* signals at the pixel level. The sampling rate is equal to the pixel clock, which usually runs at
* 10MHz. If this value is changed at the hardware level, the value of the pixel clock must be
* re-entered, and the program recompiled. (jk - I think this depends on resolution)
* \paragraph
*
* In vertical crosshair FFTs, the number of columns to be binned may be selected using the slider in the
* controls box. In the tap profile, the tap that is being sampled may be selected using the numbered display
* next to the button.
* \author Jackie Ryan
* \author Noah Levy
*/
class fft_widget : public QWidget
{
Q_OBJECT
QTimer rendertimer;
startupOptionsType options;
/* GUI elements */
QGridLayout qgl;
QCheckBox zero_const_box;
/* Plot elements */
QCustomPlot *qcp;
QCPBars *fft_bars;
QVector<double> freq_bins;
QVector<double> rfft_data_vec;
/* Plot rendering elements */
volatile double ceiling;
volatile double floor;
unsigned int count = 0;
public:
explicit fft_widget(frameWorker *fw, QWidget *parent = 0);
frameWorker *fw;
/*! \addtogroup getters
* @{ */
double getCeiling();
double getFloor();
/*! @} */
const unsigned int slider_max = (1<<16) * 1.1;
bool slider_low_inc = false;
/*! Public GUI elements - ControlsBox needs access
* @{ */
QRadioButton *plMeanButton;
QRadioButton *vCrossButton;
QRadioButton *tapPrfButton;
QSpinBox tapToProfile;
/*! @} */
public slots:
/*! \addtogroup renderfunc
* @{ */
void handleNewFrame();
/*! @} */
/*! \addtogroup plotfunc
* @{ */
void updateCeiling(int c);
void updateFloor(int f);
void rescaleRange();
void updateFFT();
/*! @} */
};
#endif // FFT_WIDGET_H