diff --git a/software/gui.py b/software/gui.py index c4e21c9..2566aac 100644 --- a/software/gui.py +++ b/software/gui.py @@ -641,7 +641,7 @@ class MainWindow(QMainWindow): def setup_graph(self): self.graph_widget = pg.PlotWidget() self.graph_widget.setLabel("left", "ADC value") - self.graph_widget.setLabel("bottom", "Sample") + self.graph_widget.setLabel("bottom", "Distance", units="km") self.graph_widget.showGrid(x=True, y=True) self.graph_curve = self.graph_widget.plot( @@ -784,7 +784,18 @@ class MainWindow(QMainWindow): self.graph_curve.setData([]) return - x = list(range(len(self.data))) + LS = 200000 # km/s + + period_us = self.pulse_period / self.dac_clk + max_distance_km = LS * period_us / 10e6 + + sample_count = len(self.data) + + x = [ + i * max_distance_km / sample_count + for i in range(sample_count) + ] + self.graph_curve.setData(x, self.data) def update_reference_graph(self):