ZH: beacon removal figure saved with zoomed parts

This commit is contained in:
Eric Teunis de Boone 2023-01-16 18:40:59 +01:00
parent 1e7c469bb8
commit 7c570c462e
1 changed files with 18 additions and 9 deletions

View File

@ -234,13 +234,22 @@ if __name__ == "__main__":
# save
if fig_dir:
fig.tight_layout()
if True: # zoom
old_xlim = ax.get_xlim()
wx, x = 100, 0#ant.t_AxB[np.argmax(ant.E_AxB)]
ax.set_xlim(x-wx, x+wx)
if True: # zoomed on part without peak of this trace
wx, x = 100, 0#ant.t_AxB[np.argmax(ant.E_AxB)]
ax.set_xlim(x-wx, x+wx)
fig.savefig(path.join(fig_dir, __file__+f'.traces.zoomed.A{i}.pdf'))
fig.savefig(path.join(fig_dir, __file__+f'.traces.A{i}.zoomed.beacon.pdf'))
if True: # zoomed on peak of this trace
idx = np.argmax(ev.antennas[i].E_AxB)
x = ev.antennas[i].t_AxB[idx]
wx = 100
ax.set_xlim(x-wx, x+wx)
fig.savefig(path.join(fig_dir, __file__+f".traces.A{i}.zoomed.peak.pdf"))
ax.set_xlim(*old_xlim)
@ -263,7 +272,7 @@ if __name__ == "__main__":
scale2d = dXref*np.tan(np.deg2rad(2.))
scale4d = dXref*np.tan(np.deg2rad(4.))
if not True: #quicky
if False: #quicky
x_coarse = np.linspace(-scale2d, scale2d, 4)
y_coarse = np.linspace(-scale2d, scale2d, 4)
@ -289,15 +298,15 @@ if __name__ == "__main__":
for r in range(N_runs):
# Setup Plane grid to test
xoff, yoff = 0,0
if r == 0:
xoff, yoff = 0,0
x = x_coarse
y = y_coarse
else:
# zooming in
# best_idx is defined at the end of the loop
old_ks_per_loc = ks_per_loc[best_idx]
xoff = xx[best_idx]
yoff = yy[best_idx]
xoff, yoff = locs[best_idx]
if r == 1:
x = x_fine
y = y_fine
@ -305,7 +314,7 @@ if __name__ == "__main__":
x /= 4
y /= 4
print(f"Testing grid run {r} centered on {xoff}, {yoff}")
print(f"Testing grid run {r} centered on ({xoff}, {yoff})")
ks_per_loc = np.zeros( (len(x)*len(y), len(ev.antennas)) , dtype=int)
maxima_per_loc = np.zeros( (len(x)*len(y)))
@ -343,7 +352,7 @@ if __name__ == "__main__":
if True: #plot maximum at test locations
fig, axs = plt.subplots()
axs.set_title(f"Optimizing signal strength varying k per antenna,\n Grid Run {r}")
axs.set_title(f"Optimizing signal strength by varying $k$ per antenna,\n Grid Run {r}")
axs.set_ylabel("vxvxB [km]")
axs.set_xlabel(" vxB [km]")
axs.set_aspect('equal', 'datalim')