Separate out figure gen into different python files
This commit is contained in:
parent
a56f3158cb
commit
9f4b087c6d
Binary file not shown.
|
Before Width: | Height: | Size: 29 KiB |
23275
notebooks/fig1.svg
23275
notebooks/fig1.svg
File diff suppressed because it is too large
Load Diff
|
Before Width: | Height: | Size: 563 KiB |
30
notebooks/rmax-n.py
Normal file
30
notebooks/rmax-n.py
Normal file
@ -0,0 +1,30 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import scipy
|
||||
|
||||
from notebooks.lib import read_load
|
||||
|
||||
|
||||
def linear(x, a, b):
|
||||
return x * a + b
|
||||
|
||||
|
||||
alpha = read_load("../data/alpha")
|
||||
meaned_by_N = alpha.groupby('N').agg({'fd': ['mean', 'std']}) \
|
||||
.reset_index() \
|
||||
.replace([np.inf, -np.inf], np.nan)
|
||||
|
||||
without_prefix = alpha[alpha.N > 50]
|
||||
|
||||
p, pcov = scipy.optimize.curve_fit(linear, np.log(without_prefix.cr), np.log(without_prefix.N))
|
||||
linear_extent = np.linspace(0, np.max(np.log(alpha.cr)))
|
||||
|
||||
plt.scatter(np.log(alpha.cr), np.log(alpha.N), s=1, marker='.', color="tab:blue")
|
||||
plt.plot(linear_extent, linear(linear_extent, *p), color="tab:red")
|
||||
|
||||
plt.xlabel("$\\log r_{max}$")
|
||||
plt.ylabel("$\\log N$")
|
||||
|
||||
plt.savefig('../figures/rmax-n.svg')
|
||||
plt.savefig('../figures/rmax-n.png')
|
||||
plt.show()
|
||||
30
notebooks/sp-fd.py
Normal file
30
notebooks/sp-fd.py
Normal file
@ -0,0 +1,30 @@
|
||||
import numpy as np
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
from notebooks.lib import read_sp
|
||||
|
||||
c_sp = read_sp("../data/stick-probability")
|
||||
by_run = c_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
|
||||
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$")
|
||||
plt.legend()
|
||||
|
||||
plt.savefig('../figures/sp-fd.svg')
|
||||
plt.savefig('../figures/sp-fd.png')
|
||||
plt.show()
|
||||
Loading…
Reference in New Issue
Block a user