mirror of
https://github.com/jankae/LibreVNA.git
synced 2026-01-06 16:49:59 +01:00
new setting: chose pass/fail for limit checking of NaN/inf values
This commit is contained in:
parent
64a7ddc455
commit
69b2fac95f
|
|
@ -571,6 +571,19 @@ void TraceXYPlot::draw(QPainter &p)
|
|||
auto last = traceToCoordinate(t, j-1, yAxis[i]);
|
||||
auto now = traceToCoordinate(t, j, yAxis[i]);
|
||||
|
||||
// checking limits
|
||||
for(auto limit : constantLines) {
|
||||
if(i == 0 && limit->getAxis() != XYPlotConstantLine::Axis::Primary) {
|
||||
continue;
|
||||
}
|
||||
if(i == 1 && limit->getAxis() != XYPlotConstantLine::Axis::Secondary) {
|
||||
continue;
|
||||
}
|
||||
if(!limit->pass(now)) {
|
||||
limitPassing = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(isnan(last.y()) || isnan(now.y()) || isinf(last.y()) || isinf(now.y())) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -595,19 +608,6 @@ void TraceXYPlot::draw(QPainter &p)
|
|||
}
|
||||
// draw line
|
||||
p.drawLine(p1, p2);
|
||||
|
||||
// checking limits
|
||||
for(auto limit : constantLines) {
|
||||
if(i == 0 && limit->getAxis() != XYPlotConstantLine::Axis::Primary) {
|
||||
continue;
|
||||
}
|
||||
if(i == 1 && limit->getAxis() != XYPlotConstantLine::Axis::Secondary) {
|
||||
continue;
|
||||
}
|
||||
if(!limit->pass(now)) {
|
||||
limitPassing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(i == 0 && nPoints > 0) {
|
||||
// only draw markers on primary YAxis and if the trace has at least one point
|
||||
|
|
@ -1352,6 +1352,13 @@ bool XYPlotConstantLine::pass(QPointF testPoint)
|
|||
// out of range, always passes
|
||||
return true;
|
||||
}
|
||||
|
||||
// check for inf/nan on Y value
|
||||
if(isnan(testPoint.y()) || isinf(testPoint.y())) {
|
||||
// can not actually evaluate the limits, use pass/fail from preferences for this case
|
||||
return Preferences::getInstance().Graphs.limitNaNpasses;
|
||||
}
|
||||
|
||||
auto p = lower_bound(points.begin(), points.end(), testPoint.x(), [](QPointF p, double x) -> bool {
|
||||
return p.x() < x;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -274,6 +274,7 @@ void PreferencesDialog::setInitialGUIState()
|
|||
ui->GraphsColorTicksBackground->setColor(p->Graphs.Color.Ticks.Background.background);
|
||||
ui->GraphsDomainChangeBehavior->setCurrentIndex((int) p->Graphs.domainChangeBehavior);
|
||||
ui->GraphsLimitIndication->setCurrentIndex((int) p->Graphs.limitIndication);
|
||||
ui->GraphsLimitNaNpasses->setCurrentIndex(p->Graphs.limitNaNpasses ? 1 : 0);
|
||||
ui->GraphsLineWidth->setValue(p->Graphs.lineWidth);
|
||||
ui->GraphsFontSizeAxis->setValue(p->Graphs.fontSizeAxis);
|
||||
ui->GraphsFontSizeCursorOverlay->setValue(p->Graphs.fontSizeCursorOverlay);
|
||||
|
|
@ -388,6 +389,7 @@ void PreferencesDialog::updateFromGUI()
|
|||
p->Graphs.Color.Ticks.divisions = ui->GraphsColorTicksDivisions->getColor();
|
||||
p->Graphs.domainChangeBehavior = (GraphDomainChangeBehavior) ui->GraphsDomainChangeBehavior->currentIndex();
|
||||
p->Graphs.limitIndication = (GraphLimitIndication) ui->GraphsLimitIndication->currentIndex();
|
||||
p->Graphs.limitNaNpasses = ui->GraphsLimitNaNpasses->currentIndex() == 1;
|
||||
p->Graphs.lineWidth = ui->GraphsLineWidth->value();
|
||||
p->Graphs.fontSizeAxis = ui->GraphsFontSizeAxis->value();
|
||||
p->Graphs.fontSizeCursorOverlay = ui->GraphsFontSizeCursorOverlay->value();
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ public:
|
|||
} Color;
|
||||
GraphDomainChangeBehavior domainChangeBehavior;
|
||||
GraphLimitIndication limitIndication;
|
||||
bool limitNaNpasses;
|
||||
|
||||
double lineWidth;
|
||||
int fontSizeAxis;
|
||||
|
|
@ -257,6 +258,7 @@ private:
|
|||
{&Graphs.Color.Ticks.divisions, "Graphs.Color.Ticks.divisions", QColor(Qt::gray)},
|
||||
{&Graphs.domainChangeBehavior, "Graphs.domainChangeBehavior", GraphDomainChangeBehavior::AdjustGraphs},
|
||||
{&Graphs.limitIndication, "Graphs.limitIndication", GraphLimitIndication::PassFailText},
|
||||
{&Graphs.limitNaNpasses, "Graphs.limitNaNpasses", false},
|
||||
{&Graphs.lineWidth, "Graphs.lineWidth", 1.0},
|
||||
{&Graphs.fontSizeAxis, "Graphs.fontSizeAxis", 10},
|
||||
{&Graphs.fontSizeCursorOverlay, "Graphs.fontSizeCursorOverlay", 12},
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@
|
|||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>6</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="Startup">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<y>-206</y>
|
||||
<width>679</width>
|
||||
<height>836</height>
|
||||
</rect>
|
||||
|
|
@ -945,7 +945,7 @@
|
|||
<x>0</x>
|
||||
<y>-400</y>
|
||||
<width>679</width>
|
||||
<height>964</height>
|
||||
<height>992</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_22">
|
||||
|
|
@ -1378,7 +1378,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_17">
|
||||
<widget class="QGroupBox" name="GraphsLimitGroup">
|
||||
<property name="title">
|
||||
<string>Limit checking</string>
|
||||
</property>
|
||||
|
|
@ -1409,6 +1409,27 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_62">
|
||||
<property name="text">
|
||||
<string>NaN/Inf values:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="GraphsLimitNaNpasses">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fail</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pass</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -1445,8 +1466,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>696</width>
|
||||
<height>564</height>
|
||||
<width>402</width>
|
||||
<height>540</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
|
|
@ -1791,8 +1812,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>696</width>
|
||||
<height>564</height>
|
||||
<width>138</width>
|
||||
<height>112</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
|
|
|
|||
Loading…
Reference in a new issue