mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-12-22 11:33:32 +01:00
ZH: gridpower with time offsets zooms on some shifted traces
This commit is contained in:
parent
f698010ddf
commit
5ccba0158c
1 changed files with 38 additions and 4 deletions
|
@ -194,19 +194,49 @@ if __name__ == "__main__":
|
|||
power_sort_idx = np.argsort(a_max)
|
||||
|
||||
N_plot = 30
|
||||
for i, idx in enumerate(power_sort_idx):
|
||||
for i, idx in enumerate(reversed(power_sort_idx)):
|
||||
if i > N_plot:
|
||||
break
|
||||
|
||||
alpha = max(0.7, 1/len(a_))
|
||||
alpha = max(0.4, 1/len(a_))
|
||||
|
||||
axs.plot(t_[idx], a_[idx], color='r', alpha=alpha)
|
||||
axs.plot(t_[idx], a_[idx], color='r', alpha=alpha, lw=2)
|
||||
|
||||
if fig_dir:
|
||||
fig.tight_layout()
|
||||
|
||||
fig.savefig(path.join(fig_dir, path.basename(__file__) + f'.trace_overlap.{case}.pdf'))
|
||||
fig.savefig(path.join(fig_dir, path.basename(__file__) + f'.trace_overlap.{case}.png'), transparent=True)
|
||||
|
||||
# Take center between t_low and t_high
|
||||
if True:
|
||||
orig_xlims = axs.get_xlim()
|
||||
|
||||
if not True: # t_high and t_low from strongest signal
|
||||
t_low = np.min(t_[power_sort_idx[-1]])
|
||||
t_high = np.max(t_[power_sort_idx[-1]])
|
||||
else: # take t_high and t_low from plotted signals
|
||||
a = [np.min(t_[idx]) for idx in power_sort_idx[-N_plot:]]
|
||||
axs.plot(a, [0]*N_plot, 'gx', ms=10)
|
||||
t_low = np.nanmin(a)
|
||||
b = [np.max(t_[idx]) for idx in power_sort_idx[-N_plot:]]
|
||||
axs.plot(b, [0]*N_plot, 'b+', ms=10)
|
||||
t_high = np.nanmax(b)
|
||||
|
||||
center_x = (t_high - t_low)/2 + t_low
|
||||
wx = 200
|
||||
|
||||
low_xlim = max(orig_xlims[0], center_x - wx)
|
||||
high_xlim = min(orig_xlims[1], center_x + wx)
|
||||
|
||||
axs.set_xlim(low_xlim, high_xlim)
|
||||
fig.savefig(path.join(fig_dir, path.basename(__file__) + f'.trace_overlap.zoomed.{case}.pdf'))
|
||||
fig.savefig(path.join(fig_dir, path.basename(__file__) + f'.trace_overlap.zoomed.{case}.png'), transparent=True)
|
||||
|
||||
|
||||
if True:
|
||||
continue
|
||||
|
||||
# Measure power on grid
|
||||
for scalename, scale in scales.items():
|
||||
wx, wy = scale, scale
|
||||
|
@ -223,3 +253,7 @@ if __name__ == "__main__":
|
|||
if fig_dir:
|
||||
fig.tight_layout()
|
||||
fig.savefig(path.join(fig_dir, path.basename(__file__) + f'.X{X}.{case}.{scalename}.pdf'))
|
||||
|
||||
if args.show_plots:
|
||||
plt.show()
|
||||
|
||||
|
|
Loading…
Reference in a new issue