Skip to content

Commit

Permalink
Added support for multiple amplitudes to multifreq
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonardo Razani committed Nov 5, 2020
1 parent b3166a9 commit 289e007
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
9 changes: 6 additions & 3 deletions QGL/PulsePrimitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ def arb_axis_drag(qubit,


def DiatomicPulse(qubit, a, b, c):
return (Ztheta(qubit, angle=c) + X90(qubit) +
Ztheta(qubit, angle=b) + X90(qubit) +
return (Ztheta(qubit, angle=c) + X90(qubit) +
Ztheta(qubit, angle=b) + X90(qubit) +
Ztheta(qubit, angle=a))

def ZYZPulse(qubit, a, b, c):
Expand Down Expand Up @@ -586,6 +586,10 @@ def PARAM(chan, **kwargs):
params['frequency'] = tuple(chan.autodyne_freq)
else:
params['frequency'] = tuple(kwargs['frequency'])
if 'amp_factor' not in kwargs:
params['amp_factor'] = tuple(chan.amp_factor)
else:
params['amp_factor'] = tuple(kwargs['amp_factor'])
params['baseShape'] = params.pop('shape_fun')
params['shape_fun'] = PulseShapes.multifrequency
amp = params.pop('amp')
Expand All @@ -599,4 +603,3 @@ def PARAM(chan, **kwargs):

return Pulse("PARAM", chan, params,
amp, phase, 0.0, ignoredStrParams=ignoredStrParams)

10 changes: 7 additions & 3 deletions QGL/PulseShapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,19 +196,23 @@ def autodyne(frequency=10e6, baseShape=constant, **params):
return shape


def multifrequency(frequency=[10e6], baseShape=constant, **params):
def multifrequency(amp_factor = [1],frequency=[10e6], baseShape=constant, **params):
"""
A pulse with more than one frequency baked in.
"""
if not isinstance(frequency, Iterable):
frequency = (frequency,)
if not isinstance(amp_factor, Iterable):
amp_factor = (amp_factor,)
if isinstance(baseShape, str):
shape = globals()[baseShape](**params)
else:
shape = baseShape(**params)
timePts = np.linspace(0, params['length'], len(shape))
for freq in frequency:
shape *= np.exp(-1j * 2 * np.pi * freq * timePts)
mod = np.zeros(len(shape),dtype = np.complex128)
for a,freq in zip(amp_factor,frequency):
mod += a*np.exp(-1j * 2 * np.pi * freq * timePts)
shape *= mod
return shape


Expand Down

0 comments on commit 289e007

Please sign in to comment.