From 36df8489838089e2d11a5f608260a3a339915201 Mon Sep 17 00:00:00 2001 From: jupfi Date: Wed, 29 May 2024 10:26:19 +0200 Subject: [PATCH] Moved general methods to base class. --- .../simulator_controller.py | 52 +------------------ 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/src/quackseq_simulator/simulator_controller.py b/src/quackseq_simulator/simulator_controller.py index df180ca..4f0af27 100644 --- a/src/quackseq_simulator/simulator_controller.py +++ b/src/quackseq_simulator/simulator_controller.py @@ -226,54 +226,4 @@ class SimulatorController(SpectrometerController): ) simulation_length = self.calculate_simulation_length(sequence) dwell_time = simulation_length / n_points - return dwell_time - - def calculate_simulation_length(self, sequence: QuackSequence) -> float: - """This method calculates the simulation length based on the settings and the pulse sequence. - - Returns: - float: The simulation length in seconds. - """ - events = sequence.events - simulation_length = 0 - for event in events: - simulation_length += event.duration - return simulation_length - - def translate_rx_event(self, sequence: QuackSequence) -> tuple: - """This method translates the RX event of the pulse sequence to the limr object. - - Returns: - tuple: A tuple containing the start and stop time of the RX event in µs - """ - # This is a correction factor for the RX event. The offset of the first pulse is 2.2µs longer than from the specified samples. - events = sequence.events - - previous_events_duration = 0 - # offset = 0 - rx_duration = 0 - for event in events: - logger.debug("Event %s has parameters: %s", event.name, event.parameters) - for parameter in event.parameters.values(): - logger.debug( - "Parameter %s has options: %s", parameter.name, parameter.options - ) - - if ( - parameter.name == sequence.RX_READOUT - and parameter.get_option_by_name(RXReadout.RX).value - ): - # Get the length of all previous events - previous_events = events[: events.index(event)] - previous_events_duration = sum( - [event.duration for event in previous_events] - ) - rx_duration = event.duration - - rx_begin = float(previous_events_duration) - if rx_duration: - rx_stop = rx_begin + float(rx_duration) - return rx_begin * 1e6, rx_stop * 1e6 - - else: - return None, None + return dwell_time \ No newline at end of file