diff --git a/Software/PC_Application/Calibration/calibration.cpp b/Software/PC_Application/Calibration/calibration.cpp index 875af02..a68667c 100644 --- a/Software/PC_Application/Calibration/calibration.cpp +++ b/Software/PC_Application/Calibration/calibration.cpp @@ -621,6 +621,55 @@ std::vector Calibration::getErrorTermTraces() return traces; } +std::vector Calibration::getMeasurementTraces() +{ + std::vector traces; + for(auto m : measurements) { + auto info = getMeasurementInfo(m.first); + if(info.points > 0) { + vector 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(p.real_S11, p.imag_S11); + } else if(prefix == "S12") { + d.S = complex(p.real_S12, p.imag_S12); + } else if(prefix == "S21") { + d.S = complex(p.real_S21, p.imag_S21); + } else { + d.S = complex(p.real_S22, p.imag_S22); + } + t->addData(d); + } + traces.push_back(t); + } + } + } + return traces; +} + bool Calibration::openFromFile(QString filename) { if(filename.isEmpty()) { diff --git a/Software/PC_Application/Calibration/calibration.h b/Software/PC_Application/Calibration/calibration.h index 87d68a1..47b496d 100644 --- a/Software/PC_Application/Calibration/calibration.h +++ b/Software/PC_Application/Calibration/calibration.h @@ -80,6 +80,7 @@ public: } std::vector getErrorTermTraces(); + std::vector getMeasurementTraces(); bool openFromFile(QString filename = QString()); bool saveToFile(QString filename = QString()); diff --git a/Software/PC_Application/Calibration/calkitdialog.ui b/Software/PC_Application/Calibration/calkitdialog.ui index a457b25..4048d94 100644 --- a/Software/PC_Application/Calibration/calkitdialog.ui +++ b/Software/PC_Application/Calibration/calkitdialog.ui @@ -32,7 +32,7 @@ - 1 + 0 @@ -112,7 +112,7 @@ - <html><head/><body><p>L0 [10<span style=" vertical-align:super;">-12</span>F]:</p></body></html> + <html><head/><body><p>L0 [10<span style=" vertical-align:super;">-12</span>H]:</p></body></html> @@ -122,7 +122,7 @@ - <html><head/><body><p>L1 [10<span style=" vertical-align:super;">-24</span>F/Hz]:</p></body></html> + <html><head/><body><p>L1 [10<span style=" vertical-align:super;">-24</span>H/Hz]:</p></body></html> @@ -132,7 +132,7 @@ - <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> + <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> @@ -142,7 +142,7 @@ - <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> + <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> @@ -288,7 +288,7 @@ - C0 [10<sup>-45</sup>F/Hz<sup>3</sup>]: + <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> @@ -845,17 +845,17 @@ + + SIUnitEdit + QLineEdit +
CustomWidgets/siunitedit.h
+
TouchstoneImport QWidget
CustomWidgets/touchstoneimport.h
1
- - SIUnitEdit - QLineEdit -
CustomWidgets/siunitedit.h
-
open_Z0 @@ -933,10 +933,10 @@ - + + - diff --git a/Software/PC_Application/Traces/tracemodel.cpp b/Software/PC_Application/Traces/tracemodel.cpp index e90eab7..e30d663 100644 --- a/Software/PC_Application/Traces/tracemodel.cpp +++ b/Software/PC_Application/Traces/tracemodel.cpp @@ -97,7 +97,7 @@ QVariant TraceModel::data(const QModelIndex &index, int role) const return QVariant(); } } else if (index.column() == 1) { - if (role == Qt::DecorationRole && !traces[index.row()]->isTouchstone()) { + if (role == Qt::DecorationRole && traces[index.row()]->isLive()) { if (traces[index.row()]->isPaused()) { return QIcon(":/icons/pause.svg"); } else { diff --git a/Software/PC_Application/VNA/vna.cpp b/Software/PC_Application/VNA/vna.cpp index 132fa97..96ab4fb 100644 --- a/Software/PC_Application/VNA/vna.cpp +++ b/Software/PC_Application/VNA/vna.cpp @@ -119,13 +119,6 @@ VNA::VNA(AppWindow *window) 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"); connect(calEditKit, &QAction::triggered, [=](){ 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()); // Tools menu @@ -319,7 +328,8 @@ VNA::VNA(AppWindow *window) cbEnableCal->setCheckState(Qt::CheckState::Unchecked); cbType->blockSignals(false); cbEnableCal->blockSignals(false); - calImport->setEnabled(false); + calImportTerms->setEnabled(false); + calImportMeas->setEnabled(false); saveCal->setEnabled(false); }); connect(calDisable, &QAction::triggered, this, &VNA::DisableCalibration); @@ -335,7 +345,8 @@ VNA::VNA(AppWindow *window) cbEnableCal->setCheckState(Qt::CheckState::Checked); cbType->blockSignals(false); cbEnableCal->blockSignals(false); - calImport->setEnabled(true); + calImportTerms->setEnabled(true); + calImportMeas->setEnabled(true); saveCal->setEnabled(true); });