diff --git a/src/nqrduck_broadband/controller.py b/src/nqrduck_broadband/controller.py index e5c2471..4367569 100644 --- a/src/nqrduck_broadband/controller.py +++ b/src/nqrduck_broadband/controller.py @@ -19,9 +19,9 @@ class BroadbandController(ModuleController): @pyqtSlot(str, object) def process_signals(self, key: str, value: Measurement): - if key == "measurement_data" and self.module.model.current_broadcast_measurement is not None: + if key == "measurement_data" and self.module.model.current_broadband_measurement is not None: logger.debug("Received single measurement.") - self.module.model.current_broadcast_measurement.add_measurement(value) + self.module.model.current_broadband_measurement.add_measurement(value) elif key == "failure_set_averages" and value == self.module.view._ui_form.averagesEdit.text(): logger.debug("Received set averages failure.") @@ -81,9 +81,9 @@ class BroadbandController(ModuleController): logger.debug("Frequency list: " + str(frequency_list)) # Create a new broadband measurement object - self.module.model.current_broadcast_measurement = self.module.model.BroadbandMeasurement(frequency_list, self.module.model.frequency_step) - self.module.model.current_broadcast_measurement.received_measurement.connect(self.module.view.on_broadband_measurement_added) - self.module.model.current_broadcast_measurement.received_measurement.connect(self.on_broadband_measurement_added) + self.module.model.current_broadband_measurement = self.module.model.BroadbandMeasurement(frequency_list, self.module.model.frequency_step) + self.module.model.current_broadband_measurement.received_measurement.connect(self.module.view.on_broadband_measurement_added) + self.module.model.current_broadband_measurement.received_measurement.connect(self.on_broadband_measurement_added) self.module.view.add_info_text("Starting broadband measurement.") # Start the first measurement @@ -100,9 +100,9 @@ class BroadbandController(ModuleController): """ logger.debug("Broadband measurement added.") # Check if there are more frequencies to measure - if not self.module.model.current_broadcast_measurement.is_complete(): + if not self.module.model.current_broadband_measurement.is_complete(): # Get the next frequency to measure - next_frequency = self.module.model.current_broadcast_measurement.get_next_measurement_frequency() + next_frequency = self.module.model.current_broadband_measurement.get_next_measurement_frequency() logger.debug("Next frequency: " + str(next_frequency)) # Start the next measurement self.module.view.add_info_text("Starting measurement at frequency: " + str(next_frequency)) diff --git a/src/nqrduck_broadband/model.py b/src/nqrduck_broadband/model.py index 561dfd6..42e2cd9 100644 --- a/src/nqrduck_broadband/model.py +++ b/src/nqrduck_broadband/model.py @@ -20,7 +20,7 @@ class BroadbandModel(ModuleModel): self.start_frequency = self.MIN_FREQUENCY self.stop_frequency = self.MAX_FREQUENCY self.DEFAULT_FREQUENCY_STEP = self.DEFAULT_FREQUENCY_STEP - self.current_broadcast_measurement = None + self.current_broadband_measurement = None @property def start_frequency(self): @@ -49,12 +49,12 @@ class BroadbandModel(ModuleModel): self._frequency_step = value @property - def current_broadcast_measurement(self): - return self._current_broadcast_measurement + def current_broadband_measurement(self): + return self._current_broadband_measurement - @current_broadcast_measurement.setter - def current_broadcast_measurement(self, value): - self._current_broadcast_measurement = value + @current_broadband_measurement.setter + def current_broadband_measurement(self, value): + self._current_broadband_measurement = value class BroadbandMeasurement(QObject): """This class represents a single broadband measurement.""" @@ -160,7 +160,7 @@ class BroadbandModel(ModuleModel): # We append the frequency values of the current spectrum and shift them by the target frequency fdx_assembled = np.append(fdx_assembled, -self.frequency_step/2 * 1e-6 + measurement.target_frequency * 1e-6) fdx_assembled = np.append(fdx_assembled, measurement.fdx[idx_xf_lower + 1:idx_xf_upper - 1] + measurement.target_frequency * 1e-6) - + # On the first run we will get an Index Error except IndexError: fdy_assembled = np.array([yf_interp_lower]) diff --git a/src/nqrduck_broadband/view.py b/src/nqrduck_broadband/view.py index 5767937..2d6a750 100644 --- a/src/nqrduck_broadband/view.py +++ b/src/nqrduck_broadband/view.py @@ -179,7 +179,7 @@ class BroadbandView(ModuleView): """ # Get last measurement from the broadband measurement object that is not None logger.debug("Updating broadband plot.") - measurement = self.module.model.current_broadcast_measurement.get_last_completed_measurement() + measurement = self.module.model.current_broadband_measurement.get_last_completed_measurement() td_plotter = self._ui_form.time_domainPlot.canvas.ax fd_plotter = self._ui_form.frequency_domainPlot.canvas.ax @@ -191,7 +191,7 @@ class BroadbandView(ModuleView): td_plotter.plot(measurement.tdx, measurement.tdy) fd_plotter.plot(measurement.fdx * 1e-6, measurement.fdy * 1e-6) - broadband_plotter.plot(self.module.model.current_broadcast_measurement.broadband_data_fdx, self.module.model.current_broadcast_measurement.broadband_data_fdy) + broadband_plotter.plot(self.module.model.current_broadband_measurement.broadband_data_fdx, self.module.model.current_broadband_measurement.broadband_data_fdy) self.set_timedomain_labels() self.set_frequencydomain_labels() @@ -201,7 +201,7 @@ class BroadbandView(ModuleView): self._ui_form.frequency_domainPlot.canvas.draw() self._ui_form.broadbandPlot.canvas.draw() - value = int(self.module.model.current_broadcast_measurement.get_finished_percentage()) + value = int(self.module.model.current_broadband_measurement.get_finished_percentage()) logger.debug("Updating progress bar to: " + str(value)) self._ui_form.measurementProgress.setValue(value) self._ui_form.measurementProgress.update()