def setup(self, win):
        win.setWindowTitle("Acconeer presence detection example")

        self.env_plot = win.addPlot(title="Burst mean of Envelope²")
        self.env_plot.showGrid(x=True, y=True)
        self.env_plot.setLabel("bottom", "Depth (m)")
        self.env_curve = self.env_plot.plot(pen=example_utils.pg_pen_cycler(0))
        self.env_smooth_max = example_utils.SmoothMax(self.config.sweep_rate /
                                                      10)

        win.nextRow()
        move_hist_plot = win.addPlot(title="Changes in received power")
        move_hist_plot.showGrid(x=True, y=True)
        move_hist_plot.setLabel("bottom", "Time(s)")
        move_hist_plot.setXRange(-5, 0)
        move_hist_plot.setYRange(0, 1)
        self.move_hist_curve = move_hist_plot.plot(
            pen=example_utils.pg_pen_cycler(0))
        self.move_hist_smooth_max = example_utils.SmoothMax(
            self.config.sweep_rate / 10)
        limit_pen = pg.mkPen("k", width=2.5, style=QtCore.Qt.DashLine)
        limit_line = pg.InfiniteLine(self.threshold, angle=0, pen=limit_pen)
        move_hist_plot.addItem(limit_line)
        self.move_hist_text = pg.TextItem(color=pg.mkColor("k"),
                                          anchor=(0.5, 0))
        self.move_hist_text.setPos(-2.5, 0.95)
        move_hist_plot.addItem(self.move_hist_text)
Ejemplo n.º 2
0
    def setup(self, win):
        win.resize(1600, 1000)
        win.setWindowTitle("Track distance example")

        # Plot amplitude from data and the tracked distance
        self.distance_plot = win.addPlot(row=0, col=0, colspan=2)
        self.distance_plot.showGrid(x=True, y=True)
        self.distance_plot.setLabel("left", "Amplitude")
        self.distance_plot.setLabel("bottom", "Depth (m)")
        self.distance_curve = self.distance_plot.plot(pen=example_utils.pg_pen_cycler(0))
        pen = example_utils.pg_pen_cycler(1)
        pen.setStyle(QtCore.Qt.DashLine)
        self.distance_inf_line = pg.InfiniteLine(pen=pen)
        self.distance_plot.addItem(self.distance_inf_line)

        # Dynamic plot to show breath over time
        # self.distance_over_time_plot = win.addPlot(row=1, col=0)
        # self.distance_over_time_plot.showGrid(x=True, y=True)
        # self.distance_over_time_plot.setLabel("left", "Distance")
        # self.distance_over_time_plot.setLabel("bottom", "Time (s)")
        # self.distance_over_time_curve = self.distance_over_time_plot.plot(
        #     pen=example_utils.pg_pen_cycler(0))
        # self.distance_over_time_plot.setYRange(-8, 8)

        # Plot for tracked distance over time
        # self.distance_over_time_plot2 = win.addPlot(row=1, col=1)
        # self.distance_over_time_plot2.showGrid(x=True, y=True)
        # self.distance_over_time_plot2.setLabel("left", "Distance")
        # self.distance_over_time_plot2.setLabel("bottom", "Time (s)")
        # self.distance_over_time_curve2 = self.distance_over_time_plot2.plot(
        #     pen=example_utils.pg_pen_cycler(0))
        # self.distance_over_time_plot2.setYRange(0.4, 1.5)

        self.smooth_max = example_utils.SmoothMax(self.config.sweep_rate)
        self.first = True
    def setup(self, win):
        self.plots = []
        self.curves = []
        for i in range(self.num_depths):
            title = "{:.0f} cm".format(100 * self.depths[i])
            plot = win.addPlot(row=0, col=i, title=title)
            plot.showGrid(x=True, y=True)
            plot.setYRange(-2**15, 2**15)
            plot.hideAxis("left")
            plot.hideAxis("bottom")
            plot.plot(np.arange(self.num_subsweeps),
                      np.zeros(self.num_subsweeps))
            curve = plot.plot(pen=example_utils.pg_pen_cycler())
            self.plots.append(plot)
            self.curves.append(curve)

        self.ft_plot = win.addPlot(row=1, col=0, colspan=self.num_depths)
        self.ft_im = pg.ImageItem(autoDownsample=True)
        self.ft_im.setLookupTable(example_utils.pg_mpl_cmap("viridis"))
        self.ft_plot.addItem(self.ft_im)
        self.ft_plot.setLabel("bottom", "Depth (cm)")
        self.ft_plot.getAxis("bottom").setTickSpacing(6 * self.stepsize, 6)

        self.smooth_max = example_utils.SmoothMax(
            self.smooth_max_f,
            tau_grow=0,
            tau_decay=0.5,
            hysteresis=0.1,
        )

        self.setup_is_done = True
        self.update_processing_config()
Ejemplo n.º 4
0
    def setup(self, win):
        win.resize(800, 600)
        win.setWindowTitle("Acconeer sleep breathing estimation example")

        phi_title = "Breathing motion (detection range: {} m to {} m)" \
                    .format(*self.config.range_interval)
        self.phi_plot = win.addPlot(title=phi_title)
        self.phi_plot.showGrid(x=True, y=True)
        self.phi_plot.setLabel("left", "Amplitude")
        self.phi_plot.setLabel("bottom", "Samples")
        self.phi_plot.addLegend()
        self.filt_phi_curve = self.phi_plot.plot(
                pen=example_utils.pg_pen_cycler(0),
                name="Filtered",
                )
        self.raw_phi_curve = self.phi_plot.plot(
                pen=example_utils.pg_pen_cycler(1),
                name="Raw",
                )

        win.nextRow()
        self.spect_plot = win.addPlot(title="Power spectrum")
        self.spect_plot.showGrid(x=True, y=True)
        self.spect_plot.setLabel("left", "Power")
        self.spect_plot.setLabel("bottom", "Frequency (Hz)")
        self.spect_curve = self.spect_plot.plot(pen=example_utils.pg_pen_cycler(1))
        self.spect_smax = example_utils.SmoothMax(self.config.sweep_rate / 15)
        self.spect_dft_inf_line = pg.InfiniteLine(pen=example_utils.pg_pen_cycler(1, "--"))
        self.spect_plot.addItem(self.spect_dft_inf_line)
        self.spect_est_inf_line = pg.InfiniteLine(pen=example_utils.pg_pen_cycler(0, "--"))
        self.spect_plot.addItem(self.spect_est_inf_line)
        self.spect_plot.setXRange(0, 1)
        self.spect_plot.setYRange(0, 1)
        self.spect_text_item = pg.TextItem("Initiating...", anchor=(0.5, 0.5), color="k")
        self.spect_text_item.setPos(0.5, 0.5)
        self.spect_plot.addItem(self.spect_text_item)

        win.nextRow()
        self.fest_plot = win.addPlot(title="Breathing estimation history")
        self.fest_plot.showGrid(x=True, y=True)
        self.fest_plot.setLabel("left", "Frequency (Hz)")
        self.fest_plot.setLabel("bottom", "Samples")
        self.fest_plot.addLegend()
        self.fest_curve = self.fest_plot.plot(
                pen=example_utils.pg_pen_cycler(0),
                name="Breathing est.",
                )
        self.fest_dft_curve = self.fest_plot.plot(
                pen=example_utils.pg_pen_cycler(1),
                name="DFT est.",
                )
        self.fest_plot.setXRange(0, 1)
        self.fest_plot.setYRange(0, 0.5)
        self.fest_text_item = pg.TextItem(anchor=(0, 0), color="k")
        self.fest_text_item.setPos(0, 0.5)
        self.fest_plot.addItem(self.fest_text_item)
