Skip to content

Commit

Permalink
reduce inter-segment delay, add integration test for segmented sweep
Browse files Browse the repository at this point in the history
  • Loading branch information
jankae committed Oct 24, 2023
1 parent ccb71f9 commit 503d689
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Software/Integrationtests/tests/TestBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class TestBase(unittest.TestCase):
def setUp(self):
self.gui = subprocess.Popen([defs.GUI_PATH, '-p', '19544'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
self.gui = subprocess.Popen([defs.GUI_PATH, '-p', '19544', '--reset-preferences'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

# wait for the SCPI server to become available
timeout = time.time() + 3;
Expand Down Expand Up @@ -40,4 +40,4 @@ def tearDown(self):
except subprocess.TimeoutExpired:
self.gui.kill()



6 changes: 3 additions & 3 deletions Software/Integrationtests/tests/TestSASweep.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ def test_sweep_zerospan(self):
port2 = self.vna.parse_SA_trace_data(self.vna.query(":SA:TRACE:DATA? PORT2"))

self.assertEqual(port1[0][0], 0.0)
self.assertGreater(port1[-1][0], 4.5)
self.assertGreater(port1[-1][0], 4)
self.assertLess(port1[-1][0], 5)
self.assertEqual(port2[0][0], 0.0)
self.assertGreater(port2[-1][0], 4.5)
self.assertGreater(port2[-1][0], 4)
self.assertLess(port2[-1][0], 5)

# No signal present, signal level should be very low
Expand Down Expand Up @@ -95,4 +95,4 @@ def test_tracking_generator(self):
# Reported level on port1 should match normalization very closely now
port1 = self.vna.parse_SA_trace_data(self.vna.query(":SA:TRACE:DATA? PORT1"))
self.assertTrace_dB(port1, -10, 1)


16 changes: 15 additions & 1 deletion Software/Integrationtests/tests/TestVNASweep.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,18 @@ def test_fast_single_sweeps(self):
for i in range(10):
# Change something irrelevant (to force reconfiguration of device)
self.vna.cmd(":VNA:FREQuency:START "+str(1000000+i))
self.waitSweepTimeout(2)
self.waitSweepTimeout(2)

def test_segmented_sweep(self):
self.vna.cmd(":DEV:MODE VNA")
self.vna.cmd(":VNA:SWEEP FREQUENCY")
self.vna.cmd(":VNA:STIM:LVL -10")
self.vna.cmd(":VNA:ACQ:IFBW 50000")
self.vna.cmd(":VNA:ACQ:AVG 1")
self.vna.cmd(":VNA:ACQ:POINTS 10000")
self.vna.cmd(":VNA:FREQuency:START 1000000")
self.vna.cmd(":VNA:FREQuency:STOP 6000000000")
self.waitSweepTimeout(10)

S11 = self.vna.parse_VNA_trace_data(self.vna.query(":VNA:TRACE:DATA? S11"))
self.assertEqual(len(S11), 10000)
1 change: 1 addition & 0 deletions Software/PC_Application/LibreVNA-GUI/Traces/traceplot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ QString TracePlot::TypeToString(Type t)
case Type::SmithChart: return "Smith Chart";
case Type::Waterfall: return "Waterfall";
case Type::XYPlot: return "XY Plot";
default: return "Invalid";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,7 @@ bool TraceXYPlot::markerVisible(double x)

void TraceXYPlot::traceDropped(Trace *t, QPoint position)
{
Q_UNUSED(position)
if(!supported(t)) {
// needs to switch to a different domain for the graph
if(!InformationBox::AskQuestion("X Axis Domain Change", "You dropped a trace that is not supported with the currently selected X axis domain."
Expand Down
6 changes: 3 additions & 3 deletions Software/PC_Application/LibreVNA-GUI/VNA/vna.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ void VNA::NewDatapoint(DeviceDriver::VNAMeasurement m)
} else {
settings.activeSegment = 0;
}
SettingsChanged(false);
SettingsChanged(false, 0);
}
}

Expand All @@ -954,9 +954,9 @@ void VNA::UpdateAverageCount()
lAverages->setText(QString::number(average.getLevel()) + "/");
}

void VNA::SettingsChanged(bool resetTraces)
void VNA::SettingsChanged(bool resetTraces, int delay)
{
configurationTimer.start(100);
configurationTimer.start(delay);
changingSettings = true;
configurationTimerResetTraces = resetTraces;
if(resetTraces) {
Expand Down
2 changes: 1 addition & 1 deletion Software/PC_Application/LibreVNA-GUI/VNA/vna.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private slots:
bool CalibrationMeasurementActive() { return calWaitFirst || calMeasuring; }
void SetupSCPI();
void UpdateAverageCount();
void SettingsChanged(bool resetTraces = true);
void SettingsChanged(bool resetTraces = true, int delay = 100);
void ConstrainAndUpdateFrequencies();
void LoadSweepSettings();
void StoreSweepSettings();
Expand Down
2 changes: 1 addition & 1 deletion Software/PC_Application/LibreVNA-GUI/preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class Preferences : public Savable {
{&Startup.SA.detector, "Startup.SA.detector", 0},
{&Startup.SA.averaging, "Startup.SA.averaging", 1},
{&Acquisition.alwaysExciteAllPorts, "Acquisition.alwaysExciteBothPorts", true},
{&Acquisition.allowSegmentedSweep, "Acquisition.allowSegmentedSweep", false},
{&Acquisition.allowSegmentedSweep, "Acquisition.allowSegmentedSweep", true},
{&Acquisition.useMedianAveraging, "Acquisition.useMedianAveraging", false},
{&Acquisition.fullSpanManual, "Acquisition.fullSpanManual", false},
{&Acquisition.fullSpanStart, "Acquisition.fullSpanStart", 0.0},
Expand Down

0 comments on commit 503d689

Please sign in to comment.