handle zero span data throughout the application
This commit is contained in:
parent
7151fffcdb
commit
edec4d9ec5
@ -96,6 +96,7 @@ void CSVImport::evaluateFile()
|
||||
ui->to->setUnit("Hz");
|
||||
break;
|
||||
case Trace::DataType::Time:
|
||||
case Trace::DataType::TimeZeroSpan:
|
||||
ui->from->setUnit("s");
|
||||
ui->to->setUnit("s");
|
||||
break;
|
||||
|
@ -50,6 +50,7 @@ void Math::Expression::edit()
|
||||
case DataType::Frequency: ui->stackedWidget->setCurrentIndex(0); break;
|
||||
case DataType::Time: ui->stackedWidget->setCurrentIndex(1); break;
|
||||
case DataType::Power: ui->stackedWidget->setCurrentIndex(2); break;
|
||||
case DataType::TimeZeroSpan: ui->stackedWidget->setCurrentIndex(3); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
@ -129,6 +130,9 @@ void Math::Expression::expressionChanged()
|
||||
case DataType::Power:
|
||||
parser->DefineVar("P", Variable(&P));
|
||||
break;
|
||||
case DataType::TimeZeroSpan:
|
||||
parser->DefineVar("t", Variable(&t));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Available variables:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">x: the S parameter as a (complex) voltage vector. </li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">f: measurement frequency in Hz</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">w: angular measurement frequency (w = 2πf)</li></ul><p>Examples:<br/>Add 10db to the trace (10db = exp10(10/20) = sqrt(10)):</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">x * sqrt(10)</li></ul><p>Clip trace at 0db (0db = exp10(0/20) = 1) while preserving phase:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">abs(x) &lt; 1 ? x : exp(i*arg(x))</li></ul></body></html></string>
|
||||
<string><html><head/><body><p>Available variables:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">x: the S parameter as a (complex) voltage ratio vector. </li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">f: measurement frequency in Hz</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">w: angular measurement frequency (w = 2πf)</li></ul><p>Examples:<br/>Add 10db to the trace (10db = exp10(10/20) = sqrt(10)):</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">x * sqrt(10)</li></ul><p>Clip trace at 0db (0db = exp10(0/20) = 1) while preserving phase:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">abs(x) &lt; 1 ? x : exp(i*arg(x))</li></ul></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -66,7 +66,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Available variables:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">x: the S parameter as a (complex) voltage vector. </li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">P: power of the stimulus signal in dBm</li></ul><p>Examples:<br/>Add 10db to the trace (10db = exp10(10/20) = sqrt(10)):</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">x * sqrt(10)</li></ul><p>Clip trace at 0db (0db = exp10(0/20) = 1) while preserving phase:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">abs(x) &lt; 1 ? x : exp(i*arg(x))</li></ul></body></html></string>
|
||||
<string><html><head/><body><p>Available variables:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">x: the S parameter as a (complex) voltage ratio vector. </li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">P: power of the stimulus signal in dBm</li></ul><p>Examples:<br/>Add 10db to the trace (10db = exp10(10/20) = sqrt(10)):</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">x * sqrt(10)</li></ul><p>Clip trace at 0db (0db = exp10(0/20) = 1) while preserving phase:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">abs(x) &lt; 1 ? x : exp(i*arg(x))</li></ul></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
@ -75,6 +75,17 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Available variables:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">x: the S parameter as a (complex) voltage ratio vector. </li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">t: time in seconds</li></ul><p><br/></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -146,6 +146,8 @@ QString TraceMath::dataTypeToString(TraceMath::DataType type)
|
||||
return "Power";
|
||||
case DataType::Time:
|
||||
return "Time";
|
||||
case DataType::TimeZeroSpan:
|
||||
return "Time (Zero Span)";
|
||||
default:
|
||||
return "Invalid";
|
||||
}
|
||||
|
@ -228,6 +228,8 @@ QString Trace::fillFromCSV(CSV &csv, unsigned int parameter)
|
||||
domain = DataType::Time;
|
||||
} else if(csv.getHeader(0).compare("power", Qt::CaseInsensitive) == 0) {
|
||||
domain = DataType::Power;
|
||||
} else if(csv.getHeader(0).compare("time (zero span)", Qt::CaseInsensitive) == 0) {
|
||||
domain = DataType::TimeZeroSpan;
|
||||
} else {
|
||||
domain = DataType::Frequency;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ TraceCSVExport::TraceCSVExport(TraceModel &traceModel, QWidget *parent) :
|
||||
if(traces.size() == 0) {
|
||||
ui->listColumns->clear();
|
||||
} else if(ui->listColumns->count() == 0) {
|
||||
// first trace has bee selected, fill column selection
|
||||
// first trace has been selected, fill column selection
|
||||
auto t = traces.front();
|
||||
auto domain = t->outputType();
|
||||
auto Xaxis = XAxis::Type::Last;
|
||||
@ -34,6 +34,7 @@ TraceCSVExport::TraceCSVExport(TraceModel &traceModel, QWidget *parent) :
|
||||
case Trace::DataType::Frequency: Xaxis = XAxis::Type::Frequency; break;
|
||||
case Trace::DataType::Power: Xaxis = XAxis::Type::Power; break;
|
||||
case Trace::DataType::Time: Xaxis = XAxis::Type::Time; break;
|
||||
case Trace::DataType::TimeZeroSpan: Xaxis = XAxis::Type::TimeZeroSpan; break;
|
||||
}
|
||||
if(Xaxis == XAxis::Type::Last) {
|
||||
// invalid axis selection
|
||||
|
@ -351,7 +351,10 @@ QVariant MathModel::data(const QModelIndex &index, int role) const
|
||||
return "Frequency";
|
||||
case TraceMath::DataType::Power:
|
||||
return "Power";
|
||||
case TraceMath::DataType::TimeZeroSpan:
|
||||
return "Time (Zero Span)";
|
||||
case TraceMath::DataType::Invalid:
|
||||
default:
|
||||
return "Invalid";
|
||||
}
|
||||
}
|
||||
|
@ -47,11 +47,11 @@ protected:
|
||||
void initializeTraceInfo();
|
||||
std::vector<Trace*> activeTraces();
|
||||
// changes the graph settings to make it possible to display a specific trace. The trace is not aded yet
|
||||
virtual bool configureForTrace(Trace *t) { Q_UNUSED(t) return false; }; // default implementation fails for all traces
|
||||
virtual bool configureForTrace(Trace *t) { Q_UNUSED(t) return false; } // default implementation fails for all traces
|
||||
void contextMenuEvent(QContextMenuEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
virtual void updateContextMenu(){};
|
||||
virtual void replot(){update();};
|
||||
virtual void updateContextMenu(){}
|
||||
virtual void replot(){update();}
|
||||
virtual void draw(QPainter& p) = 0;
|
||||
virtual bool supported(Trace *t) = 0;
|
||||
std::map<Trace*, bool> traces;
|
||||
@ -79,7 +79,7 @@ protected:
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
void dragLeaveEvent(QDragLeaveEvent *event) override;
|
||||
virtual void traceDropped(Trace *t, QPoint position);
|
||||
virtual QString mouseText(QPoint pos) {Q_UNUSED(pos) return QString();};
|
||||
virtual QString mouseText(QPoint pos) {Q_UNUSED(pos) return QString();}
|
||||
|
||||
protected slots:
|
||||
void newTraceAvailable(Trace *t);
|
||||
|
@ -49,6 +49,9 @@ void TraceWaterfall::enableTrace(Trace *t, bool enabled)
|
||||
trace = t;
|
||||
connect(t, &Trace::dataChanged, this, &TraceWaterfall::traceDataChanged);
|
||||
} else {
|
||||
if(trace) {
|
||||
disconnect(trace, &Trace::dataChanged, this, &TraceWaterfall::traceDataChanged);
|
||||
}
|
||||
trace = nullptr;
|
||||
}
|
||||
|
||||
@ -130,14 +133,18 @@ bool TraceWaterfall::configureForTrace(Trace *t)
|
||||
xAxis.set(XAxis::Type::Frequency, false, true, 0, 1, 0.1);
|
||||
yAxis.set(YAxis::Type::Magnitude, false, true, 0, 1, 1.0);
|
||||
break;
|
||||
case Trace::DataType::Time:
|
||||
xAxis.set(XAxis::Type::Time, false, true, 0, 1, 0.1);
|
||||
yAxis.set(YAxis::Type::ImpulseMag, false, true, 0, 1, 1.0);
|
||||
break;
|
||||
// case Trace::DataType::Time:
|
||||
// xAxis.set(XAxis::Type::Time, false, true, 0, 1, 0.1);
|
||||
// yAxis.set(YAxis::Type::ImpulseMag, false, true, 0, 1, 1.0);
|
||||
// break;
|
||||
case Trace::DataType::Power:
|
||||
xAxis.set(XAxis::Type::Power, false, true, 0, 1, 0.1);
|
||||
yAxis.set(YAxis::Type::Magnitude, false, true, 0, 1, 1.0);
|
||||
break;
|
||||
// case Trace::DataType::TimeZeroSpan:
|
||||
// xAxis.set(XAxis::Type::Power, false, true, 0, 1, 0.1);
|
||||
// yAxis.set(YAxis::Type::Magnitude, false, true, 0, 1, 1.0);
|
||||
// break;
|
||||
case Trace::DataType::Invalid:
|
||||
// unable to add
|
||||
return false;
|
||||
@ -156,6 +163,8 @@ bool TraceWaterfall::domainMatch(Trace *t)
|
||||
return t->outputType() == Trace::DataType::Time;
|
||||
case XAxis::Type::Power:
|
||||
return t->outputType() == Trace::DataType::Power;
|
||||
case XAxis::Type::TimeZeroSpan:
|
||||
return t->outputType() == Trace::DataType::TimeZeroSpan;
|
||||
case XAxis::Type::Last:
|
||||
return false;
|
||||
}
|
||||
|
@ -12,12 +12,12 @@ class TraceWaterfall : public TracePlot
|
||||
friend class WaterfallAxisDialog;
|
||||
Q_OBJECT
|
||||
public:
|
||||
TraceWaterfall(TraceModel &model, QWidget *parent = 0);;
|
||||
TraceWaterfall(TraceModel &model, QWidget *parent = 0);
|
||||
|
||||
virtual void enableTrace(Trace *t, bool enabled) override;
|
||||
|
||||
void replot() override;
|
||||
virtual Type getType() override { return Type::Waterfall;};
|
||||
virtual Type getType() override { return Type::Waterfall;}
|
||||
|
||||
void fromJSON(nlohmann::json j) override;
|
||||
nlohmann::json toJSON() override;
|
||||
@ -33,7 +33,7 @@ protected:
|
||||
bool domainMatch(Trace *t);
|
||||
virtual bool supported(Trace *t) override;
|
||||
|
||||
virtual QPoint markerToPixel(Marker *m) override { Q_UNUSED(m) return QPoint(0,0);};
|
||||
virtual QPoint markerToPixel(Marker *m) override { Q_UNUSED(m) return QPoint(0,0);}
|
||||
virtual double nearestTracePoint(Trace *t, QPoint pixel, double *distance = nullptr) override;
|
||||
|
||||
virtual QString mouseText(QPoint pos) override;
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
void updateSpan(double min, double max) override;
|
||||
void replot() override;
|
||||
|
||||
virtual Type getType() override { return Type::XYPlot;};
|
||||
virtual Type getType() override { return Type::XYPlot;}
|
||||
virtual nlohmann::json toJSON() override;
|
||||
virtual void fromJSON(nlohmann::json j) override;
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Protocol {
|
||||
|
||||
static constexpr uint16_t Version = 10;
|
||||
static constexpr uint16_t Version = 11;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user