Ejemplo n.º 5
0
    def __init__(self, sensor_config, processing_config):
        self.history_len = processing_config["image_buffer"]["value"]

        pd_config = presence_detection_sparse.get_processing_config()
        processor_class = presence_detection_sparse.PresenceDetectionSparseProcessor
        self.pd_processors = [processor_class(sensor_config, pd_config)]

        self.smooth_max = example_utils.SmoothMax(sensor_config.sweep_rate)

        self.sweep_index = 0
Ejemplo n.º 6
0
    def setup(self, win):
        win.resize(800, 600)
        win.setWindowTitle("Acconeer phase tracking example")

        self.abs_plot = win.addPlot(row=0, col=0)
        self.abs_plot.showGrid(x=True, y=True)
        self.abs_plot.setLabel("left", "Amplitude")
        self.abs_plot.setLabel("bottom", "Depth (m)")
        self.abs_curve = self.abs_plot.plot(pen=example_utils.pg_pen_cycler(0))
        pen = example_utils.pg_pen_cycler(1)
        pen.setStyle(QtCore.Qt.DashLine)
        self.abs_inf_line = pg.InfiniteLine(pen=pen)
        self.abs_plot.addItem(self.abs_inf_line)

        self.arg_plot = win.addPlot(row=1, col=0)
        self.arg_plot.showGrid(x=True, y=True)
        self.arg_plot.setLabel("bottom", "Depth (m)")
        self.arg_plot.setLabel("left", "Phase")
        self.arg_plot.setYRange(-np.pi, np.pi)
        self.arg_plot.getAxis("left").setTicks(example_utils.pg_phase_ticks)
        self.arg_curve = self.arg_plot.plot(pen=example_utils.pg_pen_cycler(0))
        self.arg_inf_line = pg.InfiniteLine(pen=pen)
        self.arg_plot.addItem(self.arg_inf_line)

        self.iq_plot = win.addPlot(row=1, col=1, title="IQ at line")
        example_utils.pg_setup_polar_plot(self.iq_plot, 0.5)
        self.iq_curve = self.iq_plot.plot(pen=example_utils.pg_pen_cycler())
        self.iq_scatter = pg.ScatterPlotItem(
            brush=pg.mkBrush(example_utils.color_cycler()),
            size=15,
        )
        self.iq_plot.addItem(self.iq_scatter)

        self.hist_plot = win.addPlot(row=0, col=1, colspan=2)
        self.hist_plot.showGrid(x=True, y=True)
        self.hist_plot.setLabel("bottom", "Time (s)")
        self.hist_plot.setLabel("left", "Tracking (mm)")
        self.hist_curve = self.hist_plot.plot(
            pen=example_utils.pg_pen_cycler())
        self.hist_plot.setYRange(-5, 5)

        self.hist_zoom_plot = win.addPlot(row=1, col=2)
        self.hist_zoom_plot.showGrid(x=True, y=True)
        self.hist_zoom_plot.setLabel("bottom", "Time (s)")
        self.hist_zoom_plot.setLabel("left", "Tracking (mm)")
        self.hist_zoom_curve = self.hist_zoom_plot.plot(
            pen=example_utils.pg_pen_cycler())
        self.hist_zoom_plot.setYRange(-0.5, 0.5)

        self.smooth_max = example_utils.SmoothMax(self.config.sweep_rate)
        self.first = True
    def setup(self, win):
        win.setWindowTitle("Acconeer obstacle detection example")

        self.env_ax = win.addPlot(row=0, col=0, title="Envelope and max FFT")
        self.env_ax.setLabel("bottom", "Depth (cm)")
        self.env_ax.setXRange(*(self.config.range_interval * 100))
        self.env_ax.showGrid(True, True)
        self.env_ax.addLegend()
        self.env_ax.setYRange(0, 0.1)

        self.env_ampl = self.env_ax.plot(pen=example_utils.pg_pen_cycler(0),
                                         name="Envelope")
        self.fft_max = self.env_ax.plot(pen=example_utils.pg_pen_cycler(
            1, "--"),
                                        name="FFT max")

        self.peak_dist_text = pg.TextItem(color="k", anchor=(0, 1))
        self.env_ax.addItem(self.peak_dist_text)
        self.peak_dist_text.setPos(self.config.range_start * 100, 0)
        self.peak_dist_text.setZValue(3)

        self.env_peak_vline = pg.InfiniteLine(pos=0,
                                              angle=90,
                                              pen=pg.mkPen(
                                                  width=2,
                                                  style=QtCore.Qt.DotLine))
        self.env_ax.addItem(self.env_peak_vline)

        self.obstacle_ax = win.addPlot(row=1, col=0, title="Obstacle map")
        self.obstacle_im = pg.ImageItem()
        self.obstacle_ax.setLabel("bottom", "Velocity (cm/s)")
        self.obstacle_ax.setLabel("left", "Distance (cm)")
        self.obstacle_im.setLookupTable(example_utils.pg_mpl_cmap("viridis"))
        self.obstacle_ax.addItem(self.obstacle_im)

        self.obstacle_ax.setXRange(-self.max_velocity, self.max_velocity)
        self.obstacle_ax.setYRange(*self.config.range_interval * 100)

        self.obstacle_peak = pg.ScatterPlotItem(brush=pg.mkBrush("k"), size=15)
        self.obstacle_ax.addItem(self.obstacle_peak)

        self.peak_fft_text = pg.TextItem(color="w", anchor=(0, 1))
        self.obstacle_ax.addItem(self.peak_fft_text)
        self.peak_fft_text.setPos(-self.max_velocity,
                                  self.config.range_start * 100)

        self.smooth_max = example_utils.SmoothMax(self.config.sweep_rate,
                                                  tau_decay=1,
                                                  tau_grow=0.2)
