diff --git a/src/quackseq/event.py b/src/quackseq/event.py index 054256d..921c9b7 100644 --- a/src/quackseq/event.py +++ b/src/quackseq/event.py @@ -46,7 +46,7 @@ class Event: ) @classmethod - def load_event(cls, event, pulse_parameter_options): + def load_event(cls, event, pulse_sequence): """Loads an event from a dict. The pulse paramter options are needed to load the parameters @@ -54,12 +54,14 @@ class Event: Args: event (dict): The dict with the event data - pulse_parameter_options (dict): The dict with the pulse parameter options + pulse_sequence (PulseSequence): The pulse sequence the event belongs to Returns: Event: The loaded event """ - obj = cls(event["name"], event["duration"]) + obj = cls(event["name"], event["duration"], pulse_sequence) + + pulse_parameter_options = pulse_sequence.pulse_parameter_options for parameter in event["parameters"]: for pulse_parameter_option in pulse_parameter_options.keys(): # This checks if the pulse paramter options are the same as the ones in the pulse sequence diff --git a/src/quackseq/pulsesequence.py b/src/quackseq/pulsesequence.py index ddfe6f2..2ba3b90 100644 --- a/src/quackseq/pulsesequence.py +++ b/src/quackseq/pulsesequence.py @@ -118,7 +118,7 @@ class PulseSequence: return data @classmethod - def load_sequence(cls, sequence, pulse_parameter_options): + def load_sequence(cls, sequence): """Loads a pulse sequence from a dict. The pulse paramter options are needed to load the parameters @@ -141,7 +141,8 @@ class PulseSequence: raise KeyError("Pulse sequence version not found") for event_data in sequence["events"]: - obj.events.append(cls.Event.load_event(event_data, pulse_parameter_options)) + event = Event.load_event(event_data, obj) + obj.events.append(event) return obj