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");
|
ui->to->setUnit("Hz");
|
||||||
break;
|
break;
|
||||||
case Trace::DataType::Time:
|
case Trace::DataType::Time:
|
||||||
|
case Trace::DataType::TimeZeroSpan:
|
||||||
ui->from->setUnit("s");
|
ui->from->setUnit("s");
|
||||||
ui->to->setUnit("s");
|
ui->to->setUnit("s");
|
||||||
break;
|
break;
|
||||||
|
@ -50,6 +50,7 @@ void Math::Expression::edit()
|
|||||||
case DataType::Frequency: ui->stackedWidget->setCurrentIndex(0); break;
|
case DataType::Frequency: ui->stackedWidget->setCurrentIndex(0); break;
|
||||||
case DataType::Time: ui->stackedWidget->setCurrentIndex(1); break;
|
case DataType::Time: ui->stackedWidget->setCurrentIndex(1); break;
|
||||||
case DataType::Power: ui->stackedWidget->setCurrentIndex(2); break;
|
case DataType::Power: ui->stackedWidget->setCurrentIndex(2); break;
|
||||||
|
case DataType::TimeZeroSpan: ui->stackedWidget->setCurrentIndex(3); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,6 +130,9 @@ void Math::Expression::expressionChanged()
|
|||||||
case DataType::Power:
|
case DataType::Power:
|
||||||
parser->DefineVar("P", Variable(&P));
|
parser->DefineVar("P", Variable(&P));
|
||||||
break;
|
break;
|
||||||
|
case DataType::TimeZeroSpan:
|
||||||
|
parser->DefineVar("t", Variable(&t));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<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>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -66,7 +66,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="text">
|
<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>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -75,6 +75,17 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -146,6 +146,8 @@ QString TraceMath::dataTypeToString(TraceMath::DataType type)
|
|||||||
return "Power";
|
return "Power";
|
||||||
case DataType::Time:
|
case DataType::Time:
|
||||||
return "Time";
|
return "Time";
|
||||||
|
case DataType::TimeZeroSpan:
|
||||||
|
return "Time (Zero Span)";
|
||||||
default:
|
default:
|
||||||
return "Invalid";
|
return "Invalid";
|
||||||
}
|
}
|
||||||
|
@ -228,6 +228,8 @@ QString Trace::fillFromCSV(CSV &csv, unsigned int parameter)
|
|||||||
domain = DataType::Time;
|
domain = DataType::Time;
|
||||||
} else if(csv.getHeader(0).compare("power", Qt::CaseInsensitive) == 0) {
|
} else if(csv.getHeader(0).compare("power", Qt::CaseInsensitive) == 0) {
|
||||||
domain = DataType::Power;
|
domain = DataType::Power;
|
||||||
|
} else if(csv.getHeader(0).compare("time (zero span)", Qt::CaseInsensitive) == 0) {
|
||||||
|
domain = DataType::TimeZeroSpan;
|
||||||
} else {
|
} else {
|
||||||
domain = DataType::Frequency;
|
domain = DataType::Frequency;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ TraceCSVExport::TraceCSVExport(TraceModel &traceModel, QWidget *parent) :
|
|||||||
if(traces.size() == 0) {
|
if(traces.size() == 0) {
|
||||||
ui->listColumns->clear();
|
ui->listColumns->clear();
|
||||||
} else if(ui->listColumns->count() == 0) {
|
} 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 t = traces.front();
|
||||||
auto domain = t->outputType();
|
auto domain = t->outputType();
|
||||||
auto Xaxis = XAxis::Type::Last;
|
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::Frequency: Xaxis = XAxis::Type::Frequency; break;
|
||||||
case Trace::DataType::Power: Xaxis = XAxis::Type::Power; break;
|
case Trace::DataType::Power: Xaxis = XAxis::Type::Power; break;
|
||||||
case Trace::DataType::Time: Xaxis = XAxis::Type::Time; break;
|
case Trace::DataType::Time: Xaxis = XAxis::Type::Time; break;
|
||||||
|
case Trace::DataType::TimeZeroSpan: Xaxis = XAxis::Type::TimeZeroSpan; break;
|
||||||
}
|
}
|
||||||
if(Xaxis == XAxis::Type::Last) {
|
if(Xaxis == XAxis::Type::Last) {
|
||||||
// invalid axis selection
|
// invalid axis selection
|
||||||
|
@ -351,7 +351,10 @@ QVariant MathModel::data(const QModelIndex &index, int role) const
|
|||||||
return "Frequency";
|
return "Frequency";
|
||||||
case TraceMath::DataType::Power:
|
case TraceMath::DataType::Power:
|
||||||
return "Power";
|
return "Power";
|
||||||
|
case TraceMath::DataType::TimeZeroSpan:
|
||||||
|
return "Time (Zero Span)";
|
||||||
case TraceMath::DataType::Invalid:
|
case TraceMath::DataType::Invalid:
|
||||||
|
default:
|
||||||
return "Invalid";
|
return "Invalid";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,11 +47,11 @@ protected:
|
|||||||
void initializeTraceInfo();
|
void initializeTraceInfo();
|
||||||
std::vector<Trace*> activeTraces();
|
std::vector<Trace*> activeTraces();
|
||||||
// changes the graph settings to make it possible to display a specific trace. The trace is not aded yet
|
// 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 contextMenuEvent(QContextMenuEvent *event) override;
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
virtual void updateContextMenu(){};
|
virtual void updateContextMenu(){}
|
||||||
virtual void replot(){update();};
|
virtual void replot(){update();}
|
||||||
virtual void draw(QPainter& p) = 0;
|
virtual void draw(QPainter& p) = 0;
|
||||||
virtual bool supported(Trace *t) = 0;
|
virtual bool supported(Trace *t) = 0;
|
||||||
std::map<Trace*, bool> traces;
|
std::map<Trace*, bool> traces;
|
||||||
@ -79,7 +79,7 @@ protected:
|
|||||||
void dropEvent(QDropEvent *event) override;
|
void dropEvent(QDropEvent *event) override;
|
||||||
void dragLeaveEvent(QDragLeaveEvent *event) override;
|
void dragLeaveEvent(QDragLeaveEvent *event) override;
|
||||||
virtual void traceDropped(Trace *t, QPoint position);
|
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:
|
protected slots:
|
||||||
void newTraceAvailable(Trace *t);
|
void newTraceAvailable(Trace *t);
|
||||||
|
@ -49,6 +49,9 @@ void TraceWaterfall::enableTrace(Trace *t, bool enabled)
|
|||||||
trace = t;
|
trace = t;
|
||||||
connect(t, &Trace::dataChanged, this, &TraceWaterfall::traceDataChanged);
|
connect(t, &Trace::dataChanged, this, &TraceWaterfall::traceDataChanged);
|
||||||
} else {
|
} else {
|
||||||
|
if(trace) {
|
||||||
|
disconnect(trace, &Trace::dataChanged, this, &TraceWaterfall::traceDataChanged);
|
||||||
|
}
|
||||||
trace = nullptr;
|
trace = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,14 +133,18 @@ bool TraceWaterfall::configureForTrace(Trace *t)
|
|||||||
xAxis.set(XAxis::Type::Frequency, false, true, 0, 1, 0.1);
|
xAxis.set(XAxis::Type::Frequency, false, true, 0, 1, 0.1);
|
||||||
yAxis.set(YAxis::Type::Magnitude, false, true, 0, 1, 1.0);
|
yAxis.set(YAxis::Type::Magnitude, false, true, 0, 1, 1.0);
|
||||||
break;
|
break;
|
||||||
case Trace::DataType::Time:
|
// case Trace::DataType::Time:
|
||||||
xAxis.set(XAxis::Type::Time, false, true, 0, 1, 0.1);
|
// xAxis.set(XAxis::Type::Time, false, true, 0, 1, 0.1);
|
||||||
yAxis.set(YAxis::Type::ImpulseMag, false, true, 0, 1, 1.0);
|
// yAxis.set(YAxis::Type::ImpulseMag, false, true, 0, 1, 1.0);
|
||||||
break;
|
// break;
|
||||||
case Trace::DataType::Power:
|
case Trace::DataType::Power:
|
||||||
xAxis.set(XAxis::Type::Power, false, true, 0, 1, 0.1);
|
xAxis.set(XAxis::Type::Power, false, true, 0, 1, 0.1);
|
||||||
yAxis.set(YAxis::Type::Magnitude, false, true, 0, 1, 1.0);
|
yAxis.set(YAxis::Type::Magnitude, false, true, 0, 1, 1.0);
|
||||||
break;
|
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:
|
case Trace::DataType::Invalid:
|
||||||
// unable to add
|
// unable to add
|
||||||
return false;
|
return false;
|
||||||
@ -156,6 +163,8 @@ bool TraceWaterfall::domainMatch(Trace *t)
|
|||||||
return t->outputType() == Trace::DataType::Time;
|
return t->outputType() == Trace::DataType::Time;
|
||||||
case XAxis::Type::Power:
|
case XAxis::Type::Power:
|
||||||
return t->outputType() == Trace::DataType::Power;
|
return t->outputType() == Trace::DataType::Power;
|
||||||
|
case XAxis::Type::TimeZeroSpan:
|
||||||
|
return t->outputType() == Trace::DataType::TimeZeroSpan;
|
||||||
case XAxis::Type::Last:
|
case XAxis::Type::Last:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -12,12 +12,12 @@ class TraceWaterfall : public TracePlot
|
|||||||
friend class WaterfallAxisDialog;
|
friend class WaterfallAxisDialog;
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
TraceWaterfall(TraceModel &model, QWidget *parent = 0);;
|
TraceWaterfall(TraceModel &model, QWidget *parent = 0);
|
||||||
|
|
||||||
virtual void enableTrace(Trace *t, bool enabled) override;
|
virtual void enableTrace(Trace *t, bool enabled) override;
|
||||||
|
|
||||||
void replot() override;
|
void replot() override;
|
||||||
virtual Type getType() override { return Type::Waterfall;};
|
virtual Type getType() override { return Type::Waterfall;}
|
||||||
|
|
||||||
void fromJSON(nlohmann::json j) override;
|
void fromJSON(nlohmann::json j) override;
|
||||||
nlohmann::json toJSON() override;
|
nlohmann::json toJSON() override;
|
||||||
@ -33,7 +33,7 @@ protected:
|
|||||||
bool domainMatch(Trace *t);
|
bool domainMatch(Trace *t);
|
||||||
virtual bool supported(Trace *t) override;
|
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 double nearestTracePoint(Trace *t, QPoint pixel, double *distance = nullptr) override;
|
||||||
|
|
||||||
virtual QString mouseText(QPoint pos) override;
|
virtual QString mouseText(QPoint pos) override;
|
||||||
|
@ -74,7 +74,7 @@ public:
|
|||||||
void updateSpan(double min, double max) override;
|
void updateSpan(double min, double max) override;
|
||||||
void replot() override;
|
void replot() override;
|
||||||
|
|
||||||
virtual Type getType() override { return Type::XYPlot;};
|
virtual Type getType() override { return Type::XYPlot;}
|
||||||
virtual nlohmann::json toJSON() override;
|
virtual nlohmann::json toJSON() override;
|
||||||
virtual void fromJSON(nlohmann::json j) override;
|
virtual void fromJSON(nlohmann::json j) override;
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace Protocol {
|
namespace Protocol {
|
||||||
|
|
||||||
static constexpr uint16_t Version = 10;
|
static constexpr uint16_t Version = 11;
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user