ax.yaxis.set_label_text("Normalized Scattering Cross Section")
        if 1.33 <= nd < 1.34:
            ax.set_facecolor(np.array([230, 241, 255]) / 255)
            # frame = leg.get_frame()
            # frame.set_facecolor( np.array([230, 241, 255])/255 )

# plt.xlabel("Wavelength [nm]")
# plt.ylabel("Normalized Scattering Cross Section")
if plot_make_big:
    mng = plt.get_current_fig_manager()
    mng.window.showMaximized()
del mng
fig.tight_layout()
plt.subplots_adjust(hspace=0)

vs.saveplot(plot_file("AllScattNorm.png"), overwrite=True)

#%% PLOT EFFIENCIENCY

colors = [
    sc(np.linspace(0, 1,
                   len(s) + 3))[3:] for sc, s in zip(series_colors, series)
]

fig, axes = plt.subplots(2, 1, sharex=True)
fig.suptitle(plot_title)
axes[1].yaxis.tick_right()
axes[1].yaxis.set_label_position("right")

for ax, s, d, t, p, n, sc, psl, tsl, pc, pls, tls in zip(
        axes, series, data, theory, params, index, series_column, series_label,
Пример #2
0
             mdt[:, 1] / max(mdt[:, 1]),
             linestyle='dashed',
             color=c,
             label=f"Marian Exp {d} nm")
plt.style.use('default')
for mdt, d, c in zip(marian_mie_data, diameters, colors):
    plt.plot(mdt[:, 0],
             mdt[:, 1] / max(mdt[:, 1]),
             linestyle="dotted",
             color=c,
             label=f"Marian Mie {d} nm")
plt.xlabel("Wavelength [nm]")
plt.ylabel("Normalized Scattering [a.u.]")
plt.xlim([450, 650])
plt.legend(ncol=4, framealpha=1)
vs.saveplot(water_file("", "AllScatt.png"), overwrite=True)

#%% 1st: PLOT 103 nm ALL: VACUUM, WATER, MARIAN EXPERIMENTAL, MARIAN MIE
# This makes up the first figures I've made, the ones that confused me

colors = (c for c in plab.cm.Reds(np.linspace(0, 1, 2 + 5))[2:])

plt.figure()
plt.title("Scattering of Au sphere (103 nm diameter)")
scatt = vacuum_data[-1][:, 1]  #* np.pi * (diameters[-1]**2) / 4
plt.plot(vacuum_data[-1][:, 0],
         scatt / max(scatt),
         linestyle="solid",
         color=next(colors),
         label="Vacuum")
scatt = water_data[-1][:, 1]  #* np.pi * (diameters[-1]**2) / 4
Пример #3
0
max_wlen_theory = wlens[np.argmax(scatt_eff_theory)]

dif_max_wlen = [ml - max_wlen_theory for ml in max_wlen[0]]

#%% WAVELENGTH MAXIMUM DIFFERENCE VS TIME FACTOR CELL

second_time_factor = [p["second_time_factor"] for p in params[0]]

plt.title("Difference in scattering maximum for " + plot_title)
plt.plot(second_time_factor, dif_max_wlen, '.', markersize=12)
plt.grid(True)
plt.legend(["Data", r"Fit $f(r)=a_0 e^{-a_1 r} + a_2$"])
plt.xlabel("Second time factor")
plt.ylabel(
    "Difference in wavelength $\lambda_{max}^{MEEP}-\lambda_{max}^{MIE}$ [nm]")
vs.saveplot(plot_file("WLenDiff.png"), overwrite=True)

#%% GET ENLAPSED TIME COMPARED

second_time_factor = [[p["second_time_factor"] for p in par] for par in params]
enlapsed_time = [[p["enlapsed"] for p in par] for par in params]
total_enlapsed_time = [[sum(p["enlapsed"]) for p in par] for par in params]

first_second_time_factor = []
second_second_time_factor = []
first_build_time = []
first_sim_time = []
second_flux_time = []
second_build_time = []
second_sim_time = []
for enl, stf in zip(enlapsed_time, second_time_factor):
Пример #4
0
data = []
params = []
for s in series:
    data.append(np.loadtxt(file(s, "Results.txt")))
    params.append(vs.retrieve_footer(file(s, "Results.txt")))