Ejemplo n.º 8
0
    def setup(self, win):
        win.setWindowTitle("Acconeer presence detection example")

        dashed_pen = pg.mkPen("k", width=2.5, style=QtCore.Qt.DashLine)

        self.move_plot = win.addPlot(title="Movement")
        self.move_plot.showGrid(x=True, y=True)
        self.move_plot.setLabel("bottom", "Depth (m)")
        self.move_curve = self.move_plot.plot(pen=example_utils.pg_pen_cycler())
        self.move_smooth_max = example_utils.SmoothMax(self.config.sweep_rate)

        self.move_depth_line = pg.InfiniteLine(pen=dashed_pen)
        self.move_depth_line.hide()
        self.move_plot.addItem(self.move_depth_line)

        win.nextRow()

        move_hist_plot = win.addPlot(title="Movement history")
        move_hist_plot.showGrid(x=True, y=True)
        move_hist_plot.setLabel("bottom", "Time (s)")
        move_hist_plot.setXRange(-5, 0)
        move_hist_plot.setYRange(0, 1)
        self.move_hist_curve = move_hist_plot.plot(pen=example_utils.pg_pen_cycler())
        limit_line = pg.InfiniteLine(self.movement_limit, angle=0, pen=dashed_pen)
        move_hist_plot.addItem(limit_line)

        self.present_html_format = '<div style="text-align: center">' \
                                   '<span style="color: #FFFFFF;font-size:16pt;">' \
                                   '{}</span></div>'
        present_html = self.present_html_format.format("Presence detected!")
        not_present_html = '<div style="text-align: center">' \
                           '<span style="color: #FFFFFF;font-size:16pt;">' \
                           '{}</span></div>'.format("No presence detected")
        self.present_text_item = pg.TextItem(
            html=present_html,
            fill=pg.mkColor(255, 140, 0),
            anchor=(0.5, 0),
            )
        self.not_present_text_item = pg.TextItem(
            html=not_present_html,
            fill=pg.mkColor("b"),
            anchor=(0.5, 0),
            )
        self.present_text_item.setPos(-2.5, 0.95)
        self.not_present_text_item.setPos(-2.5, 0.95)
        move_hist_plot.addItem(self.present_text_item)
        move_hist_plot.addItem(self.not_present_text_item)
        self.present_text_item.hide()
Ejemplo n.º 9
0
    def setup(self, win):
        win.setWindowTitle("Acconeer distance peak example")
        self.plot = win.addPlot(title="Peaks")
        self.plot.showGrid(x=True, y=True)
        self.plot.setLabel("bottom", "Depth (m)")
        self.plot.setLabel("left", "Amplitude")
        self.plot.setXRange(*self.config.range_interval)

        self.scatter = pg.ScatterPlotItem(size=15)
        self.plot.addItem(self.scatter)

        self.smooth_max = example_utils.SmoothMax(
            self.config.sweep_rate,
            hysteresis=0.6,
            tau_decay=3,
        )
    def setup(self, win):
        win.setWindowTitle("Acconeer envelope example")

        self.plot = win.addPlot(title="Envelope")
        self.plot.showGrid(x=True, y=True)
        self.plot.setLabel("bottom", "Depth (m)")
        self.plot.setLabel("left", "Amplitude")

        self.curves = []
        for i in range(len(self.config.sensor)):
            pen = example_utils.pg_pen_cycler(i)
            curve = self.plot.plot(pen=pen)
            self.curves.append(curve)

        self.xs = np.linspace(*self.config.range_interval, self.num_points)
        self.smooth_max = example_utils.SmoothMax(self.config.sweep_rate)
Ejemplo n.º 11
0
    def setup(self, win):
        win.setWindowTitle("Acconeer power bins example")

        self.plot = win.addPlot(title="Power bins")
        self.plot.showGrid(x=True, y=True)
        self.plot.setLabel("bottom", "Depth (m)")
        self.plot.setLabel("left", "Amplitude")
        self.plot.setYRange(0, 1)

        self.bar_graph = pg.BarGraphItem(
            x=[],
            height=[],
            width=0,
            brush=pg.mkBrush(example_utils.color_cycler()),
        )

        self.plot.addItem(self.bar_graph)

        self.smooth_max = example_utils.SmoothMax(self.sensor_config.sweep_rate)
    def setup(self, win):
        win.setWindowTitle("Acconeer power bin example")

        self.plot = win.addPlot(title="Power bin")
        self.plot.showGrid(x=True, y=True)
        self.plot.setLabel("bottom", "Depth (m)")
        self.plot.setLabel("left", "Amplitude")

        self.curves = []
        for i in range(len(self.config.sensor)):
            pen = example_utils.pg_pen_cycler(i)
            curve = self.plot.plot(pen=pen,
                                   symbol="o",
                                   symbolPen="k",
                                   symbolBrush=pg.mkBrush(
                                       example_utils.color_cycler(i)))
            self.curves.append(curve)

        self.smooth_max = example_utils.SmoothMax(self.config.sweep_rate)
Ejemplo n.º 13
0
    def __init__(self, sensor_config, processing_config, session_info):
        num_sensors = len(sensor_config.sensor)
        num_depths = len(get_range_depths(sensor_config, session_info))
        history_len = processing_config["image_buffer"]["value"]

        pd_config = presence_detection_sparse.get_processing_config()
        processor_class = presence_detection_sparse.PresenceDetectionSparseProcessor

        try:
            self.pd_processors = [
                processor_class(sensor_config, pd_config, session_info)
            ]
        except AssertionError:
            self.pd_processors = None

        self.smooth_max = example_utils.SmoothMax(sensor_config.sweep_rate)

        self.data_history = np.zeros([history_len, num_sensors, num_depths])
        self.presence_history = np.zeros(
            [history_len, num_sensors, num_depths])

        self.sweep_index = 0
