mirror of
https://github.com/nqrduck/quackseq-simulator.git
synced 2024-12-22 05:00:24 +00:00
Added some information for views.
This commit is contained in:
parent
36df848983
commit
964e98f8d8
3 changed files with 17 additions and 9 deletions
|
@ -7,7 +7,7 @@ from .simulator_controller import SimulatorController
|
|||
class Simulator(Spectrometer):
|
||||
def __init__(self):
|
||||
self.model = SimulatorModel()
|
||||
self.controller = SimulatorController(self.model)
|
||||
self.controller = SimulatorController(self)
|
||||
|
||||
def run_sequence(self, sequence):
|
||||
result = self.controller.run_sequence(sequence)
|
||||
|
|
|
@ -19,10 +19,10 @@ logger = logging.getLogger(__name__)
|
|||
class SimulatorController(SpectrometerController):
|
||||
"""The controller class for the nqrduck simulator module."""
|
||||
|
||||
def __init__(self, model):
|
||||
def __init__(self, simulator):
|
||||
"""Initializes the SimulatorController."""
|
||||
super().__init__()
|
||||
self.model = model
|
||||
self.simulator = simulator
|
||||
|
||||
def run_sequence(self, sequence: QuackSequence) -> None:
|
||||
"""This method is called when the start_measurement signal is received from the core.
|
||||
|
@ -62,7 +62,7 @@ class SimulatorController(SpectrometerController):
|
|||
result = result[evidx]
|
||||
|
||||
# Measurement name date + module + target frequency + averages + sequence name
|
||||
name = f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Simulator - {self.model.target_frequency / 1e6} MHz - {self.model.averages} averages - {sequence.name}"
|
||||
name = f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Simulator - {self.simulator.model.target_frequency / 1e6} MHz - {self.simulator.model.averages} averages - {sequence.name}"
|
||||
logger.debug(f"Measurement name: {name}")
|
||||
|
||||
measurement_data = Measurement(
|
||||
|
@ -81,7 +81,7 @@ class SimulatorController(SpectrometerController):
|
|||
Returns:
|
||||
Sample: The sample object created from the settings.
|
||||
"""
|
||||
model = self.model
|
||||
model = self.simulator.model
|
||||
atom_density = None
|
||||
sample_volume = None
|
||||
sample_length = None
|
||||
|
@ -190,7 +190,7 @@ class SimulatorController(SpectrometerController):
|
|||
Returns:
|
||||
Simulation: The simulation object created from the settings and the pulse sequence.
|
||||
"""
|
||||
model = self.model
|
||||
model = self.simulator.model
|
||||
|
||||
# noise = float(model.get_setting_by_name(model.NOISE).value)
|
||||
simulation = Simulation(
|
||||
|
@ -222,7 +222,9 @@ class SimulatorController(SpectrometerController):
|
|||
float: The dwell time in seconds.
|
||||
"""
|
||||
n_points = int(
|
||||
self.model.get_setting_by_display_name(self.model.NUMBER_POINTS).value
|
||||
self.simulator.model.get_setting_by_display_name(
|
||||
self.simulator.model.NUMBER_POINTS
|
||||
).value
|
||||
)
|
||||
simulation_length = self.calculate_simulation_length(sequence)
|
||||
dwell_time = simulation_length / n_points
|
||||
|
|
|
@ -111,6 +111,7 @@ class SimulatorModel(SpectrometerModel):
|
|||
"Adds a specified level of random noise to the simulation to mimic real-world signal variations.",
|
||||
min_value=0,
|
||||
max_value=100,
|
||||
slider=True,
|
||||
)
|
||||
self.add_setting("noise", noise_setting)
|
||||
|
||||
|
@ -185,6 +186,7 @@ class SimulatorModel(SpectrometerModel):
|
|||
"The absolute temperature during the experiment. This influences the SNR of the measurement.",
|
||||
min_value=0.1,
|
||||
max_value=400,
|
||||
slider=True,
|
||||
)
|
||||
self.add_setting("temperature", temperature_setting)
|
||||
|
||||
|
@ -195,6 +197,7 @@ class SimulatorModel(SpectrometerModel):
|
|||
"The signal loss occurring in the transmission path, affecting the effective RF pulse power.",
|
||||
min_value=0.1,
|
||||
max_value=60,
|
||||
slider=True,
|
||||
)
|
||||
self.add_setting("loss_tx", loss_tx_setting)
|
||||
|
||||
|
@ -205,6 +208,7 @@ class SimulatorModel(SpectrometerModel):
|
|||
"The signal loss in the reception path, which can reduce the signal that is ultimately detected.",
|
||||
min_value=0.1,
|
||||
max_value=60,
|
||||
slider=True,
|
||||
)
|
||||
self.add_setting("loss_rx", loss_rx_setting)
|
||||
|
||||
|
@ -214,7 +218,9 @@ class SimulatorModel(SpectrometerModel):
|
|||
2884,
|
||||
"Conversion factor (spectrometer units / V)",
|
||||
)
|
||||
self.add_setting("conversion_factor", conversion_factor_setting) # Conversion factor for the LimeSDR based spectrometer
|
||||
self.add_setting(
|
||||
"conversion_factor", conversion_factor_setting
|
||||
) # Conversion factor for the LimeSDR based spectrometer
|
||||
|
||||
# Sample settings
|
||||
sample_name_setting = StringSetting(
|
||||
|
|
Loading…
Reference in a new issue