Beispiel #1
0
    sym3.append(fid_1)
    sym12.append(fid_2)

    if fid_0 > 0.985:
        print("1@ " + str(x) + ", " + str(fid_0))
    if fid_1 > 0.980:
        print("3@ " + str(x) + ", " + str(fid_1))
    if fid_2 > 0.980:
        print("12@ " + str(x) + ", " + str(fid_2))

    update_plots(fig, ax, \
        [p1, p3, p15], \
        [p_t, p_t, p_t], \
        [sym1, sym3, sym12] )

print "Total Time: " + str(time.time() - fullstart)

if not os.path.exists(base):
    print "Creating directory (at end)"
    os.makedirs(base)

np.savetxt(base + "figfindTaus.txt", xlist)
np.savetxt(base + "figfind1.txt", sym1)
np.savetxt(base + "figfind3.txt", sym3)
np.savetxt(base + "figfind12.txt", sym12)
pshape.savefig(base + "pulseshape.png")
fig.savefig(base + "figfind.png")

print("Done! Press Enter to exit.")
raw_input()
Beispiel #2
0
    if fid_sym > 0.990:
        print("1@ " + str(tau) + ", " + str(fid_sym))

    rho_sym, us = ezGenerate_Rho(sym_pi, t_end, times[1], eta_0, rho_0, N,
                                 stepsize)
    fid_sym = fidSingleTxDirect(rho_f, rho_sym, tau)
    sym3.append(fid_sym)
    if fid_sym > 0.990:
        print("3@ " + str(tau) + ", " + str(fid_sym))

    rho_sym, us = ezGenerate_Rho(sym_pi, t_end, times[2], eta_0, rho_0, N,
                                 stepsize)
    fid_sym = fidSingleTxDirect(rho_f, rho_sym, tau)
    sym15.append(fid_sym)
    if fid_sym > 0.990:
        print("15@ " + str(tau) + ", " + str(fid_sym))

    update_plots(fig, ax, \
        [p1, p3, p15], \
        [p_t, p_t, p_t], \
        [sym1, sym3, sym15] )

np.savetxt("data/figfindTaus", taus)
np.savetxt("data/figfind1.txt", sym1)
np.savetxt("data/figfind3.txt", sym3)
np.savetxt("data/figfind15.txt", sym15)
fig.savefig("data/figfind.png")

print("Done! Press Enter to exit.")
raw_input()
Beispiel #3
0
        rho_asym, us = ezGenerate_Rho(asym_pi, t_end, tau_c, eta_0, rho_0, N,
                                      stepsize)
        fid_asym = fidSingleTxDirect(rho_f, rho_asym, mytau)
        fids_asym.append(fid_asym)

    update_plots(fig, ax, \
        pulse_plots, \
        [p_t for i in range(len(pulse_plots))], \
        fidelities )

    miniend = time.time()
    prev_time = miniend - ministart
print("time taken: " + str(time.time() - start))

if do_pi:
    np.savetxt("data/q3/check-bad/fids_pi.txt", fids_pi)
if do_c:
    np.savetxt("data/q3/check-bad/fids_C.txt", fids_C)
if do_sc:
    np.savetxt("data/q3/check-bad/fids_SC.txt", fids_SC)
if do_sym:
    np.savetxt("data/q3/check-bad/fids_sym.txt", fids_sym)
if do_asym:
    np.savetxt("data/q3/check-bad/fids_asym.txt", fids_asym)

shapefig.savefig("data/q3/check-bad/shape.png")
fig.savefig("data/q3/check-bad/fig.png")

print("Done! Press Enter to exit.")
raw_input()
Beispiel #4
0
Datei: q1.py Projekt: wiwa/qc
n = 8 # number of different pulse amplitudes
epsilon = 0.009 # amount each gradient step can influence amps
grape_steps = 3000 # number of optimization steps
### Grape
doGrape = True
if doGrape:
    tau_grape = 30. # optimize for this point...
    # init_amps = [a_max for i in range(n)]
    init_amps = [x*a_max for x in [-1, -1, 1, 1, 1, 1, 1, -1]]
    grape_amps = init_amps
    for i in range(grape_steps):
        start = time.time()
        grape_amps = GRAPE(T_G, n, 42, rho_0, rho_f, tau_grape, eta_0, stepsize, grape_amps, epsilon)
        print("grapestep: " + str(time.time() - start))
        print(grape_amps)
    np.savetxt("data/grape_pulse.txt", grape_amps)
    grape_pulse = aggAmps(grape_amps, T_G)
else:
    T_G = T_pi
    grape_pulse = aggAmps([a_max,a_max,a_max,a_max], T_G)

doContinue = True
if not doContinue:
    sys.exit()
# grape_pulse = aggPulse(buildGrapePulses([1.,1.,1.,1.], T_pi))
# print(integrate.quad(grape_pulse, 0, 3.5))
# print(integrate.quad(a_pi, 0, 3.5))
# tau_cs = [0.4, 1.8, 3., 5., 10.]
eta_0_a_max = eta_0 / a_max
print("""
rho_0:
Beispiel #5
0
# doGrape = True
doGrape = False
if doGrape:
    tau_grape = 30.
    # init_amps = [a_max for i in range(n)]
    inits = [-0.7, 0.7, 0.7, 0.7, 0.7, 0.7, -0.7]
    # inits = [-0.98,0.98,0.98,0.98,0.98,0.98,-0.98]
    init_amps = [x * a_max for x in inits]
    grape_amps = init_amps
    for i in range(grape_steps):
        start = time.time()
        grape_amps = GRAPE(T_G, n, 42, rho_0, rho_f, tau_grape, eta_0,
                           stepsize, grape_amps, epsilon)
        print("grapestep " + str(i) + ": " + str(time.time() - start))
        print(grape_amps)
    np.savetxt(base + "grape_pulse.txt", grape_amps)
    grape_pulse = aggAmps(grape_amps, T_G)
else:
    T_G = T_pi
    grape_pulse = aggAmps([a_max, a_max, a_max, a_max], T_G)

doContinue = True
if not doContinue:
    sys.exit()
# grape_pulse = aggPulse(buildGrapePulses([1.,1.,1.,1.], T_pi))
# print(integrate.quad(grape_pulse, 0, 3.5))
# print(integrate.quad(a_pi, 0, 3.5))
# tau_cs = [0.4, 1.8, 3., 5., 10.]
eta_0_a_max = eta_0 / a_max
print(
    """