Ejemplo n.º 1
0
def plotShape(pulsef, name, end=14*pi/3):
    shape = plt.figure()
    pulse_time = np.linspace(0, end, 5000)
    plt.plot(pulse_time, [pulsef(t) for t in pulse_time], "b-", label=name)
    plt.legend(loc="best")
    plt.ylabel(r"Amplitude in $a_{max}$")
    plt.xlabel(r"t in $\hbar/a_{max}$")
    plt.ylim([-1.1,1.1])
    plt.xlim([0.,end])
    filename = base + name.replace(" ", "_") + "-shape.png"
    shape.savefig(filename)
Ejemplo n.º 2
0
tis = np.linspace(0, 6, 1000)
pulseshape_data = [pulseshape(ti) for ti in tis]
pshape = plt.figure()
plt.plot(tis, pulseshape_data, 'b-')
# plt.show()

plt.ion()
fig, ax = plt.subplots()
fig.suptitle(wave + ":" + ptitle)

p1, = plt.plot(p_t, sym1, 'b--', label="t=1")
p3, = plt.plot(p_t, sym3, 'r-', label="t=3")
p15, = plt.plot(p_t, sym12, 'g--', label="t=12")

plt.xlabel(r"width in $\hbar / a_max$")
plt.ylabel(r"$\phi(\rho_f, \rho_0)$")
plt.legend(loc='best')
plt.show()
plt.pause(0.0001)


def SCORPSEfac(partition):
    def a_SC(t):
        if t <= 0:
            return 0
        if t < ((pi / 3) * hoa):
            return -a_max
        if t <= 2 * pi * hoa:
            return a_max
        if t < (partition):
            return -a_max
Ejemplo n.º 3
0
    if parallel:
        return pool.map(f, xs)
    return map(f, xs)


p_t = []

plt.ion()
fig, ax = plt.subplots()

p1, = plt.plot(p_t, sym1, 'b--', label="t=1")
p3, = plt.plot(p_t, sym3, 'r-', label="t=3")
p15, = plt.plot(p_t, sym15, 'g--', label="t=15")

plt.xlabel("tau in (hbar / a_max)")
plt.ylabel("fidelity \\phi(rho_f, rho_0)")
plt.legend(loc='best')
plt.show()
plt.pause(0.0001)

start = time.time()
prev_time = -1
for i in range(len(taus)):
    tau = taus[i]

    p_t.append(tau)
    sym_pi = X_factory(pi, a2_sym / tau, 0, False, tau=tau)
    sym_pi = X_factory(pi, a1_asym / tau, b1_asym / tau, True, tau=tau)
    # sym_pi = X_factory(pi, a2_asym / tau, b2_asym/tau, True, tau=tau)
    sym_pi = X_factory(pi, a1_sym / tau, 0, False, tau=tau)
Ejemplo n.º 4
0
if do_g:
    p_g, = plt.plot(p_t, fids_G, 'g-', label="GRAPE pulse")
    pulse_plots.append(p_g)
    #r"$f(x) = x^2$; width $\pi$, 2 periods, range $-a_{max}$ to $a_{max}$"
if do_sym:
    p_sym, = plt.plot(p_t, fids_sym, 'c--', label="Symmetric pulse")
    pulse_plots.append(p_sym)
if do_asym:
    p_asym, = plt.plot(p_t,
                       fids_asym,
                       'c-',
                       label=r"Symmetric pulse, $\tau$ = 9.325")
    pulse_plots.append(p_asym)

plt.xlabel(r"$\tau_c / (\hbar / a_{max})$")
plt.ylabel(r"$fidelity \phi(\rho_f, \rho_0)$")
plt.legend(loc='best')
plt.show()
plt.pause(0.0001)

start = time.time()
prev_time = -1
for i in range(len(tau_cs)):
    ministart = time.time()
    # if i % 15 is 0:
    sys.stdout.write("\r" + str(i) + "/" + str(len(tau_cs)) + "  " +
                     str(prev_time))
    print("\n")
    sys.stdout.flush()

    if profiling: