Merge branch 'master' into trace_math
This commit is contained in:
commit
163b23f28d
@ -621,6 +621,55 @@ std::vector<Trace *> Calibration::getErrorTermTraces()
|
|||||||
return traces;
|
return traces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<Trace *> Calibration::getMeasurementTraces()
|
||||||
|
{
|
||||||
|
std::vector<Trace*> traces;
|
||||||
|
for(auto m : measurements) {
|
||||||
|
auto info = getMeasurementInfo(m.first);
|
||||||
|
if(info.points > 0) {
|
||||||
|
vector<QString> usedPrefixes;
|
||||||
|
switch(m.first) {
|
||||||
|
case Measurement::Port1Load:
|
||||||
|
case Measurement::Port1Open:
|
||||||
|
case Measurement::Port1Short:
|
||||||
|
usedPrefixes = {"S11"};
|
||||||
|
break;
|
||||||
|
case Measurement::Port2Load:
|
||||||
|
case Measurement::Port2Open:
|
||||||
|
case Measurement::Port2Short:
|
||||||
|
usedPrefixes = {"S22"};
|
||||||
|
break;
|
||||||
|
case Measurement::Through:
|
||||||
|
case Measurement::Line:
|
||||||
|
case Measurement::Isolation:
|
||||||
|
usedPrefixes = {"S11", "S12", "S21", "S22"};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for(auto prefix : usedPrefixes) {
|
||||||
|
auto t = new Trace(prefix + " " + info.name);
|
||||||
|
t->setCalibration(true);
|
||||||
|
t->setReflection(prefix == "S11" || prefix == "S22");
|
||||||
|
for(auto p : m.second.datapoints) {
|
||||||
|
Trace::Data d;
|
||||||
|
d.frequency = p.frequency;
|
||||||
|
if(prefix == "S11") {
|
||||||
|
d.S = complex<double>(p.real_S11, p.imag_S11);
|
||||||
|
} else if(prefix == "S12") {
|
||||||
|
d.S = complex<double>(p.real_S12, p.imag_S12);
|
||||||
|
} else if(prefix == "S21") {
|
||||||
|
d.S = complex<double>(p.real_S21, p.imag_S21);
|
||||||
|
} else {
|
||||||
|
d.S = complex<double>(p.real_S22, p.imag_S22);
|
||||||
|
}
|
||||||
|
t->addData(d);
|
||||||
|
}
|
||||||
|
traces.push_back(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return traces;
|
||||||
|
}
|
||||||
|
|
||||||
bool Calibration::openFromFile(QString filename)
|
bool Calibration::openFromFile(QString filename)
|
||||||
{
|
{
|
||||||
if(filename.isEmpty()) {
|
if(filename.isEmpty()) {
|
||||||
|
@ -80,6 +80,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Trace*> getErrorTermTraces();
|
std::vector<Trace*> getErrorTermTraces();
|
||||||
|
std::vector<Trace*> getMeasurementTraces();
|
||||||
|
|
||||||
bool openFromFile(QString filename = QString());
|
bool openFromFile(QString filename = QString());
|
||||||
bool saveToFile(QString filename = QString());
|
bool saveToFile(QString filename = QString());
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@ -112,7 +112,7 @@
|
|||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_11">
|
<widget class="QLabel" name="label_11">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p>L0 [10<span style=" vertical-align:super;">-12</span>F]:</p></body></html></string>
|
<string><html><head/><body><p>L0 [10<span style=" vertical-align:super;">-12</span>H]:</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -122,7 +122,7 @@
|
|||||||
<item row="4" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="label_12">
|
<widget class="QLabel" name="label_12">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p>L1 [10<span style=" vertical-align:super;">-24</span>F/Hz]:</p></body></html></string>
|
<string><html><head/><body><p>L1 [10<span style=" vertical-align:super;">-24</span>H/Hz]:</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -132,7 +132,7 @@
|
|||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QLabel" name="label_13">
|
<widget class="QLabel" name="label_13">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p>L2 [10<span style=" vertical-align:super;">-33</span>F/Hz<span style=" vertical-align:super;">2</span>]:</p></body></html></string>
|
<string><html><head/><body><p>L2 [10<span style=" vertical-align:super;">-33</span>H/Hz<span style=" vertical-align:super;">2</span>]:</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -142,7 +142,7 @@
|
|||||||
<item row="6" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="label_14">
|
<widget class="QLabel" name="label_14">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p>L3 [10<span style=" vertical-align:super;">-42</span>F/Hz<span style=" vertical-align:super;">3</span>]:</p></body></html></string>
|
<string><html><head/><body><p>L3 [10<span style=" vertical-align:super;">-42</span>H/Hz<span style=" vertical-align:super;">3</span>]:</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -288,7 +288,7 @@
|
|||||||
<item row="6" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>C0 [10<sup>-45</sup>F/Hz<sup>3</sup>]:</string>
|
<string><html><head/><body><p>C3 [10<span style=" vertical-align:super;">-45</span>F/Hz<span style=" vertical-align:super;">3</span>]:</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -845,17 +845,17 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>SIUnitEdit</class>
|
||||||
|
<extends>QLineEdit</extends>
|
||||||
|
<header>CustomWidgets/siunitedit.h</header>
|
||||||
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>TouchstoneImport</class>
|
<class>TouchstoneImport</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
<header>CustomWidgets/touchstoneimport.h</header>
|
<header>CustomWidgets/touchstoneimport.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>SIUnitEdit</class>
|
|
||||||
<extends>QLineEdit</extends>
|
|
||||||
<header>CustomWidgets/siunitedit.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>open_Z0</tabstop>
|
<tabstop>open_Z0</tabstop>
|
||||||
@ -933,10 +933,10 @@
|
|||||||
</connection>
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
<buttongroups>
|
<buttongroups>
|
||||||
<buttongroup name="ThroughType"/>
|
|
||||||
<buttongroup name="TRL_Rtype"/>
|
<buttongroup name="TRL_Rtype"/>
|
||||||
|
<buttongroup name="LoadType"/>
|
||||||
|
<buttongroup name="ThroughType"/>
|
||||||
<buttongroup name="ShortType"/>
|
<buttongroup name="ShortType"/>
|
||||||
<buttongroup name="OpenType"/>
|
<buttongroup name="OpenType"/>
|
||||||
<buttongroup name="LoadType"/>
|
|
||||||
</buttongroups>
|
</buttongroups>
|
||||||
</ui>
|
</ui>
|
||||||
|
19
Software/PC_Application/Traces/Math/medianfilterdialog.ui
Normal file
19
Software/PC_Application/Traces/Math/medianfilterdialog.ui
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<ui version="4.0" >
|
||||||
|
<class>Dialog</class>
|
||||||
|
<widget class="QDialog" name="Dialog" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle" >
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
|
|
@ -108,6 +108,8 @@ QVariant TraceModel::data(const QModelIndex &index, int role) const
|
|||||||
} else {
|
} else {
|
||||||
return QIcon(":/icons/invisible.svg");
|
return QIcon(":/icons/invisible.svg");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return QVariant();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ColIndexPlayPause:
|
case ColIndexPlayPause:
|
||||||
@ -117,6 +119,8 @@ QVariant TraceModel::data(const QModelIndex &index, int role) const
|
|||||||
} else {
|
} else {
|
||||||
return QIcon(":/icons/play.svg");
|
return QIcon(":/icons/play.svg");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return QVariant();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ColIndexMath:
|
case ColIndexMath:
|
||||||
|
@ -462,6 +462,7 @@ void TraceXYPlot::updateAxisTicks()
|
|||||||
};
|
};
|
||||||
|
|
||||||
auto createAutomaticTicks = [](vector<double>& ticks, double start, double stop, int minDivisions) -> double {
|
auto createAutomaticTicks = [](vector<double>& ticks, double start, double stop, int minDivisions) -> double {
|
||||||
|
Q_ASSERT(stop > start);
|
||||||
ticks.clear();
|
ticks.clear();
|
||||||
double max_div_step = (stop - start) / minDivisions;
|
double max_div_step = (stop - start) / minDivisions;
|
||||||
int zeros = floor(log10(max_div_step));
|
int zeros = floor(log10(max_div_step));
|
||||||
@ -561,15 +562,30 @@ void TraceXYPlot::updateAxisTicks()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// add 5% overrange
|
if(max >= min) {
|
||||||
auto range = max - min;
|
auto range = max - min;
|
||||||
|
if(range == 0.0) {
|
||||||
|
// this could happen if all values in a trace are identical (e.g. imported ideal touchstone files)
|
||||||
|
if(max == 0.0) {
|
||||||
|
// simply use +/-1 range
|
||||||
|
max = 1.0;
|
||||||
|
min = -1.0;
|
||||||
|
} else {
|
||||||
|
// +/-5% around value
|
||||||
|
max += abs(max * 0.05);
|
||||||
|
min -= abs(max * 0.05);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// add 5% of range at both ends
|
||||||
min -= range * 0.05;
|
min -= range * 0.05;
|
||||||
max += range * 0.05;
|
max += range * 0.05;
|
||||||
|
}
|
||||||
YAxis[i].rangeMin = min;
|
YAxis[i].rangeMin = min;
|
||||||
YAxis[i].rangeMax = max;
|
YAxis[i].rangeMax = max;
|
||||||
YAxis[i].rangeDiv = createAutomaticTicks(YAxis[i].ticks, min, max, 8);
|
YAxis[i].rangeDiv = createAutomaticTicks(YAxis[i].ticks, min, max, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TraceXYPlot::AxisTypeToName(TraceXYPlot::YAxisType type)
|
QString TraceXYPlot::AxisTypeToName(TraceXYPlot::YAxisType type)
|
||||||
|
@ -47,8 +47,6 @@ XYplotAxisDialog::XYplotAxisDialog(TraceXYPlot *plot) :
|
|||||||
ui->Y2divs->setUnit(unit);
|
ui->Y2divs->setUnit(unit);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->XType, qOverload<int>(&QComboBox::currentIndexChanged), this, &XYplotAxisDialog::XAxisTypeChanged);
|
|
||||||
|
|
||||||
connect(ui->Y2auto, &QCheckBox::toggled, [this](bool checked) {
|
connect(ui->Y2auto, &QCheckBox::toggled, [this](bool checked) {
|
||||||
ui->Y2min->setEnabled(!checked);
|
ui->Y2min->setEnabled(!checked);
|
||||||
ui->Y2max->setEnabled(!checked);
|
ui->Y2max->setEnabled(!checked);
|
||||||
@ -67,6 +65,9 @@ XYplotAxisDialog::XYplotAxisDialog(TraceXYPlot *plot) :
|
|||||||
ui->Xmax->setPrefixes("pnum kMG");
|
ui->Xmax->setPrefixes("pnum kMG");
|
||||||
ui->Xdivs->setPrefixes("pnum kMG");
|
ui->Xdivs->setPrefixes("pnum kMG");
|
||||||
|
|
||||||
|
XAxisTypeChanged((int) plot->XAxis.type);
|
||||||
|
connect(ui->XType, qOverload<int>(&QComboBox::currentIndexChanged), this, &XYplotAxisDialog::XAxisTypeChanged);
|
||||||
|
|
||||||
// Fill initial values
|
// Fill initial values
|
||||||
// assume same order in YAxisType enum as in ComboBox items
|
// assume same order in YAxisType enum as in ComboBox items
|
||||||
ui->Y1type->setCurrentIndex((int) plot->YAxis[0].type);
|
ui->Y1type->setCurrentIndex((int) plot->YAxis[0].type);
|
||||||
|
@ -445,6 +445,9 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="Xautomode">
|
<widget class="QComboBox" name="Xautomode">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use Span</string>
|
<string>Use Span</string>
|
||||||
|
@ -119,13 +119,6 @@ VNA::VNA(AppWindow *window)
|
|||||||
StartCalibrationDialog();
|
StartCalibrationDialog();
|
||||||
});
|
});
|
||||||
|
|
||||||
auto calImport = calMenu->addAction("Import error terms as traces");
|
|
||||||
calImport->setEnabled(false);
|
|
||||||
connect(calImport, &QAction::triggered, [=](){
|
|
||||||
auto import = new TraceImportDialog(traceModel, cal.getErrorTermTraces());
|
|
||||||
import->show();
|
|
||||||
});
|
|
||||||
|
|
||||||
auto calEditKit = calMenu->addAction("Edit Calibration Kit");
|
auto calEditKit = calMenu->addAction("Edit Calibration Kit");
|
||||||
connect(calEditKit, &QAction::triggered, [=](){
|
connect(calEditKit, &QAction::triggered, [=](){
|
||||||
cal.getCalibrationKit().edit([=](){
|
cal.getCalibrationKit().edit([=](){
|
||||||
@ -134,6 +127,22 @@ VNA::VNA(AppWindow *window)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
calMenu->addSeparator();
|
||||||
|
|
||||||
|
auto calImportTerms = calMenu->addAction("Import error terms as traces");
|
||||||
|
calImportTerms->setEnabled(false);
|
||||||
|
connect(calImportTerms, &QAction::triggered, [=](){
|
||||||
|
auto import = new TraceImportDialog(traceModel, cal.getErrorTermTraces());
|
||||||
|
import->show();
|
||||||
|
});
|
||||||
|
auto calImportMeas = calMenu->addAction("Import measurements as traces");
|
||||||
|
calImportMeas->setEnabled(false);
|
||||||
|
connect(calImportMeas, &QAction::triggered, [=](){
|
||||||
|
auto import = new TraceImportDialog(traceModel, cal.getMeasurementTraces());
|
||||||
|
import->show();
|
||||||
|
});
|
||||||
|
|
||||||
portExtension.setCalkit(&cal.getCalibrationKit());
|
portExtension.setCalkit(&cal.getCalibrationKit());
|
||||||
|
|
||||||
// Tools menu
|
// Tools menu
|
||||||
@ -319,7 +328,8 @@ VNA::VNA(AppWindow *window)
|
|||||||
cbEnableCal->setCheckState(Qt::CheckState::Unchecked);
|
cbEnableCal->setCheckState(Qt::CheckState::Unchecked);
|
||||||
cbType->blockSignals(false);
|
cbType->blockSignals(false);
|
||||||
cbEnableCal->blockSignals(false);
|
cbEnableCal->blockSignals(false);
|
||||||
calImport->setEnabled(false);
|
calImportTerms->setEnabled(false);
|
||||||
|
calImportMeas->setEnabled(false);
|
||||||
saveCal->setEnabled(false);
|
saveCal->setEnabled(false);
|
||||||
});
|
});
|
||||||
connect(calDisable, &QAction::triggered, this, &VNA::DisableCalibration);
|
connect(calDisable, &QAction::triggered, this, &VNA::DisableCalibration);
|
||||||
@ -335,7 +345,8 @@ VNA::VNA(AppWindow *window)
|
|||||||
cbEnableCal->setCheckState(Qt::CheckState::Checked);
|
cbEnableCal->setCheckState(Qt::CheckState::Checked);
|
||||||
cbType->blockSignals(false);
|
cbType->blockSignals(false);
|
||||||
cbEnableCal->blockSignals(false);
|
cbEnableCal->blockSignals(false);
|
||||||
calImport->setEnabled(true);
|
calImportTerms->setEnabled(true);
|
||||||
|
calImportMeas->setEnabled(true);
|
||||||
saveCal->setEnabled(true);
|
saveCal->setEnabled(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user