Ejemplo n.º 14
0
    def setup(self, win):
        win.setWindowTitle("Acconeer sparse example")

        self.plots = []
        self.scatters = []
        self.smooth_maxs = []
        for sensor_id in self.config.sensor:
            if len(self.config.sensor) > 1:
                plot = win.addPlot(title="Sensor {}".format(sensor_id))
            else:
                plot = win.addPlot()
            plot.showGrid(x=True, y=True)
            plot.setLabel("bottom", "Depth (m)")
            plot.setLabel("left", "Amplitude")
            plot.setYRange(-2**15, 2**15)
            scatter = pg.ScatterPlotItem(size=10)
            plot.addItem(scatter)
            win.nextRow()

            self.plots.append(plot)
            self.scatters.append(scatter)
            self.smooth_maxs.append(example_utils.SmoothMax(self.config.sweep_rate))
Ejemplo n.º 15
0
    def setup(self, win):
        win.setWindowTitle("Acconeer IQ example")

        self.ampl_plot = win.addPlot(title="IQ")
        self.ampl_plot.showGrid(x=True, y=True)
        self.ampl_plot.setLabel("bottom", "Depth (m)")
        self.ampl_plot.setLabel("left", "Amplitude")
        win.nextRow()
        self.phase_plot = win.addPlot()
        self.phase_plot.showGrid(x=True, y=True)
        self.phase_plot.setLabel("bottom", "Depth (m)")
        self.phase_plot.setLabel("left", "Phase")
        self.phase_plot.setYRange(-np.pi, np.pi)
        self.phase_plot.getAxis("left").setTicks(example_utils.pg_phase_ticks)

        self.ampl_curves = []
        self.phase_curves = []
        for i in range(len(self.config.sensor)):
            pen = example_utils.pg_pen_cycler(i)
            self.ampl_curves.append(self.ampl_plot.plot(pen=pen))
            self.phase_curves.append(self.phase_plot.plot(pen=pen))

        self.xs = np.linspace(*self.config.range_interval, self.num_points)
        self.smooth_max = example_utils.SmoothMax(self.config.sweep_rate)
def main():
    args = example_utils.ExampleArgumentParser(num_sens=1).parse_args()
    example_utils.config_logging(args)

    if args.socket_addr:
        client = JSONClient(args.socket_addr)
    else:
        port = args.serial_port or example_utils.autodetect_serial_port()
        client = RegClient(port)

    config = configs.EnvelopeServiceConfig()
    config.sensor = args.sensors
    config.range_interval = [0.2, 0.6]
    config.sweep_rate = 60
    config.gain = 0.65

    info = client.setup_session(config)
    num_points = info["data_length"]
    xs = np.linspace(*config.range_interval, num_points)
    num_hist = 2 * config.sweep_rate

    hist_data = np.zeros([num_hist, num_points])
    hist_max = np.zeros(num_hist)
    smooth_max = example_utils.SmoothMax(config.sweep_rate)

    app = QtGui.QApplication([])
    pg.setConfigOption("background", "w")
    pg.setConfigOption("foreground", "k")
    pg.setConfigOptions(antialias=True)
    win = pg.GraphicsLayoutWidget()
    win.closeEvent = lambda _: interrupt_handler.force_signal_interrupt()
    win.setWindowTitle("Acconeer PyQtGraph example")

    env_plot = win.addPlot(title="Envelope")
    env_plot.showGrid(x=True, y=True)
    env_plot.setLabel("bottom", "Depth (m)")
    env_plot.setLabel("left", "Amplitude")
    env_curve = env_plot.plot(pen=pg.mkPen("k", width=2))

    win.nextRow()
    hist_plot = win.addPlot()
    hist_plot.setLabel("bottom", "Time (s)")
    hist_plot.setLabel("left", "Depth (m)")
    hist_image_item = pg.ImageItem()
    hist_image_item.translate(-2, config.range_start)
    hist_image_item.scale(2 / num_hist, config.range_length / num_points)
    hist_plot.addItem(hist_image_item)

    # try to get a colormap from matplotlib
    try:
        hist_image_item.setLookupTable(example_utils.pg_mpl_cmap("viridis"))
    except ImportError:
        pass

    win.show()

    interrupt_handler = example_utils.ExampleInterruptHandler()
    print("Press Ctrl-C to end session")

    client.start_streaming()

    while not interrupt_handler.got_signal:
        info, sweep = client.get_next()

        hist_data = np.roll(hist_data, -1, axis=0)
        hist_data[-1] = sweep
        hist_max = np.roll(hist_max, -1)
        hist_max[-1] = np.max(sweep)
        y_max = smooth_max.update(np.amax(hist_max))
        env_curve.setData(xs, sweep)
        env_plot.setYRange(0, y_max)
        hist_image_item.updateImage(hist_data, levels=(0, y_max))

        app.processEvents()

    print("Disconnecting...")
    app.closeAllWindows()
    client.disconnect()
Ejemplo n.º 17
0
    def setup(self, win):
        win.setWindowTitle("Acconeer Button Press Example")

        self.limit_lines = []
        dashed_pen = pg.mkPen("k", width=2.5, style=QtCore.Qt.DashLine)

        self.sign_hist_plot = win.addPlot(title="Signal history")
        self.sign_hist_plot.addLegend()
        self.sign_hist_plot.showGrid(x=True, y=True)
        self.sign_hist_plot.setLabel("bottom", "Time (s)")
        self.sign_hist_plot.setXRange(-HISTORY_LENGTH_S, 0)
        self.sign_hist_plot.setYRange(0, OUTPUT_MAX_SIGNAL)
        self.sign_hist_curve = self.sign_hist_plot.plot(
            pen=example_utils.pg_pen_cycler(0),
            name="Envelope signal",
        )
        self.sign_lp_hist_curve = self.sign_hist_plot.plot(
            pen=example_utils.pg_pen_cycler(1),
            name="Filtered envelope signal",
        )

        win.nextRow()

        self.rel_dev_hist_plot = win.addPlot(
            title="Relative deviation history")
        self.rel_dev_hist_plot.showGrid(x=True, y=True)
        self.rel_dev_hist_plot.setLabel("bottom", "Time (s)")
        self.rel_dev_hist_plot.setXRange(-HISTORY_LENGTH_S, 0)
        self.rel_dev_hist_plot.setYRange(0, OUTPUT_MAX_REL_DEV)
        self.rel_dev_lp_hist_curve = self.rel_dev_hist_plot.plot(
            pen=example_utils.pg_pen_cycler(0),
            name="Relative deviation",
        )

        self.detection_dots = self.rel_dev_hist_plot.plot(
            pen=None,
            symbol='o',
            symbolSize=20,
            symbolBrush=example_utils.color_cycler(1),
            name="Detections",
        )
        self.rel_dev_hist_plot.addItem(self.detection_dots)

        limit_line = pg.InfiniteLine(angle=0, pen=dashed_pen)
        self.rel_dev_hist_plot.addItem(limit_line)

        self.limit_lines.append(limit_line)

        self.detection_html_format = '<div style="text-align: center">' \
                                     '<span style="color: #FFFFFF;font-size:16pt;">' \
                                     '{}</span></div>'
        detection_html = self.detection_html_format.format(
            "Button press detected!")

        self.detection_text_item = pg.TextItem(
            html=detection_html,
            fill=pg.mkColor(255, 140, 0),
            anchor=(0.5, 0),
        )

        self.detection_text_item.setPos(-HISTORY_LENGTH_S / 2,
                                        0.95 * OUTPUT_MAX_REL_DEV)
        self.rel_dev_hist_plot.addItem(self.detection_text_item)
        self.detection_text_item.hide()

        self.smooth_max_signal = example_utils.SmoothMax(
            self.sensor_config.sweep_rate,
            hysteresis=0.6,
            tau_decay=3,
        )

        self.smooth_max_rel_dev = example_utils.SmoothMax(
            self.sensor_config.sweep_rate,
            hysteresis=0.6,
            tau_decay=3,
        )

        self.setup_is_done = True
        self.update_processing_config()
