sp-fd figures
This commit is contained in:
parent
9f4b087c6d
commit
36e9a1aa93
71
notebooks/sp-fd-rust-vs-c.py
Normal file
71
notebooks/sp-fd-rust-vs-c.py
Normal file
@ -0,0 +1,71 @@
|
||||
import numpy as np
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
from notebooks.lib import read_sp
|
||||
|
||||
|
||||
def process_sp(sp):
|
||||
by_run = sp.groupby(['probability', 'N'])
|
||||
|
||||
by_probability = by_run.agg(
|
||||
overall_fd=('fd', lambda fd: np.mean(fd[-100:])),
|
||||
overall_fd_std=('fd', 'std')
|
||||
).reset_index().groupby('probability')
|
||||
|
||||
ggg = by_probability.agg(
|
||||
fd=('overall_fd', 'mean'),
|
||||
# TODO Check stats, do we need to do /sqrt(n) here?
|
||||
fd_std=('overall_fd_std', lambda std: np.sqrt(np.mean(np.square(std))))
|
||||
)
|
||||
|
||||
return ggg
|
||||
|
||||
|
||||
c_sp = read_sp("../data/stick-probability")
|
||||
rust_sp = read_sp("../data/rust-sticking-probability")
|
||||
|
||||
# %%
|
||||
c_data = process_sp(c_sp)
|
||||
rust_data = process_sp(rust_sp)
|
||||
|
||||
# %%
|
||||
|
||||
# plt.fill_between(
|
||||
# c_data.index,
|
||||
# c_data.fd - c_data.fd_std,
|
||||
# c_data.fd + c_data.fd_std,
|
||||
# alpha=0.2,
|
||||
# color='tab:blue',
|
||||
# label=f"IPC + PS, Standard error band"
|
||||
# )
|
||||
|
||||
plt.plot(
|
||||
c_data.index,
|
||||
c_data.fd,
|
||||
color='tab:blue',
|
||||
label='IPC + PS, fd mean, seeds = 100'
|
||||
)
|
||||
|
||||
# plt.fill_between(
|
||||
# rust_data.index,
|
||||
# rust_data.fd - rust_data.fd_std,
|
||||
# rust_data.fd + rust_data.fd_std,
|
||||
# alpha=0.2,
|
||||
# color='tab:orange',
|
||||
# label=f"NF, Standard error band"
|
||||
# )
|
||||
|
||||
plt.plot(
|
||||
rust_data.index,
|
||||
rust_data.fd,
|
||||
color='tab:orange',
|
||||
label='NF, fd mean, seeds = 100'
|
||||
)
|
||||
|
||||
plt.xlabel("$p_{stick}$")
|
||||
plt.ylabel("$fd$")
|
||||
plt.legend()
|
||||
|
||||
plt.savefig('../figures/sp-fd-rust-vs-c.svg')
|
||||
plt.savefig('../figures/sp-fd-rust-vs-c.png')
|
||||
plt.show()
|
||||
@ -17,9 +17,9 @@ ggg = by_probability.agg(
|
||||
fd_std=('overall_fd_std', lambda std: np.sqrt(np.mean(np.square(std))))
|
||||
)
|
||||
|
||||
# %%
|
||||
plt.fill_between(ggg.index, ggg.fd - ggg.fd_std, ggg.fd + ggg.fd_std, alpha=0.2, label=f"Standard error band")
|
||||
plt.plot(ggg.index, ggg.fd, color='tab:blue', label='fd mean, seeds = 100')
|
||||
plt.plot(ggg.index, ggg.fd)
|
||||
|
||||
plt.xlabel("$p_{stick}$")
|
||||
plt.ylabel("$fd$")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user