mirror of
https://github.com/nqrduck/quackseq.git
synced 2024-11-12 22:11:54 +00:00
Fixed loading and saving of sequences.
This commit is contained in:
parent
a4a573c6e3
commit
b9cacb0d30
2 changed files with 8 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue