def main(): args = example_utils.ExampleArgumentParser().parse_args() example_utils.config_logging(args) if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) config = configs.IQServiceConfig() config.sensor = args.sensors config.range_interval = [0.2, 0.6] config.sweep_rate = 50 info = client.start_streaming(config) interrupt_handler = example_utils.ExampleInterruptHandler() print("Press Ctrl-C to end session") fc = example_utils.FreqCounter(num_bits=(4 * 8 * info["data_length"])) while not interrupt_handler.got_signal: info, data = client.get_next() fc.tick() print("\nDisconnecting...") client.disconnect()
def main(): args = example_utils.ExampleArgumentParser(num_sens=1).parse_args() example_utils.config_logging(args) if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) sensor_config = get_sensor_config() sensor_config.sensor = args.sensors processing_config = get_processing_config() session_info = client.setup_session(sensor_config) pg_updater = PGUpdater(sensor_config, processing_config) pg_process = PGProcess(pg_updater) pg_process.start() client.start_streaming() interrupt_handler = example_utils.ExampleInterruptHandler() print("Press Ctrl-C to end session") processor = PhaseTrackingProcessor(sensor_config, processing_config) # Record data data = [] counter = 0 while not interrupt_handler.got_signal: info, sweep = client.get_next() plot_data = processor.process(sweep) data.append(sweep) counter += 1 if plot_data is not None: try: pg_process.put_data(plot_data) except PGProccessDiedException: break # Save to file with open( "data" + str(get_sensor_config().sweep_rate) + str(counter) + ".pkl", "wb") as outfile: pickle.dump(data, outfile, pickle.HIGHEST_PROTOCOL) with open( "metadata" + str(get_sensor_config().sweep_rate) + str(counter) + ".pkl", "wb") as outfile: pickle.dump(session_info, outfile, pickle.HIGHEST_PROTOCOL) print("Disconnecting...") pg_process.close() client.disconnect()
def main(): global CAMERA global logging global client global SENSOR_CONFIG global SETTINGS global SEG signal.signal(signal.SIGINT, signal_handler) try: # create seven segment device serial = spi(port=0, device=0, gpio=noop()) device = max7219(serial, cascaded=1) SEG = sevensegment(device) SETTINGS.read("settings.ini") args = example_utils.ExampleArgumentParser(num_sens=1).parse_args() example_utils.config_logging(args) logging.info("radarCat starting with args " + str(args)) if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) # setup Camera date and time if os.name != 'nt': logging.info("set Camera date and time") callback_obj = gp.check_result(gp.use_python_logging()) # open camera connection CAMERA = gp.check_result(gp.gp_camera_new()) gp.check_result(gp.gp_camera_init(CAMERA)) # get camera details abilities = gp.check_result(gp.gp_camera_get_abilities(CAMERA)) # get configuration tree camConfig = gp.check_result(gp.gp_camera_get_config(CAMERA)) # find the date/time setting config item and set it if set_datetime(camConfig, abilities.model): # apply the changed config gp.check_result(gp.gp_camera_set_config(CAMERA, camConfig)) else: logging.error("Could not set date & time") SENSOR_CONFIG = get_sensor_config() SENSOR_CONFIG.sensor = args.sensors except: print("Unexpected error:", sys.exc_info()[0]) while True: detection() time.sleep(3)
def main(): args = example_utils.ExampleArgumentParser().parse_args() example_utils.config_logging(args) if args.socket_addr: print("Using detectors is only supported with the XM112 module") sys.exit() elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) config = configs.DistancePeakDetectorConfig() config.sensor = args.sensors config.range_interval = [0.1, 0.7] config.sweep_rate = 60 config.gain = 0.5 client.setup_session(config) pg_updater = PGUpdater(config) pg_process = PGProcess(pg_updater) pg_process.start() client.start_streaming() interrupt_handler = example_utils.ExampleInterruptHandler() print("Press Ctrl-C to end session") while not interrupt_handler.got_signal: info, data = client.get_next() try: pg_process.put_data(data) except PGProccessDiedException: break print("Disconnecting...") pg_process.close() client.disconnect()
def sensor_read(): args = example_utils.ExampleArgumentParser(num_sens=1).parse_args() example_utils.config_logging(args) if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) sensor_config = get_sensor_config() sensor_config.sensor = args.sensors # Extract metadata session_info = client.setup_session(sensor_config) range_start = session_info["actual_range_start"] range_length = session_info["actual_range_length"] #sweep_rate = session_info["frequency"] data_length = session_info["data_length"] client.start_streaming() interrupt_handler = example_utils.ExampleInterruptHandler() print("Press Ctrl-C to end session") # Instantiate customProcess custom_processor = customProcess(range_length, range_start, AMPL_THRESHOLD, DIST_THRESHOLD, data_length, -1) processor = PhaseTrackingProcessor(sensor_config.sweep_rate) while not interrupt_handler.got_signal: info, sweep = client.get_next() plot_data = processor.process(sweep) if plot_data is not None: try: print(np.amax(plot_data["abs"])) if custom_processor.process(plot_data): person_counter = custom_processor.person_counter if person_counter == 1: print("1 person in the room") input("Enter") else: print(person_counter, " persons in the room") input("Enter") except PGProccessDiedException: break print("Disconnecting...") client.disconnect()
def main(): args = example_utils.ExampleArgumentParser().parse_args() example_utils.config_logging(args) if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) client.squeeze = False config = configs.EnvelopeServiceConfig() config.sensor = args.sensors config.range_interval = [0.3, 0.8] config.sweep_rate = 70 config.gain = 0.6 # config.experimental_stitching = True # config.session_profile = configs.EnvelopeServiceConfig.MAX_SNR # config.running_average_factor = 0.5 # config.compensate_phase = False # not recommended info = client.setup_session(config) num_points = info["data_length"] pg_updater = PGUpdater(config, num_points) pg_process = PGProcess(pg_updater) pg_process.start() client.start_streaming() interrupt_handler = example_utils.ExampleInterruptHandler() print("Press Ctrl-C to end session") while not interrupt_handler.got_signal: info, data = client.get_next() try: pg_process.put_data(data) print(data) input("Enter") except PGProccessDiedException: break print("Disconnecting...") pg_process.close() client.disconnect()
def main(): args = example_utils.ExampleArgumentParser().parse_args() example_utils.config_logging(args) if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) client.squeeze = False config = configs.IQServiceConfig() config.sensor = args.sensors config.range_interval = [0.2, 0.6] config.sweep_rate = 30 config.gain = 0.6 # config.running_average_factor = 0.5 info = client.setup_session(config) num_points = info["data_length"] fig_updater = ExampleFigureUpdater(config, num_points) plot_process = PlotProcess(fig_updater) plot_process.start() client.start_streaming() interrupt_handler = example_utils.ExampleInterruptHandler() print("Press Ctrl-C to end session") while not interrupt_handler.got_signal: info, data = client.get_next() plot_data = { "amplitude": np.abs(data), "phase": np.angle(data), } try: plot_process.put_data(plot_data) except PlotProccessDiedException: break print("Disconnecting...") plot_process.close() client.disconnect()
def main(): args = example_utils.ExampleArgumentParser().parse_args() example_utils.config_logging(args) if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) # Normally when using a single sensor, get_next will return # (info, data). When using mulitple sensors, get_next will return # lists of info and data for each sensor, i.e. ([info], [data]). # This is commonly called squeezing. To disable squeezing, making # get_next _always_ return lists, set: # client.squeeze = False config = configs.EnvelopeServiceConfig() config.sensor = args.sensors config.range_interval = [0.2, 0.3] config.sweep_rate = 5 session_info = client.setup_session(config) print("Session info:\n", session_info, "\n") # Now would be the time to set up plotting, signal processing, etc. client.start_streaming() # Normally, hitting Ctrl-C will raise a KeyboardInterrupt which in # most cases immediately terminates the script. This often becomes # an issue when plotting and also doesn't allow us to disconnect # gracefully. Setting up an ExampleInterruptHandler will capture the # keyboard interrupt signal so that a KeyboardInterrupt isn't raised # and we can take care of the signal ourselves. In case you get # impatient, hitting Ctrl-C a couple of more times will raise a # KeyboardInterrupt which hopefully terminates the script. interrupt_handler = example_utils.ExampleInterruptHandler() print("Press Ctrl-C to end session\n") while not interrupt_handler.got_signal: info, data = client.get_next() print(info, "\n", data, "\n") print("Disconnecting...") client.disconnect()
def main(): args = example_utils.ExampleArgumentParser(num_sens=1).parse_args() example_utils.config_logging(args) if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) sensor_config = get_sensor_config() processing_config = get_processing_config() sensor_config.sensor = args.sensors session_info = client.setup_session(sensor_config) client.start_streaming() interrupt_handler = example_utils.ExampleInterruptHandler() print("Press Ctrl-C to end session") processor = Processor(sensor_config, processing_config, session_info) global speedLimit global waitForCompletingSpeedLimitDetection while not interrupt_handler.got_signal: info, sweep = client.get_next() speed = processor.process(sweep) # speed = speed * 3.6 if speed > speedLimit: speedLimit = speed print("Maximal current Speed: " + str(speedLimit)) if not waitForCompletingSpeedLimitDetection: waitForCompletingSpeedLimitDetection = True timer1 = threading.Timer(0.1, captureImageFromCamera) timer1.start() timer2 = threading.Timer(2.0, sendSpeedCatImage) timer2.start() print(speed) print("Disconnecting...") # pg_process.close() client.disconnect()
def main(): args = example_utils.ExampleArgumentParser().parse_args() example_utils.config_logging(args) if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) client.squeeze = False config = configs.IQServiceConfig() config.sensor = args.sensors config.range_interval = [0.2, 0.6] config.sweep_rate = 30 config.gain = 0.6 config.sampling_mode = config.SAMPLING_MODE_A # config.running_average_factor = 0.5 # config.hw_accelerated_average_samples = 7 # config.stepsize = 1 info = client.setup_session(config) num_points = info["data_length"] pg_updater = PGUpdater(config, num_points) pg_process = PGProcess(pg_updater) pg_process.start() client.start_streaming() interrupt_handler = example_utils.ExampleInterruptHandler() print("Press Ctrl-C to end session") while not interrupt_handler.got_signal: info, data = client.get_next() try: pg_process.put_data(data) except PGProccessDiedException: break print("Disconnecting...") pg_process.close() client.disconnect()
def setup(request): conn_type, *args = request.param if conn_type == "spi": client = SPIClient() sensor = 1 elif conn_type == "uart": port = args[0] or autodetect_serial_port() client = UARTClient(port) sensor = 1 elif conn_type == "socket": client = SocketClient(args[0]) sensor = int(args[1]) else: pytest.fail() client.connect() yield (client, sensor) client.disconnect()
def main(): args = example_utils.ExampleArgumentParser().parse_args() example_utils.config_logging(args) if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) client.squeeze = False sensor_config = get_sensor_config() sensor_config.sensor = args.sensors processing_config = get_processing_config() session_info = client.setup_session(sensor_config) pg_updater = PGUpdater(sensor_config, processing_config, session_info) pg_process = PGProcess(pg_updater) pg_process.start() client.start_streaming() interrupt_handler = example_utils.ExampleInterruptHandler() print("Press Ctrl-C to end session") processor = Processor(sensor_config, processing_config, session_info) while not interrupt_handler.got_signal: info, sweep = client.get_next() plot_data = processor.process(sweep) if plot_data is not None: try: pg_process.put_data(plot_data) except PGProccessDiedException: break print("Disconnecting...") pg_process.close() client.disconnect()
def main(): args = example_utils.ExampleArgumentParser().parse_args() example_utils.config_logging(args) if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) client.squeeze = False config = configs.SparseServiceConfig() config.sensor = args.sensors config.range_interval = [0.24, 1.20] config.sweep_rate = 60 config.number_of_subsweeps = 16 # config.hw_accelerated_average_samples = 60 # config.stepsize = 1 client.setup_session(config) pg_updater = PGUpdater(config) pg_process = PGProcess(pg_updater) pg_process.start() client.start_streaming() interrupt_handler = example_utils.ExampleInterruptHandler() print("Press Ctrl-C to end session") while not interrupt_handler.got_signal: info, data = client.get_next() try: pg_process.put_data(data) except PGProccessDiedException: break print("Disconnecting...") pg_process.close() client.disconnect()
def check_connection(args): print("Checking connection to radar") try: if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) client.connect() client.disconnect() return True except Exception: print() traceback.print_exc() print() return False
def main(): args = example_utils.ExampleArgumentParser().parse_args() example_utils.config_logging(args) if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) config = configs.EnvelopeServiceConfig() config.sensor = args.sensors info = client.connect() print("connect info:", info) client.start_streaming(config) client.get_next() client.disconnect()
def main(): args = example_utils.ExampleArgumentParser().parse_args() example_utils.config_logging(args) if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) config = configs.EnvelopeServiceConfig() config.sensor = args.sensors config.range_interval = [0.2, 0.6] config.sweep_rate = 10 client.start_streaming(config) client.get_next() client.disconnect()
def recordData(): args = example_utils.ExampleArgumentParser().parse_args() example_utils.config_logging(args) # Pick client depending on whether socket, SPI, or UART is used if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) config = configs.IQServiceConfig() config.sensor = args.sensors config.range_interval = [0.3, 0.8] config.sweep_rate = int(input("Sweep rate (Hz): ")) config.gain = 0.7 client.connect() session_info = client.setup_session(config) dataLength = session_info["data_length"] print(dataLength) client.start_streaming() # Array of sweeps data = [] numSweeps = int(input("Set number of sweeps: ")) #Control time ses_time_start = time() #Used for sleep time per_time = 1/config.sweep_rate # Loop to get data from sensor for i in range(numSweeps): start_time = time() # Get data sweep_info, sweep_data = client.get_next() # Append to list data.append(sweep_data) # Sleep time according to frequency end_time = time() sleep_time = per_time - (end_time - start_time) if sleep_time > 0: sleep(sleep_time) #Control of time ses_time = time() - ses_time_start print("ses_time: ", ses_time) object = input("Object: (W/D) ") direction = input("direction (I/O, only for door: ") # Save to file with open("data" + str(config.sweep_rate) + str(numSweeps) + object + direction + ".pkl", "wb") as outfile: pickle.dump(data, outfile, pickle.HIGHEST_PROTOCOL) with open("metadata" + str(config.sweep_rate) + str(numSweeps) + object + direction + ".pkl", "wb") as outfile: pickle.dump(session_info, outfile, pickle.HIGHEST_PROTOCOL) client.stop_streaming() client.disconnect()
def main(): args = example_utils.ExampleArgumentParser(num_sens=1).parse_args() example_utils.config_logging(args) if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(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 = QtWidgets.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()
def main(): parser = example_utils.ExampleArgumentParser(num_sens=2) add_args(parser) args = parser.parse_args() if args.model_file_name: filename = args.model_file_name else: print("Not implemented!") sys.exit(1) keras_proc = kp.MachineLearning() model_data = keras_proc.load_model(filename) print(model_data["message"]) if not model_data["loaded"]: return False config = model_data["sensor_config"] feature_list = model_data["feature_list"] frame_settings = model_data["frame_settings"] feature_process = feature_proc.FeatureProcessing(config) feature_process.set_feature_list(feature_list) feature_process.set_frame_settings(frame_settings) example_utils.config_logging(args) if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) info = client.setup_session(config) interrupt_handler = example_utils.ExampleInterruptHandler() print("Press Ctrl-C to end session") client.start_streaming() init = True while not interrupt_handler.got_signal: info, sweep = client.get_next() if init: init = False num_sensors, data_len = sweep.shape start_x = config.range_interval[0] stop_x = config.range_interval[1] x_mm = np.linspace(start_x, stop_x, data_len) * 1000 data = { "x_mm": x_mm, "iq_data": sweep, "env_ampl": abs(sweep), "sensor_config": config, "num_sensors": num_sensors, } ml_frame_data = feature_process.feature_extraction(data) feature_map = ml_frame_data["current_frame"]["feature_map"] complete = ml_frame_data["current_frame"]["frame_complete"] if complete and feature_map is not None: predict = keras_proc.predict(feature_map)[0] prediction_label = predict["prediction"] print(prediction_label) print("Disconnecting...") client.disconnect()
def main(): args = example_utils.ExampleArgumentParser(num_sens=1).parse_args() example_utils.config_logging(args) if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) config = configs.IQServiceConfig() config.sensor = args.sensors config.range_interval = [0.2, 0.6] config.sweep_rate = 10 config.gain = 0.6 info = client.setup_session(config) num_points = info["data_length"] amplitude_y_max = 0.3 fig, (amplitude_ax, phase_ax) = plt.subplots(2) fig.set_size_inches(8, 6) fig.canvas.set_window_title("Acconeer matplotlib example") for ax in [amplitude_ax, phase_ax]: ax.set_xlabel("Depth (m)") ax.set_xlim(config.range_interval) ax.grid(True) amplitude_ax.set_ylabel("Amplitude") amplitude_ax.set_ylim(0, 1.1 * amplitude_y_max) phase_ax.set_ylabel("Phase") example_utils.mpl_setup_yaxis_for_phase(phase_ax) xs = np.linspace(*config.range_interval, num_points) amplitude_line = amplitude_ax.plot(xs, np.zeros_like(xs))[0] phase_line = phase_ax.plot(xs, np.zeros_like(xs))[0] fig.tight_layout() plt.ion() plt.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() amplitude = np.abs(sweep) phase = np.angle(sweep) max_amplitude = np.max(amplitude) if max_amplitude > amplitude_y_max: amplitude_y_max = max_amplitude amplitude_ax.set_ylim(0, 1.1 * max_amplitude) amplitude_line.set_ydata(amplitude) phase_line.set_ydata(phase) if not plt.fignum_exists(1): # Simple way to check if plot is closed break fig.canvas.flush_events() print("Disconnecting...") plt.close() client.disconnect()
def main(): #args = example_utils.ExampleArgumentParser(num_sens=1).parse_args() args = example_utils.ExampleArgumentParser().parse_args() example_utils.config_logging(args) if args.socket_addr: client = SocketClient(args.socket_addr) elif args.spi: client = SPIClient() else: port = args.serial_port or example_utils.autodetect_serial_port() client = UARTClient(port) config = configs.SparseServiceConfig() config.sensor = args.sensors num_of_sensors = len(config.sensor) config.range_interval = [0.3, 1.3] config.sweep_rate = 80 config.gain = 0.6 config.number_of_subsweeps = 32 sensor_config = config processing_config = ProcessingConfiguration() session_info = client.setup_session(sensor_config) pg_updaters = [] for i in range(num_of_sensors): pg_updaters.append( PGUpdater(sensor_config, processing_config, session_info, sensor_num=i + 1)) pg_processes = [] for i in range(num_of_sensors): pg_processes.append(PGProcess(pg_updaters[i])) pg_processes[i].start() client.start_streaming() interrupt_handler = example_utils.ExampleInterruptHandler() print("Press Ctrl-C to end session") processors = [] for i in range(num_of_sensors): processors.append( PresenceDetectionSparseProcessor(sensor_config, processing_config, session_info)) while not interrupt_handler.got_signal: info, sweep = client.get_next() if (num_of_sensors > 1): for i in range(num_of_sensors): plot_data = processors[i].process(sweep[i]) if plot_data is not None: try: pg_processes[i].put_data(plot_data) except PGProccessDiedException: break else: plot_data = processors[0].process(sweep) if plot_data is not None: try: pg_processes[0].put_data(plot_data) except PGProccessDiedException: break print("Disconnecting...") for i in range(num_of_sensors): pg_processes[i].close() client.disconnect()