From 0e755a6cc586606a0c2591c75af359b8a376d071 Mon Sep 17 00:00:00 2001 From: jupfi Date: Fri, 14 Jul 2023 15:07:54 +0200 Subject: [PATCH] Changed event saving to list. --- src/nqrduck_spectrometer/base_spectrometer_model.py | 3 +++ src/nqrduck_spectrometer/pulse_sequence.py | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/nqrduck_spectrometer/base_spectrometer_model.py b/src/nqrduck_spectrometer/base_spectrometer_model.py index 8df8da6..44a26d4 100644 --- a/src/nqrduck_spectrometer/base_spectrometer_model.py +++ b/src/nqrduck_spectrometer/base_spectrometer_model.py @@ -33,6 +33,9 @@ class BaseSpectrometerModel(ModuleModel): logger.debug("Setting %s changed to %s", self.name, value) self.value = value + def get_setting(self): + return float(self.value) + class PulseParameter: def __init__(self, name): self.name = name diff --git a/src/nqrduck_spectrometer/pulse_sequence.py b/src/nqrduck_spectrometer/pulse_sequence.py index ed47a44..37cef20 100644 --- a/src/nqrduck_spectrometer/pulse_sequence.py +++ b/src/nqrduck_spectrometer/pulse_sequence.py @@ -7,7 +7,7 @@ class PulseSequence: """A pulse sequence is a collection of events that are executed in a certain order.""" def __init__(self, name) -> None: self.name = name - self.events = OrderedDict() + self.events = list() def get_event_names(self) -> list: return [event.name for event in self.events] @@ -33,16 +33,16 @@ class PulseSequence: "name": self.name, "events": [] } - for event in self.events.keys(): + for event in self.events: event_data = { - "name": self.events[event].name, - "duration": self.events[event].duration, + "name": event.name, + "duration": event.duration, "parameters": [] } - for parameter in self.events[event].parameters.keys(): + for parameter in event.parameters.keys(): event_data["parameters"].append({ "name": parameter, - "value": self.events[event].parameters[parameter].get_options() + "value": event.parameters[parameter].get_options() }) data["events"].append(event_data) return data \ No newline at end of file