Ejemplo n.º 18
0
    def update(self, data):
        xstart = data["x_mm"][0]
        xend = data["x_mm"][-1]
        xdim = data["hist_env"].shape[1]
        num_sensors = data["num_sensors"]

        if data["sweep"] <= 1:
            self.env_plot_max_y = np.zeros(self.num_sensors)
            self.envelope_plot_window.setXRange(xstart, xend)
            self.phase_plot_window.setXRange(xstart, xend)
            self.phase_plot_window.setYRange(-1.1, 1.1)

            self.smooth_envelope = example_utils.SmoothMax(
                int(self.sensor_config.sweep_rate),
                tau_decay=1,
                tau_grow=0.2
                )

            for s in range(num_sensors):
                self.peak_text.setPos(xstart, 0)

                yax = self.hist_plot_images[s].getAxis("left")
                y = np.round(np.arange(0, xdim+xdim/9, xdim/9))
                labels = np.round(np.arange(xstart, xend+(xend-xstart)/9,
                                  (xend-xstart)/9))
                ticks = [list(zip(y, labels))]
                yax.setTicks(ticks)
                self.hist_plot_images[s].setYRange(0, xdim)

                s_buff = data["hist_env"].shape[2]
                t_buff = s_buff / data["sensor_config"].sweep_rate
                tax = self.hist_plot_images[s].getAxis("bottom")
                t = np.round(np.arange(0, s_buff + 1, s_buff / min(10 / self.num_sensors, s_buff)))
                labels = np.round(t / s_buff * t_buff, decimals=3)
                ticks = [list(zip(t, labels))]
                tax.setTicks(ticks)

        peaks = data["peaks"]
        peak_txt = "Peak: N/A"
        for s in range(num_sensors):
            sensor = self.sensor_config.sensor[s]
            if peaks:
                self.peak_vlines[s].setValue(peaks["peak_mm"][s])
                if s == 0:
                    peak_txt = ""
                if np.isfinite(peaks["snr"][s]):
                    peak_txt += "Peak S{}: {:.1f}mm, SNR: {:.1f}dB".format(
                        sensor, peaks["peak_mm"][s], peaks["snr"][s])
                else:
                    peak_txt += "Peak S{}: %.1fmm".format(sensor, peaks["peak_mm"][s])
                if s < num_sensors - 1:
                    peak_txt += "\n"

            max_val = max(np.max(data["env_clutter"] + data["env_ampl"][s]),
                          np.max(data["env_clutter"]))
            peak_line = np.flip((data["hist_plots"][s] - xstart) / (xend - xstart) * xdim, axis=0)

            self.envelope_plots[s].setData(data["x_mm"], data["env_ampl"][s] + data["env_clutter"])
            self.phase_plots[s].setData(data["x_mm"], data["phase"][s])

            self.envelope_plot_window.setYRange(0, self.smooth_envelope.update(max_val))

            if num_sensors == 1:
                self.clutter_plots[s].setData(data["x_mm"], data["env_clutter"])

            ymax_level = min(1.5 * np.max(np.max(data["hist_env"][s, :, :])),
                             self.env_plot_max_y[s])

            self.hist_plots[s].updateImage(data["hist_env"][s, :, :].T, levels=(0, ymax_level))
            self.hist_plot_peaks[s].setData(peak_line)
            self.hist_plot_peaks[s].setZValue(2)

            if max_val > self.env_plot_max_y[s]:
                self.env_plot_max_y[s] = 1.2 * max_val
        self.peak_text.setText(peak_txt, color=(1, 1, 1))
