_waterfallDisplayPlot = new WaterfallDisplayPlot(WaterfallPlotDisplayFrame);
if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
- _waterfall3DDisplayPlot = new Waterfall3DDisplayPlot(Waterfall3DPlotDisplayFrame);
+ //_waterfall3DDisplayPlot = new Waterfall3DDisplayPlot(Waterfall3DPlotDisplayFrame);
}
_timeDomainDisplayPlot = new TimeDomainDisplayPlot(TimeDomainDisplayFrame);
// Qt deletes children when parent is deleted
// Don't worry about deleting Display Plots - they are deleted when parents are deleted
- /* delete _intValidator; */
+ delete _intValidator;
delete[] _realFFTDataPoints;
delete[] _averagedValues;
delete _historyVector;
+ displayTimer->stop();
delete displayTimer;
}
const double* realTimeDomainDataPoints = spectrumUpdateEvent->getRealTimeDomainPoints();
const double* imagTimeDomainDataPoints = spectrumUpdateEvent->getImagTimeDomainPoints();
const uint64_t numTimeDomainDataPoints = spectrumUpdateEvent->getNumTimeDomainDataPoints();
- const timespec dataTimestamp = spectrumUpdateEvent->getDataTimestamp();;
+ const timespec dataTimestamp = spectrumUpdateEvent->getDataTimestamp();
const bool repeatDataFlag = spectrumUpdateEvent->getRepeatDataFlag();
const bool lastOfMultipleUpdatesFlag = spectrumUpdateEvent->getLastOfMultipleUpdateFlag();
const timespec generatedTimestamp = spectrumUpdateEvent->getEventGeneratedTimestamp();
const std::complex<float>* complexDataPointsPtr = complexDataPoints+numFFTDataPoints/2;
double* realFFTDataPointsPtr = _realFFTDataPoints;
+ double sumMean, localPeakAmplitude, localPeakFrequency;
+ const double fftBinSize = (_stopFrequency-_startFrequency) /
+ static_cast<double>(numFFTDataPoints);
+ localPeakAmplitude = -HUGE_VAL;
+ sumMean = 0.0;
+
// Run this twice to perform the fftshift operation on the data here as well
+ std::complex<float> scaleFactor = std::complex<float>((float)numFFTDataPoints);
for(uint64_t point = 0; point < numFFTDataPoints/2; point++){
- // Calculate dBm
- // 50 ohm load assumption
- // 10 * log10 (v^2 / (2 * 50.0 * .001)) = 10 * log10( v^2 * 10)
- // 75 ohm load assumption
- // 10 * log10 (v^2 / (2 * 75.0 * .001)) = 10 * log10( v^2 * 15)
-
- // perform scaling here
- std::complex<float> pt = (*complexDataPointsPtr) / std::complex<float>((float)numFFTDataPoints);
+ std::complex<float> pt = (*complexDataPointsPtr) / scaleFactor;
*realFFTDataPointsPtr = 10.0*log10((pt.real() * pt.real() + pt.imag()*pt.imag()) + 1e-20);
+ if(*realFFTDataPointsPtr > localPeakAmplitude) {
+ localPeakFrequency = static_cast<float>(point) * fftBinSize;
+ localPeakAmplitude = *realFFTDataPointsPtr;
+ }
+ sumMean += *realFFTDataPointsPtr;
+
complexDataPointsPtr++;
realFFTDataPointsPtr++;
}
// second half of the plotted data
complexDataPointsPtr = complexDataPoints;
for(uint64_t point = 0; point < numFFTDataPoints/2; point++){
- std::complex<float> pt = (*complexDataPointsPtr) / std::complex<float>((float)numFFTDataPoints);
+ std::complex<float> pt = (*complexDataPointsPtr) / scaleFactor;
*realFFTDataPointsPtr = 10.0*log10((pt.real() * pt.real() + pt.imag()*pt.imag()) + 1e-20);
+ if(*realFFTDataPointsPtr > localPeakAmplitude) {
+ localPeakFrequency = static_cast<float>(point) * fftBinSize;
+ localPeakAmplitude = *realFFTDataPointsPtr;
+ }
+ sumMean += *realFFTDataPointsPtr;
+
complexDataPointsPtr++;
realFFTDataPointsPtr++;
}
if(!repeatDataFlag){
_AverageHistory(_realFFTDataPoints);
- double sumMean;
- const double fft_bin_size = (_stopFrequency-_startFrequency) /
- static_cast<double>(numFFTDataPoints);
-
- // find the peak, sum (for mean), etc
- _peakAmplitude = -HUGE_VAL;
- sumMean = 0.0;
- for(uint64_t number = 0; number < numFFTDataPoints; number++){
- // find peak
- if(_realFFTDataPoints[number] > _peakAmplitude){
- // Calculate the frequency relative to the local bw, adjust for _startFrequency later
- _peakFrequency = (static_cast<float>(number) * fft_bin_size);
- _peakAmplitude = _realFFTDataPoints[number];
- // _peakBin = number;
- }
- // sum (for mean)
- sumMean += _realFFTDataPoints[number];
- }
+ // Only use the local info if we are not repeating data
+ _peakAmplitude = localPeakAmplitude;
+ _peakFrequency = localPeakFrequency;
// calculate the spectral mean
// +20 because for the comparison below we only want to throw out bins
d_update_time, dataTimestamp,
spectrumUpdateEvent->getDroppedFFTFrames());
}
+ /*
if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
if( _openGLWaterfall3DFlag == 1 && (tabindex == d_plot_waterfall3d)) {
_waterfall3DDisplayPlot->PlotNewData(_realFFTDataPoints, numFFTDataPoints,
spectrumUpdateEvent->getDroppedFFTFrames());
}
}
+ */
}
if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
s.setWidth(Waterfall3DPlotDisplayFrame->width());
s.setHeight(Waterfall3DPlotDisplayFrame->height());
- emit _waterfall3DDisplayPlot->resizeSlot(&s);
+ //emit _waterfall3DDisplayPlot->resizeSlot(&s);
}
s.setWidth(ConstellationDisplayFrame->width());
waterfall3DMaximumIntensityChangedCB(Waterfall3DMaximumIntensityWheel->value());
// Check for Hardware Acceleration of the OpenGL
+ /*
if(!_waterfall3DDisplayPlot->format().directRendering()){
// Only ask this once while the program is running...
if(_openGLWaterfall3DFlag == -1){
else{
_openGLWaterfall3DFlag = 1;
}
+ */
}
if(_openGLWaterfall3DFlag != 1){
if(fdiff > 0) {
std::string strunits[4] = {"Hz", "kHz", "MHz", "GHz"};
+ std::string strtime[4] = {"sec", "ms", "us", "ns"};
double units10 = floor(log10(fdiff));
double units3 = std::max(floor(units10 / 3.0), 0.0);
double units = pow(10, (units10-fmod(units10, 3.0)));
_stopFrequency = newStopFrequency;
_centerFrequency = newCenterFrequency;
- _frequencyDisplayPlot->SetFrequencyRange(newStartFrequency,
- newStopFrequency,
- newCenterFrequency,
+ _frequencyDisplayPlot->SetFrequencyRange(_startFrequency,
+ _stopFrequency,
+ _centerFrequency,
UseRFFrequenciesCheckBox->isChecked(),
units, strunits[iunit]);
- _waterfallDisplayPlot->SetFrequencyRange(newStartFrequency,
- newStopFrequency,
- newCenterFrequency,
+ _waterfallDisplayPlot->SetFrequencyRange(_startFrequency,
+ _stopFrequency,
+ _centerFrequency,
UseRFFrequenciesCheckBox->isChecked(),
units, strunits[iunit]);
if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
- _waterfall3DDisplayPlot->SetFrequencyRange(newStartFrequency,
- newStopFrequency,
- newCenterFrequency,
+ /*
+ _waterfall3DDisplayPlot->SetFrequencyRange(_startFrequency,
+ _stopFrequency,
+ _centerFrequency,
UseRFFrequenciesCheckBox->isChecked(),
units, strunits[iunit]);
+ */
}
+ _timeDomainDisplayPlot->SetSampleRate(_stopFrequency - _startFrequency,
+ units, strtime[iunit]);
}
}
_waterfallDisplayPlot->Reset();
if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
- _waterfall3DDisplayPlot->Reset();
+ //_waterfall3DDisplayPlot->Reset();
}
}
else{
Waterfall3DMaximumIntensityWheel->setValue(Waterfall3DMinimumIntensityWheel->value());
}
-
+
+ /*
_waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(),
Waterfall3DMaximumIntensityWheel->value());
+ */
}
}
else{
Waterfall3DMinimumIntensityWheel->setValue(Waterfall3DMaximumIntensityWheel->value());
}
-
+
+ /*
_waterfall3DDisplayPlot->SetIntensityRange(Waterfall3DMinimumIntensityWheel->value(),
Waterfall3DMaximumIntensityWheel->value());
+ */
}
}
QMessageBox::information(this, "High Intensity Color Selection", "In the next window, select the high intensity color for the waterfall display", QMessageBox::Ok);
highIntensityColor = QColorDialog::getColor(highIntensityColor, this);
}
+ /*
_waterfall3DDisplayPlot->SetIntensityColorMapType(newType, lowIntensityColor,
highIntensityColor);
+ */
}
}
SpectrumDisplayForm::ToggleTabWaterfall3D(const bool state)
{
if(state == true) {
+ /*
if((QGLFormat::hasOpenGL()) && (_useOpenGL)) {
if(d_plot_waterfall3d == -1) {
SpectrumTypeTab->addTab(Waterfall3DPage, "3D Waterfall Display");
d_plot_waterfall3d = SpectrumTypeTab->count()-1;
}
}
+ */
+ SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(Waterfall3DPage));
+ d_plot_waterfall3d = -1;
+ fprintf(stderr, "\nWARNING: The Waterfall3D plot has been disabled until we get it working.\n\n");
}
else {
SpectrumTypeTab->removeTab(SpectrumTypeTab->indexOf(Waterfall3DPage));