Added frequency target_frequency property.

This commit is contained in:
jupfi 2024-03-14 17:04:43 +01:00
parent 6d990c609e
commit e717cb2a24
2 changed files with 20 additions and 7 deletions

View file

@ -302,13 +302,16 @@ class SimulatorController(BaseSpectrometerController):
"""This method is called when the set_frequency signal is received from the core.
For the simulator this just prints a warning that the simulator is selected.
"""
self.module.nqrduck_signal.emit(
"notification",
[
"Warning",
"Could not set averages to because the simulator is selected as active spectrometer ",
],
)
logger.debug("Setting frequency to: %s", value)
try:
self.module.model.target_frequency = float(value)
logger.debug("Successfully set frequency to: %s", value)
except ValueError:
logger.warning("Could not set frequency to: %s", value)
self.module.nqrduck_signal.emit(
"notification", ["Error", "Could not set frequency to: " + value]
)
self.module.nqrduck_signal.emit("failure_set_frequency", value)
def set_averages(self, value: str) -> None:
"""This method is called when the set_averages signal is received from the core.

View file

@ -283,6 +283,7 @@ class SimulatorModel(BaseSpectrometerModel):
self.add_pulse_parameter_option(self.RX, RXReadout)
self.averages = 1
self.target_frequency = 100e6
# Try to load the pulse programmer module
try:
@ -301,3 +302,12 @@ class SimulatorModel(BaseSpectrometerModel):
@averages.setter
def averages(self, value):
self._averages = value
@property
def target_frequency(self):
return self._target_frequency
@target_frequency.setter
def target_frequency(self, value):
self._target_frequency = value