Fixed broadband signal emission.

This commit is contained in:
jupfi 2023-12-15 15:28:07 +01:00
parent fc8ddc41c3
commit 7fee4720ee

View file

@ -1,6 +1,6 @@
import logging import logging
import numpy as np import numpy as np
from PyQt6.QtCore import pyqtSlot, pyqtSignal, QThread from PyQt6.QtCore import pyqtSlot, pyqtSignal, QTimer
from PyQt6.QtWidgets import QApplication from PyQt6.QtWidgets import QApplication
from nqrduck_spectrometer.measurement import Measurement from nqrduck_spectrometer.measurement import Measurement
from nqrduck.module.module_controller import ModuleController from nqrduck.module.module_controller import ModuleController
@ -142,7 +142,8 @@ class BroadbandController(ModuleController):
self.module.view.add_info_text("Starting broadband measurement.") self.module.view.add_info_text("Starting broadband measurement.")
# Start the first measurement # Start the first measurement
self.start_single_measurement(start_frequency) QTimer.singleShot(500, lambda: self.start_single_measurement(start_frequency))
QApplication.processEvents()
@pyqtSlot() @pyqtSlot()
def on_broadband_measurement_added(self) -> None: def on_broadband_measurement_added(self) -> None:
@ -158,7 +159,8 @@ class BroadbandController(ModuleController):
self.module.model.current_broadband_measurement.get_next_measurement_frequency() self.module.model.current_broadband_measurement.get_next_measurement_frequency()
) )
logger.debug("Next frequency: " + str(next_frequency)) logger.debug("Next frequency: " + str(next_frequency))
self.start_single_measurement(next_frequency) QTimer.singleShot(500, lambda: self.start_single_measurement(next_frequency))
QApplication.processEvents()
else: else:
self.module.view.add_info_text("Broadband measurement finished.") self.module.view.add_info_text("Broadband measurement finished.")
@ -177,6 +179,7 @@ class BroadbandController(ModuleController):
self.module.view.add_info_text("Starting measurement at frequency: " + str(frequency)) self.module.view.add_info_text("Starting measurement at frequency: " + str(frequency))
# First set the frequency of the spectrometer # First set the frequency of the spectrometer
self.module.nqrduck_signal.emit("set_frequency", str(frequency)) self.module.nqrduck_signal.emit("set_frequency", str(frequency))
QApplication.processEvents()
# If there is a LUT available, send the tune and match values as signal # If there is a LUT available, send the tune and match values as signal
if self.module.model.LUT is not None: if self.module.model.LUT is not None:
self.module.model.waiting_for_tune_and_match = True self.module.model.waiting_for_tune_and_match = True
@ -187,3 +190,4 @@ class BroadbandController(ModuleController):
else: else:
self.module.nqrduck_signal.emit("start_measurement", None) self.module.nqrduck_signal.emit("start_measurement", None)
self.module.model.waiting_for_tune_and_match = False self.module.model.waiting_for_tune_and_match = False
QApplication.processEvents()