Ejemplo n.º 19
0
    def setup(self, win):
        win.setWindowTitle("Acconeer presence detection example")

        dashed_pen = pg.mkPen("k", width=2.5, style=QtCore.Qt.DashLine)

        if self.processing_config["show_sweep"]["value"]:
            data_plot = win.addPlot(
                title="Sweep (blue), fast (orange), and slow (green)")
            data_plot.showGrid(x=True, y=True)
            data_plot.setLabel("bottom", "Depth (m)")
            data_plot.setYRange(-2**15, 2**15)
            self.sweep_scatter = pg.ScatterPlotItem(
                size=10,
                brush=example_utils.pg_brush_cycler(0),
            )
            self.fast_scatter = pg.ScatterPlotItem(
                size=10,
                brush=example_utils.pg_brush_cycler(1),
            )
            self.slow_scatter = pg.ScatterPlotItem(
                size=10,
                brush=example_utils.pg_brush_cycler(2),
            )
            data_plot.addItem(self.sweep_scatter)
            data_plot.addItem(self.fast_scatter)
            data_plot.addItem(self.slow_scatter)

            win.nextRow()

        if self.processing_config["show_noise"]["value"]:
            self.noise_plot = win.addPlot(title="Noise")
            self.noise_plot.showGrid(x=True, y=True)
            self.noise_plot.setLabel("bottom", "Depth (m)")
            self.noise_curve = self.noise_plot.plot(
                pen=example_utils.pg_pen_cycler())
            self.noise_smooth_max = example_utils.SmoothMax(
                self.sensor_config.sweep_rate)

            win.nextRow()

        if self.processing_config["show_depthwise_output"]["value"]:
            self.move_plot = win.addPlot(title="Depthwise presence")
            self.move_plot.showGrid(x=True, y=True)
            self.move_plot.setLabel("bottom", "Depth (m)")
            self.move_curve = self.move_plot.plot(
                pen=example_utils.pg_pen_cycler())
            self.move_smooth_max = example_utils.SmoothMax(
                self.sensor_config.sweep_rate,
                tau_decay=1.0,
            )

            self.move_depth_line = pg.InfiniteLine(pen=dashed_pen)
            self.move_depth_line.hide()
            self.move_plot.addItem(self.move_depth_line)
            limit_line = pg.InfiniteLine(self.movement_limit,
                                         angle=0,
                                         pen=dashed_pen)
            self.move_plot.addItem(limit_line)

            win.nextRow()

        move_hist_plot = win.addPlot(title="Presence history")
        move_hist_plot.showGrid(x=True, y=True)
        move_hist_plot.setLabel("bottom", "Time (s)")
        move_hist_plot.setXRange(-HISTORY_LENGTH_S, 0)
        move_hist_plot.setYRange(0, OUTPUT_MAX)
        self.move_hist_curve = move_hist_plot.plot(
            pen=example_utils.pg_pen_cycler())
        limit_line = pg.InfiniteLine(self.movement_limit,
                                     angle=0,
                                     pen=dashed_pen)
        move_hist_plot.addItem(limit_line)

        self.present_html_format = '<div style="text-align: center">' \
                                   '<span style="color: #FFFFFF;font-size:16pt;">' \
                                   '{}</span></div>'
        present_html = self.present_html_format.format("Presence detected!")
        not_present_html = '<div style="text-align: center">' \
                           '<span style="color: #FFFFFF;font-size:16pt;">' \
                           '{}</span></div>'.format("No presence detected")
        self.present_text_item = pg.TextItem(
            html=present_html,
            fill=pg.mkColor(255, 140, 0),
            anchor=(0.5, 0),
        )
        self.not_present_text_item = pg.TextItem(
            html=not_present_html,
            fill=pg.mkColor("b"),
            anchor=(0.5, 0),
        )
        self.present_text_item.setPos(-2.5, 0.95 * OUTPUT_MAX)
        self.not_present_text_item.setPos(-2.5, 0.95 * OUTPUT_MAX)
        move_hist_plot.addItem(self.present_text_item)
        move_hist_plot.addItem(self.not_present_text_item)
        self.present_text_item.hide()
Ejemplo n.º 20
0
    def setup(self, win):
        win.setWindowTitle("Acconeer presence detection example")
        win.setAntialiasing(True)

        self.limit_lines = []
        dashed_pen = pg.mkPen("k", width=2.5, style=QtCore.Qt.DashLine)

        # Data plot

        self.data_plot = win.addPlot(
            row=0,
            col=0,
            title="Frame (blue), fast (orange), and slow (green)",
        )
        self.data_plot.showGrid(x=True, y=True)
        self.data_plot.setLabel("bottom", "Depth (m)")
        self.data_plot.setLabel("left", "Amplitude")
        self.data_plot.setYRange(-2**15, 2**15)
        self.sweep_scatter = pg.ScatterPlotItem(
            size=10,
            brush=example_utils.pg_brush_cycler(0),
        )
        self.fast_scatter = pg.ScatterPlotItem(
            size=10,
            brush=example_utils.pg_brush_cycler(1),
        )
        self.slow_scatter = pg.ScatterPlotItem(
            size=10,
            brush=example_utils.pg_brush_cycler(2),
        )
        self.data_plot.addItem(self.sweep_scatter)
        self.data_plot.addItem(self.fast_scatter)
        self.data_plot.addItem(self.slow_scatter)

        # Noise estimation plot

        self.noise_plot = win.addPlot(
            row=1,
            col=0,
            title="Noise",
        )
        self.noise_plot.showGrid(x=True, y=True)
        self.noise_plot.setLabel("bottom", "Depth (m)")
        self.noise_plot.setLabel("left", "Amplitude")
        self.noise_curve = self.noise_plot.plot(
            pen=example_utils.pg_pen_cycler())
        self.noise_smooth_max = example_utils.SmoothMax(
            self.sensor_config.sweep_rate)

        # Depthwise presence plot

        self.move_plot = win.addPlot(
            row=2,
            col=0,
            title="Depthwise presence",
        )
        self.move_plot.showGrid(x=True, y=True)
        self.move_plot.setLabel("bottom", "Depth (m)")
        self.move_plot.setLabel("left", "Norm. ampl.")
        zero_curve = self.move_plot.plot(self.depths,
                                         np.zeros_like(self.depths))
        self.inter_curve = self.move_plot.plot()
        self.total_curve = self.move_plot.plot()
        self.move_smooth_max = example_utils.SmoothMax(
            self.sensor_config.sweep_rate,
            tau_decay=1.0,
            tau_grow=0.25,
        )

        self.move_depth_line = pg.InfiniteLine(pen=pg.mkPen("k", width=1.5))
        self.move_depth_line.hide()
        self.move_plot.addItem(self.move_depth_line)
        limit_line = pg.InfiniteLine(angle=0, pen=dashed_pen)
        self.move_plot.addItem(limit_line)
        self.limit_lines.append(limit_line)

        fbi = pg.FillBetweenItem(
            zero_curve,
            self.inter_curve,
            brush=example_utils.pg_brush_cycler(0),
        )
        self.move_plot.addItem(fbi)

        fbi = pg.FillBetweenItem(
            self.inter_curve,
            self.total_curve,
            brush=example_utils.pg_brush_cycler(1),
        )
        self.move_plot.addItem(fbi)

        # Presence history plot

        self.move_hist_plot = pg.PlotItem(title="Presence history")
        self.move_hist_plot.showGrid(x=True, y=True)
        self.move_hist_plot.setLabel("bottom", "Time (s)")
        self.move_hist_plot.setLabel(
            "left", "Score (limited to {})".format(OUTPUT_MAX))
        self.move_hist_plot.setXRange(-self.history_length_s, 0)
        self.move_hist_plot.setYRange(0, OUTPUT_MAX)
        self.move_hist_curve = self.move_hist_plot.plot(
            pen=example_utils.pg_pen_cycler())
        limit_line = pg.InfiniteLine(angle=0, pen=dashed_pen)
        self.move_hist_plot.addItem(limit_line)
        self.limit_lines.append(limit_line)

        self.present_html_format = '<div style="text-align: center">' \
                                   '<span style="color: #FFFFFF;font-size:15pt;">' \
                                   '{}</span></div>'
        not_present_html = '<div style="text-align: center">' \
                           '<span style="color: #FFFFFF;font-size:15pt;">' \
                           '{}</span></div>'.format("No presence detected")
        self.present_text_item = pg.TextItem(
            fill=pg.mkColor(0xff, 0x7f, 0x0e, 200),
            anchor=(0.5, 0),
        )
        self.not_present_text_item = pg.TextItem(
            html=not_present_html,
            fill=pg.mkColor(0x1f, 0x77, 0xb4, 180),
            anchor=(0.5, 0),
        )

        pos = (-self.history_length_s / 2, 0.95 * OUTPUT_MAX)
        self.present_text_item.setPos(*pos)
        self.not_present_text_item.setPos(*pos)
        self.move_hist_plot.addItem(self.present_text_item)
        self.move_hist_plot.addItem(self.not_present_text_item)
        self.present_text_item.hide()

        # Sector plot

        self.sector_plot = pg.PlotItem()
        self.sector_plot.setAspectLocked()
        self.sector_plot.hideAxis("left")
        self.sector_plot.hideAxis("bottom")
        self.sectors = []

        pen = pg.mkPen("k", width=1)
        span_deg = 25
        for r in np.flip(np.arange(self.num_sectors) + 1):
            sector = pg.QtGui.QGraphicsEllipseItem(-r, -r, r * 2, r * 2)
            sector.setStartAngle(-16 * span_deg)
            sector.setSpanAngle(16 * span_deg * 2)
            sector.setPen(pen)
            self.sector_plot.addItem(sector)
            self.sectors.append(sector)

        self.sectors.reverse()

        sublayout = win.addLayout(row=3, col=0)
        sublayout.layout.setColumnStretchFactor(0, 2)
        sublayout.addItem(self.move_hist_plot, col=0)
        sublayout.addItem(self.sector_plot, col=1)

        self.setup_is_done = True
        self.update_processing_config()
