mirror of https://github.com/f4exb/sdrangel.git
Fix radiometer autoscaling
This commit is contained in:
parent
ec9d59315d
commit
c35cc2181b
|
@ -474,11 +474,8 @@ void RadioAstronomyGUI::addToPowerSeries(FFTMeasurement *fft, bool skipCalcs)
|
||||||
{
|
{
|
||||||
if (m_settings.m_powerAutoscale)
|
if (m_settings.m_powerAutoscale)
|
||||||
{
|
{
|
||||||
double max = m_powerMax + (m_powerMax-m_powerMin)*0.2; // Add 20% space for markers
|
|
||||||
double range = max - m_powerMin;
|
|
||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
ui->powerRange->setValue(range);
|
powerAutoscaleY(false);
|
||||||
ui->powerReference->setValue(max);
|
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -764,19 +761,39 @@ void RadioAstronomyGUI::on_powerAutoscale_toggled(bool checked)
|
||||||
applySettings();
|
applySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RadioAstronomyGUI::powerAutoscaleY(bool adjustAxis)
|
||||||
|
{
|
||||||
|
double min = m_powerMin;
|
||||||
|
double max = m_powerMax;
|
||||||
|
double range = max - min;
|
||||||
|
// Round to 1 or 2 decimal places
|
||||||
|
if (range > 1.0)
|
||||||
|
{
|
||||||
|
min = std::floor(min * 10.0) / 10.0;
|
||||||
|
max = std::ceil(max * 10.0) / 10.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
min = std::floor(min * 100.0) / 100.0;
|
||||||
|
max = std::ceil(max * 100.0) / 100.0;
|
||||||
|
}
|
||||||
|
range = max - min;
|
||||||
|
max += range * 0.2; // Add 20% space for markers
|
||||||
|
range = max - min;
|
||||||
|
range = std::max(0.1, range); // Don't be smaller than minimum value we can set in GUI
|
||||||
|
|
||||||
|
if (adjustAxis) {
|
||||||
|
m_powerYAxis->setRange(min, max);
|
||||||
|
}
|
||||||
|
ui->powerRange->setValue(range); // Call before setting reference, so number of decimals are adjusted
|
||||||
|
ui->powerReference->setValue(max);
|
||||||
|
}
|
||||||
|
|
||||||
// Scale Y axis according to min and max values
|
// Scale Y axis according to min and max values
|
||||||
void RadioAstronomyGUI::on_powerAutoscaleY_clicked()
|
void RadioAstronomyGUI::on_powerAutoscaleY_clicked()
|
||||||
{
|
{
|
||||||
if (m_powerYAxis)
|
if (m_powerYAxis) {
|
||||||
{
|
powerAutoscaleY(true);
|
||||||
double min = m_powerMin;
|
|
||||||
double max = m_powerMax + (m_powerMax-m_powerMin)*0.2; // Add 20% space for markers
|
|
||||||
double range = m_powerMax - m_powerMin;
|
|
||||||
range = std::max(0.1, range); // Don't be smaller than minimum value we can set in GUI
|
|
||||||
|
|
||||||
m_powerYAxis->setRange(min, max);
|
|
||||||
ui->powerRange->setValue(range); // Call before setting reference, so number of decimals are adjusted
|
|
||||||
ui->powerReference->setValue(max);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2857,9 +2874,6 @@ void RadioAstronomyGUI::on_powerYUnits_currentIndexChanged(int index)
|
||||||
ui->powerColourScaleMinUnits->setText(text);
|
ui->powerColourScaleMinUnits->setText(text);
|
||||||
ui->powerColourScaleMaxUnits->setText(text);
|
ui->powerColourScaleMaxUnits->setText(text);
|
||||||
}
|
}
|
||||||
if (m_settings.m_powerColourAutoscale && (ui->powerChartSelect->currentIndex() == 4)) {
|
|
||||||
powerColourAutoscale();
|
|
||||||
}
|
|
||||||
applySettings();
|
applySettings();
|
||||||
plotPowerChart();
|
plotPowerChart();
|
||||||
}
|
}
|
||||||
|
@ -3025,6 +3039,9 @@ void RadioAstronomyGUI::plot2DChart()
|
||||||
for (int i = 0; i < m_fftMeasurements.size(); i++) {
|
for (int i = 0; i < m_fftMeasurements.size(); i++) {
|
||||||
update2DImage(m_fftMeasurements[i], i < m_fftMeasurements.size() - 1);
|
update2DImage(m_fftMeasurements[i], i < m_fftMeasurements.size() - 1);
|
||||||
}
|
}
|
||||||
|
if (m_settings.m_powerColourAutoscale) {
|
||||||
|
powerColourAutoscale();
|
||||||
|
}
|
||||||
|
|
||||||
connect(m_2DChart, SIGNAL(plotAreaChanged(QRectF)), this, SLOT(plotAreaChanged(QRectF)));
|
connect(m_2DChart, SIGNAL(plotAreaChanged(QRectF)), this, SLOT(plotAreaChanged(QRectF)));
|
||||||
|
|
||||||
|
|
|
@ -392,6 +392,7 @@ private:
|
||||||
void updatePowerSelect();
|
void updatePowerSelect();
|
||||||
void spectrumAutoscale();
|
void spectrumAutoscale();
|
||||||
void powerAutoscale();
|
void powerAutoscale();
|
||||||
|
void powerAutoscaleY(bool adjustAxis);
|
||||||
void calcSpectrumMarkerDelta();
|
void calcSpectrumMarkerDelta();
|
||||||
void calcPowerMarkerDelta();
|
void calcPowerMarkerDelta();
|
||||||
void calcPowerPeakDelta();
|
void calcPowerPeakDelta();
|
||||||
|
|
Loading…
Reference in New Issue