Changed sweep resolution to number of points.

This commit is contained in:
jupfi 2023-08-18 17:02:34 +02:00
parent 11ab6c7e93
commit 912ffe1933
2 changed files with 18 additions and 4 deletions

View file

@ -49,9 +49,9 @@ class AutoTMController(ModuleController):
stop_frequency (str): The stop frequency in MHz. stop_frequency (str): The stop frequency in MHz.
""" """
FREQUENCY_STEP = 50000 # Hz N_POINTS = 400
MIN_FREQUENCY = 35e6 # Hz MIN_FREQUENCY = 35e6 # Hz
MAX_FREQUENCY = 300e6 # Hz MAX_FREQUENCY = 200e6 # Hz
try: try:
start_frequence = start_frequency.replace(",", ".") start_frequence = start_frequency.replace(",", ".")
@ -85,17 +85,18 @@ class AutoTMController(ModuleController):
self.module.view.add_info_text(error) self.module.view.add_info_text(error)
return return
frequency_step = (stop_frequency - start_frequency) / N_POINTS
logger.debug( logger.debug(
"Starting frequency sweep from %s to %s with step size %s", "Starting frequency sweep from %s to %s with step size %s",
start_frequency, start_frequency,
stop_frequency, stop_frequency,
FREQUENCY_STEP, frequency_step,
) )
# We create the frequency sweep spinner dialog # We create the frequency sweep spinner dialog
self.module.model.clear_data_points() self.module.model.clear_data_points()
self.module.view.create_frequency_sweep_spinner_dialog() self.module.view.create_frequency_sweep_spinner_dialog()
# Print the command 'f<start>f<stop>f<step>' to the serial connection # Print the command 'f<start>f<stop>f<step>' to the serial connection
command = "f%sf%sf%s" % (start_frequency, stop_frequency, FREQUENCY_STEP) command = "f%sf%sf%s" % (start_frequency, stop_frequency, frequency_step)
self.send_command(command) self.send_command(command)
def on_ready_read(self) -> None: def on_ready_read(self) -> None:
@ -434,5 +435,12 @@ class AutoTMController(ModuleController):
except AttributeError: except AttributeError:
logger.error("Could not send command. No device connected.") logger.error("Could not send command. No device connected.")
self.module.view.add_error_text("Could not send command. No device connected.") self.module.view.add_error_text("Could not send command. No device connected.")
def homing(self) -> None:
""" This method is used to send the command 'h' to the atm system.
This command is used to home the stepper motors of the atm system.
"""
logger.debug("Homing")
self.send_command("h")

View file

@ -34,6 +34,9 @@ class AutoTMView(ModuleView):
self._ui_form = Ui_Form() self._ui_form = Ui_Form()
self._ui_form.setupUi(self) self._ui_form.setupUi(self)
self.widget = widget self.widget = widget
self.frequency_sweep_spinner = self.FrequencySweepSpinner()
self.frequency_sweep_spinner.hide()
# Disable the connectButton while no devices are selected # Disable the connectButton while no devices are selected
self._ui_form.connectButton.setDisabled(True) self._ui_form.connectButton.setDisabled(True)
@ -85,6 +88,9 @@ class AutoTMView(ModuleView):
# On clicking of the switchATMButton call the switch_atm method # On clicking of the switchATMButton call the switch_atm method
self._ui_form.switchATMButton.clicked.connect(self.module.controller.switch_to_atm) self._ui_form.switchATMButton.clicked.connect(self.module.controller.switch_to_atm)
# On clicking of the homingButton call the homing method
self._ui_form.homingButton.clicked.connect(self.module.controller.homing)
# Connect the measurement finished signal to the plot_measurement slot # Connect the measurement finished signal to the plot_measurement slot
self.module.model.measurement_finished.connect(self.plot_measurement) self.module.model.measurement_finished.connect(self.plot_measurement)