Ejemplo n.º 21
0
    def setup(self, win):
        # Data plots

        self.data_plots = []
        self.data_curves = []
        for i in range(self.num_depths):
            title = "{:.0f} cm".format(100 * self.depths[i])
            plot = win.addPlot(row=0, col=i, title=title)
            plot.showGrid(x=True, y=True)
            plot.setYRange(-2**15, 2**15)
            plot.hideAxis("left")
            plot.hideAxis("bottom")
            plot.plot(np.arange(self.num_subsweeps),
                      np.zeros(self.num_subsweeps))
            curve = plot.plot(pen=example_utils.pg_pen_cycler())
            self.data_plots.append(plot)
            self.data_curves.append(curve)

        # Spectral density plot

        self.sd_plot = win.addPlot(row=1, col=0, colspan=self.num_depths)
        self.sd_plot.setLabel("left", "Normalized ASD")
        self.sd_plot.showGrid(x=True, y=True)
        self.sd_curve = self.sd_plot.plot(pen=example_utils.pg_pen_cycler())
        dashed_pen = pg.mkPen("k", width=2, style=QtCore.Qt.DashLine)
        self.sd_threshold_line = pg.InfiniteLine(angle=0, pen=dashed_pen)
        self.sd_plot.addItem(self.sd_threshold_line)

        self.smooth_max = example_utils.SmoothMax(
            self.est_update_rate,
            tau_decay=0.5,
            tau_grow=0,
            hysteresis=0.2,
        )

        # Rolling speed plot

        self.vel_plot = pg.PlotItem()
        self.vel_plot.setLabel("bottom", "Time (s)")
        self.vel_plot.showGrid(x=True, y=True)
        self.vel_plot.setXRange(-EST_VEL_HISTORY_LENGTH, 0)
        self.vel_max_line = pg.InfiniteLine(angle=0,
                                            pen=pg.mkPen("k", width=1))
        self.vel_plot.addItem(self.vel_max_line)
        self.vel_scatter = pg.ScatterPlotItem(size=8)
        self.vel_plot.addItem(self.vel_scatter)

        self.vel_html_fmt = '<span style="color:#000;font-size:24pt;">{:.1f} {}</span>'
        self.vel_text_item = pg.TextItem(anchor=(0.5, 0))
        self.vel_plot.addItem(self.vel_text_item)

        # Sequence speed plot

        self.sequences_plot = pg.PlotItem()
        self.sequences_plot.setLabel("bottom", "History")
        self.sequences_plot.showGrid(y=True)
        self.sequences_plot.setXRange(-NUM_SAVED_SEQUENCES + 0.5, 0.5)
        tmp = np.flip(np.arange(NUM_SAVED_SEQUENCES) == 0)
        brushes = [pg.mkBrush(example_utils.color_cycler(n)) for n in tmp]
        self.bar_graph = pg.BarGraphItem(
            x=np.arange(-NUM_SAVED_SEQUENCES, 0) + 1,
            height=np.zeros(NUM_SAVED_SEQUENCES),
            width=0.8,
            brushes=brushes,
        )
        self.sequences_plot.addItem(self.bar_graph)

        self.sequences_text_item = pg.TextItem(anchor=(0.5, 0))
        self.sequences_plot.addItem(self.sequences_text_item)

        sublayout = win.addLayout(row=2, col=0, colspan=self.num_depths)
        sublayout.addItem(self.vel_plot, col=0)
        sublayout.addItem(self.sequences_plot, col=1)

        self.setup_is_done = True
        self.update_processing_config()
