Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sequencing/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def sine(xs, amp=1, f0=1, phi=0, ofs=0.5):
def fit_displacement(xs, ys):
def displacement(xs, xscale=1.0, amp=1, ofs=0, n=0):
alphas = xs * xscale
nbars = alphas ** 2
return ofs + amp * nbars ** n / factorial(int(n)) * np.exp(-nbars)
nbars = alphas**2
return ofs + amp * nbars**n / factorial(int(n)) * np.exp(-nbars)

if xs[-1] > xs[0]:
amp = ys[0] - ys[-1]
Expand Down
14 changes: 7 additions & 7 deletions sequencing/pulses.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,20 @@ def array_pulse(

def gaussian_wave(sigma, chop=4):
ts = np.linspace(-chop // 2 * sigma, chop // 2 * sigma, int(chop * sigma // 4) * 4)
P = np.exp(-(ts ** 2) / (2.0 * sigma ** 2))
P = np.exp(-(ts**2) / (2.0 * sigma**2))
ofs = P[0]
return (P - ofs) / (1 - ofs)


def gaussian_deriv_wave(sigma, chop=4):
ts = np.linspace(-chop // 2 * sigma, chop // 2 * sigma, int(chop * sigma // 4) * 4)
ofs = np.exp(-ts[0] ** 2 / (2 * sigma ** 2))
return (0.25 / sigma ** 2) * ts * np.exp(-(ts ** 2) / (2 * sigma ** 2)) / (1 - ofs)
ofs = np.exp(-ts[0] ** 2 / (2 * sigma**2))
return (0.25 / sigma**2) * ts * np.exp(-(ts**2) / (2 * sigma**2)) / (1 - ofs)


def gaussian_chop(t, sigma, t0):
P = np.exp(-(t ** 2) / (2.0 * sigma ** 2))
ofs = np.exp(-(t0 ** 2) / (2.0 * sigma ** 2))
P = np.exp(-(t**2) / (2.0 * sigma**2))
ofs = np.exp(-(t0**2) / (2.0 * sigma**2))
return (P - ofs) / (1 - ofs)


Expand Down Expand Up @@ -135,9 +135,9 @@ def _ring_up(ts):
if np.abs(ts) < ramp_offset:
return 1.0
elif ts > ramp_offset:
return np.exp(-((ts - ramp_offset) ** 2) / (2.0 * sigma ** 2))
return np.exp(-((ts - ramp_offset) ** 2) / (2.0 * sigma**2))
else: # ts < ramp_offset
return np.exp(-((ts + ramp_offset) ** 2) / (2.0 * sigma ** 2))
return np.exp(-((ts + ramp_offset) ** 2) / (2.0 * sigma**2))

ts = np.linspace(-length + 1, 0, length)
P = np.array([_ring_up(t) for t in ts])
Expand Down