header = vs.retrieve_header(file(s, "Results.txt"))

params = [vu.fix_params_dict(p) for p in params]

r = [p["r"] for p in params]
from_um_factor = [p["from_um_factor"] for p in params]

#%% GET MAX WAVELENGTH

max_wlen = [data[i][np.argmax(data[i][:, 1]), 0] for i in range(len(data))]

#%% PLOT

colors = plab.cm.Blues(np.linspace(0, 1, len(series) + 3))[3:]

plt.figure()
for s, d, c, p in zip(series, data, colors, params):
    scatt = d[:, 1] * np.pi * (p["r"] * p["from_um_factor"])**2
    scatt = scatt
    plt.plot(d[:, 0], scatt, linestyle='solid', color=c, label=series_label(s))
plt.xlabel("Wavelength [nm]")
plt.ylabel("Scattering Cross Section [$\mu$m$^2$]")
plt.legend()
vs.saveplot(file("", "AllScatt.png"), overwrite=True)
def exponential_fit(X, A, b, C):
    return A * np.exp(-b * X) + C


rsq, parameters = va.nonlinear_fit(np.array(resolution),
                                   np.array(dif_max_wlen),
                                   exponential_fit,
                                   par_units=["nm", "", "nm"])

plt.title("Difference in scattering maximum for Au 103 nm sphere in vacuum")
plt.legend(["Data", r"Fit $f(r)=a_0 e^{-a_1 r} + a_2$"])
plt.xlabel("Resolution")
plt.ylabel(
    "Difference in wavelength $\lambda_{max}^{MEEP}-\lambda_{max}^{MIE}$")
vs.saveplot(plot_file("WLenDiff.png"), overwrite=True)

#%% GET ENLAPSED TIME

enlapsed_time = [params[0][i]["enlapsed"] for i in range(len(data[0]))]
total_enlapsed_time = [sum(et) for et in enlapsed_time]


def quartic_fit(X, A, b):
    return A * (X)**4 + b


rsq, parameters = va.nonlinear_fit(np.array(resolution),
                                   np.array(total_enlapsed_time),
                                   quartic_fit,
                                   par_units=["s", "s"])
Пример #6
0
                 markersize=12,
                 color=colors[i][1],
                 label=label)

plt.grid(True, axis="x", which="minor")
plt.grid(True, axis="x", which="major")
plt.legend(loc="lower right")
plt.xlabel(r"Wavelength difference $\lambda_{MEEP} - \lambda_{MIE}$ [nm]")
plt.title(plot_title)
ax = fig.axes[0]
ax.xaxis.set_minor_locator(AutoMinorLocator())
plt.show()
fig.set_size_inches([6.4, 4.07])
plt.tight_layout()

vs.saveplot(plot_file("WlenDif.png"), overwrite=True)

#%%

colors = [
    sc(np.linspace(0, 1,
                   len(s) + 3))[3:] for sc, s in zip(series_colors, series)
]

fig = plt.figure()
for i in range(len(data)):
    for j in range(len(data[i])):
        if j == 0: label = series_label[i]
        else: label = None
        plt.plot(marian_wlen_diff[i][j],
                 f"{2 * r[i][j] * from_um_factor[i][j] * 1e3:.0f} nm",
Пример #7
0
        ax.set_title(t)
        ax.plot(wl, f(eps), lst, color=col, label=l)
        ax.xaxis.set_label_text(r"Wavelength [$\mu$m]")
        ax.yaxis.set_label_text(y)
        ax.legend()
        ax.set_xlim(*wlen_range_jc)
        max_value.append(max(f(eps)))
        min_value.append(min(f(eps)))

for ax in axes:
    ax.set_ylim([
        min(min_value) - .1 * (max(max_value) - min(min_value)),
        max(max_value) + .1 * (max(max_value) - min(min_value))
    ])

vs.saveplot(plot_file(f"{material}DrudeLorentzJCFit.png"), overwrite=True)

#%%

for ax in axes:
    ax.set_ylim([-50, 50])
    if material == "Au":
        ax.set_xlim([.4, .8])
    elif material == "Ag":
        ax.set_xlim([.25, .8])
    else:
        raise ValueError("Material not recognized for zoom in plot")

vs.saveplot(plot_file(f"{material}DrudeLorentzJCFitZoom.png"), overwrite=True)

#%%