if best_res['status'] > 0:
    plt.text(8, -2, "Minimization did not converge", fontdict={"size" : 10})
if best_trap['status'] > 0:
    plt.text(2, -2, "Minimization did not converge", fontdict={"size" : 10})

plt.xlabel("$x$ ($\mu$m)")
plt.ylabel("$y$ ($\mu$m)")
plt.title("Combined model: res, trap = (%d, %d) electrons" % (N_resonator_electrons, N_trap_electrons))
plt.colorbar()
plt.xlim(np.min(x_eval), 18)  # np.max(x_eval) + resonator_box_length * 1E6)
plt.ylim(np.min(y_eval), np.max(y_eval))

#common.save_figure(fig2, save_path=save_path)

num_unbounded_electrons = anneal.check_unbounded_electrons(best_trap['x'],
                                                           xdomain=(np.min(x_eval) * 1E-6, np.max(x_eval) * 1E-6),
                                                           ydomain=(np.min(y_eval) * 1E-6, np.max(y_eval) * 1E-6))

print("Number of unbounded electrons = %d" % num_unbounded_electrons)

resonator_ns_area = anneal.get_electron_density_by_area(anneal.xy2r(res_electrons_x, res_electrons_y))
resonator_ns_pos = anneal.get_electron_density_by_position(anneal.xy2r(res_electrons_x, res_electrons_y))
print("Electron density on resonator = %.2e (by area) or %.2e (by position)" % (resonator_ns_area, resonator_ns_pos))

fig3 = plt.figure(figsize=(6, 6))
common.configure_axes(12)
plt.subplot(211)
plt.plot(x_eval, CMS.V(x_eval*1E-6, 0), color='violet', lw=1.5)
plt.xlabel("$x$ ($\mu$m)")
plt.ylabel("Energy (eV)")
plt.xlim(np.min(x_eval), np.max(x_eval))
Exemple #2
0
        plt.grid()
        plt.legend(loc=0, ncol=2, prop={'size': 9})

        common.save_figure(figgy, save_path=os.path.join(save_path, sub_dir))

if 0:
    y_in_domain = EP.map_y_into_domain(y)

    figgy = plt.figure(figsize=(4, 6))
    common.configure_axes(12)
    plt.pcolormesh(x_box * 1E6,
                   y_box * 1E6,
                   EP.V(X_box, Y_box),
                   cmap=plt.cm.Spectral_r,
                   vmax=0.0)
    EP.draw_resonator_pins(0.72, 0.5, 0.5, **{'color': 'black', 'alpha': 0.25})
    plt.plot(xinit * 1E6, yinit * 1E6, 'o', color='palegreen', alpha=0.5)
    plt.plot(x * 1E6, y_in_domain * 1E6, 'o', color='deepskyblue', alpha=1.0)
    plt.xlim(np.min(x_box) * 1E6, np.max(x_box) * 1E6)
    plt.xlabel("$x$ ($\mu$m)")
    plt.ylabel("$y$ ($\mu$m)")
    plt.colorbar()

    plt.show()

    num_unbounded_electrons = anneal.check_unbounded_electrons(
        res['x'],
        xdomain=(np.min(x_box), np.max(x_box)),
        ydomain=(np.min(y_box), np.max(y_box)))

    print("Number of unbounded electrons = %d" % num_unbounded_electrons)