diff --git a/src/nqrduck_autotm/controller.py b/src/nqrduck_autotm/controller.py index 44ccea4..279c7b2 100644 --- a/src/nqrduck_autotm/controller.py +++ b/src/nqrduck_autotm/controller.py @@ -1,6 +1,7 @@ import logging import numpy as np import json +import time from serial.tools.list_ports import comports from PyQt6.QtTest import QTest from PyQt6 import QtSerialPort @@ -122,6 +123,7 @@ class AutoTMController(ModuleController): # Print the command 'fff' to the serial connection command = "f%sf%sf%s" % (start_frequency, stop_frequency, frequency_step) + self.module.model.frequency_sweep_start = time.time() confirmation = self.send_command(command) if confirmation: # We create the frequency sweep spinner dialog @@ -152,6 +154,14 @@ class AutoTMController(ModuleController): self.module.model.data_points.copy() ) self.module.view.frequency_sweep_spinner.hide() + self.module.model.frequency_sweep_stop = time.time() + self.module.view.add_info_text( + "Frequency sweep finished in %.2f seconds" + % ( + self.module.model.frequency_sweep_stop + - self.module.model.frequency_sweep_start + ) + ) # If the text starts with 'r' and a short calibration is active we know that the data is a short calibration elif ( text.startswith("r") and self.module.model.active_calibration == "short" diff --git a/src/nqrduck_autotm/model.py b/src/nqrduck_autotm/model.py index b3ac602..dcad2f2 100644 --- a/src/nqrduck_autotm/model.py +++ b/src/nqrduck_autotm/model.py @@ -266,3 +266,21 @@ class AutoTMModel(ModuleModel): @LUT.setter def LUT(self, value): self._LUT = value + + @property + def frequency_sweep_start(self): + """The timestamp for when the frequency sweep has been started. This is used for timing of the frequency sweep.""" + return self._frequency_sweep_start + + @frequency_sweep_start.setter + def frequency_sweep_start(self, value): + self._frequency_sweep_start = value + + @property + def frequency_sweep_end(self): + """The timestamp for when the frequency sweep has been ended. This is used for timing of the frequency sweep.""" + return self._frequency_sweep_end + + @frequency_sweep_end.setter + def frequency_sweep_end(self, value): + self._frequency_sweep_end = value