Ejemplo n.º 22
0
    def setup(self, win):
        win.setWindowTitle("Acconeer obstacle detection example")

        row_idx = 0
        self.env_ax = win.addPlot(row=row_idx,
                                  col=0,
                                  colspan=4,
                                  title="Envelope and max FFT")
        self.env_ax.setLabel("bottom", "Depth (cm)")
        self.env_ax.setXRange(*(self.sensor_config.range_interval * 100))
        self.env_ax.showGrid(True, True)
        self.env_ax.addLegend()
        self.env_ax.setYRange(0, 0.1)

        self.env_ampl = self.env_ax.plot(pen=example_utils.pg_pen_cycler(0),
                                         name="Envelope")
        self.fft_max = self.env_ax.plot(pen=example_utils.pg_pen_cycler(
            1, "--"),
                                        name="FFT max")

        self.peak_dist_text = pg.TextItem(color="k", anchor=(0, 1))
        self.env_ax.addItem(self.peak_dist_text)
        self.peak_dist_text.setPos(self.sensor_config.range_start * 100, 0)
        self.peak_dist_text.setZValue(3)

        self.env_peak_vline = pg.InfiniteLine(pos=0,
                                              angle=90,
                                              pen=pg.mkPen(
                                                  width=2,
                                                  style=QtCore.Qt.DotLine))
        self.env_ax.addItem(self.env_peak_vline)
        row_idx += 1

        self.obstacle_ax = win.addPlot(row=row_idx,
                                       col=0,
                                       colspan=self.num_hist_plots,
                                       title="Obstacle map")
        self.obstacle_im = pg.ImageItem()
        self.obstacle_ax.setLabel("bottom", "Velocity (cm/s)")
        self.obstacle_ax.setLabel("left", "Distance (cm)")
        self.obstacle_im.setLookupTable(example_utils.pg_mpl_cmap("viridis"))
        self.obstacle_ax.addItem(self.obstacle_im)

        self.obstacle_ax.setXRange(-self.max_velocity, self.max_velocity)
        self.obstacle_ax.setYRange(*self.sensor_config.range_interval * 100)

        self.obstacle_ax.setXRange(-self.max_velocity, self.max_velocity)
        self.obstacle_ax.setYRange(*self.sensor_config.range_interval * 100)

        self.obstacle_peak = pg.ScatterPlotItem(brush=pg.mkBrush("k"), size=15)
        self.obstacle_ax.addItem(self.obstacle_peak)

        self.peak_fft_text = pg.TextItem(color="w", anchor=(0, 1))
        self.obstacle_ax.addItem(self.peak_fft_text)
        self.peak_fft_text.setPos(-self.max_velocity,
                                  self.sensor_config.range_start * 100)

        self.peak_val_text = pg.TextItem(color="w", anchor=(0, 0))
        self.obstacle_ax.addItem(self.peak_val_text)
        self.peak_val_text.setPos(-self.max_velocity,
                                  self.sensor_config.range_end * 100)

        row_idx += 1
        if self.advanced_plots["background_map"]:
            self.obstacle_bg_ax = win.addPlot(row=row_idx,
                                              col=0,
                                              colspan=self.num_hist_plots,
                                              title="Obstacle background")
            self.obstacle_bg_im = pg.ImageItem()
            self.obstacle_bg_ax.setLabel("bottom", "Velocity (cm/s)")
            self.obstacle_bg_ax.setLabel("left", "Distance (cm)")
            self.obstacle_bg_im.setLookupTable(
                example_utils.pg_mpl_cmap("viridis"))
            self.obstacle_bg_ax.addItem(self.obstacle_bg_im)
            row_idx += 1

        if self.advanced_plots["threshold_map"]:
            self.obstacle_thresh_ax = win.addPlot(row=row_idx,
                                                  col=0,
                                                  colspan=self.num_hist_plots,
                                                  title="Obstacle threshold")
            self.obstacle_thresh_im = pg.ImageItem()
            self.obstacle_thresh_ax.setLabel("bottom", "Velocity (cm/s)")
            self.obstacle_thresh_ax.setLabel("left", "Distance (cm)")
            self.obstacle_thresh_im.setLookupTable(
                example_utils.pg_mpl_cmap("viridis"))
            self.obstacle_thresh_ax.addItem(self.obstacle_thresh_im)
            row_idx += 1

        hist_col = 0
        row_idx += self.num_hist_plots
        if self.hist_plots["distance"][1]:
            self.peak_hist_ax_l = win.addPlot(row=row_idx,
                                              col=hist_col,
                                              title="Distance history")
            self.peak_hist_ax_l.setLabel("bottom", "Sweep")
            self.peak_hist_ax_l.setXRange(0, self.peak_hist_len)
            self.peak_hist_ax_l.showGrid(True, True)
            self.peak_hist_ax_l.addLegend(offset=(-10, 10))
            self.peak_hist_ax_l.setYRange(self.sensor_config.range_start * 100,
                                          self.sensor_config.range_end * 100)
            hist_col += 1

        if self.hist_plots["velocity"][1]:
            self.peak_hist_ax_c = win.addPlot(row=row_idx,
                                              col=hist_col,
                                              title="Velocity history")
            self.peak_hist_ax_c.setLabel("bottom", "Sweep")
            self.peak_hist_ax_c.setXRange(0, self.peak_hist_len)
            limit = np.round(self.max_velocity / 10) * 10
            if limit < 1.0:
                limit = self.max_velocity
            self.peak_hist_ax_c.setYRange(-limit, limit)
            self.peak_hist_ax_c.showGrid(True, True)
            self.peak_hist_ax_c.addLegend(offset=(-10, 10))
            hist_col += 1

        if self.hist_plots["angle"][1]:
            self.peak_hist_ax_r = win.addPlot(row=row_idx,
                                              col=hist_col,
                                              title="Angle history")
            self.peak_hist_ax_r.setLabel("bottom", "Sweep")
            self.peak_hist_ax_r.setXRange(0, self.peak_hist_len)
            self.peak_hist_ax_r.showGrid(True, True)
            self.peak_hist_ax_r.addLegend(offset=(-10, 10))
            self.peak_hist_ax_r.setYRange(-100, 100)
            hist_col += 1

        if self.hist_plots["amplitude"][1]:
            self.peak_hist_ax_r1 = win.addPlot(row=row_idx,
                                               col=hist_col,
                                               title="Amplitude history")
            self.peak_hist_ax_r1.setLabel("bottom", "Sweep")
            self.peak_hist_ax_r1.setXRange(0, self.peak_hist_len)
            self.peak_hist_ax_r1.showGrid(True, True)
            self.peak_hist_ax_r1.addLegend(offset=(-10, 10))
            hist_col += 1

        for i in range(self.nr_locals):
            if self.hist_plots["velocity"][1]:
                self.hist_plots["velocity"][0].append(
                    self.peak_hist_ax_c.plot(
                        pen=example_utils.pg_pen_cycler(i),
                        name="Veloctiy {:d}".format(i)))
            if self.hist_plots["angle"][1]:
                self.hist_plots["angle"][0].append(
                    self.peak_hist_ax_r.plot(
                        pen=example_utils.pg_pen_cycler(i),
                        name="Angle {:d}".format(i)))
            if self.hist_plots["distance"][1]:
                self.hist_plots["distance"][0].append(
                    self.peak_hist_ax_l.plot(
                        pen=example_utils.pg_pen_cycler(i),
                        name="Distance {:d}".format(i)))
            if self.hist_plots["amplitude"][1]:
                self.hist_plots["amplitude"][0].append(
                    self.peak_hist_ax_r1.plot(
                        pen=example_utils.pg_pen_cycler(i),
                        name="Amplitude {:d}".format(i)))

        self.smooth_max = example_utils.SmoothMax(
            self.sensor_config.sweep_rate, tau_decay=1, tau_grow=0.2)