Skip to content

Commit

Permalink
fix custom pulse initialisation so that it works both with strings an…
Browse files Browse the repository at this point in the history
…d np arrays
  • Loading branch information
aorgazf authored and hay-k committed Aug 8, 2024
1 parent 11a1050 commit a5013cb
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/qibolab/pulses.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,11 +709,24 @@ def __init__(self, envelope_i, envelope_q=None):

self.name = "Custom"
self.pulse: Pulse = None
self.envelope_i: np.ndarray = np.array(literal_eval(envelope_i))
if envelope_q is not None:
self.envelope_q: np.ndarray = np.array(literal_eval(envelope_q))
else:
self.envelope_q = self.envelope_i
if isinstance(envelope_i, str):
self.envelope_i: np.ndarray = np.array(literal_eval(envelope_i))
if envelope_q is not None:
self.envelope_q: np.ndarray = np.array(literal_eval(envelope_q))
else:
self.envelope_q = self.envelope_i
elif isinstance(envelope_i, list):
self.envelope_i: np.ndarray = np.array(envelope_i)
if envelope_q is not None:
self.envelope_q: np.ndarray = np.array(envelope_q)
else:
self.envelope_q = self.envelope_i
elif isinstance(envelope_i, np.ndarray):
self.envelope_i: np.ndarray = envelope_i
if envelope_q is not None:
self.envelope_q: np.ndarray = envelope_q
else:
self.envelope_q = self.envelope_i

def envelope_waveform_i(self, sampling_rate=SAMPLING_RATE) -> Waveform:
"""The envelope waveform of the i component of the pulse."""
Expand Down

0 comments on commit a5013cb

Please sign in to comment.