Added multi-thresh simulation to "full" and "short" (currently running).
Added complete "rect-lp" analysis except figure. Added multiple appendix figs. Overhauled normalization options across all condense scripts. Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
69
python/fig_kernel_sd_perc_appendix.py
Normal file
69
python/fig_kernel_sd_perc_appendix.py
Normal file
@@ -0,0 +1,69 @@
|
||||
import plotstyle_plt
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from thunderhopper.modeltools import load_data
|
||||
from thunderhopper.filetools import search_files, crop_paths
|
||||
from plot_functions import xlabel, ylabel
|
||||
from IPython import embed
|
||||
|
||||
# Analysis settings:
|
||||
mode = ['thresh_lp', 'full', 'short', 'field'][3]
|
||||
thresh_path = f'../data/inv/{mode}/thresholds.npz'
|
||||
save_path = f'../figures/fig_kernel_sd_perc_{mode}_appendix.pdf'
|
||||
|
||||
# Plot settings:
|
||||
fig_kwargs = dict(
|
||||
figsize=(32/2.54, 16/2.54),
|
||||
nrows=1,
|
||||
ncols=1,
|
||||
gridspec_kw=dict(
|
||||
wspace=0,
|
||||
hspace=0,
|
||||
left=0.09,
|
||||
right=0.99,
|
||||
bottom=0.11,
|
||||
top=0.98,
|
||||
)
|
||||
)
|
||||
line_kwargs = dict(
|
||||
color='black',
|
||||
lw=1,
|
||||
alpha=0.5,
|
||||
)
|
||||
xlab = '$\\text{multiple of }\\sigma_{k_i}$'
|
||||
ylab = '$P\\,(c_i > \\Theta_i)$'
|
||||
xlab_kwargs = dict(
|
||||
y=0,
|
||||
fontsize=20,
|
||||
ha='center',
|
||||
va='bottom',
|
||||
)
|
||||
ylab_kwargs = dict(
|
||||
x=0,
|
||||
fontsize=20,
|
||||
ha='center',
|
||||
va='top',
|
||||
)
|
||||
|
||||
# Load threshold data:
|
||||
data = dict(np.load(thresh_path))
|
||||
factors = data['factors']
|
||||
perc = data['percs']
|
||||
|
||||
# Prepare graph:
|
||||
fig, ax = plt.subplots(**fig_kwargs)
|
||||
ax.set_xlim(factors[0], factors[-1])
|
||||
ax.set_ylim(0, 1)
|
||||
ylabel(ax, ylab, transform=fig.transFigure, **ylab_kwargs)
|
||||
xlabel(ax, xlab, transform=fig.transFigure, **xlab_kwargs)
|
||||
|
||||
# Plotting:
|
||||
ax.plot(factors, perc, **line_kwargs)
|
||||
|
||||
# Save figure:
|
||||
fig.savefig(save_path)
|
||||
|
||||
plt.show()
|
||||
print('Done.')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user