Remove duplicated code
This commit is contained in:
@@ -1,32 +1,14 @@
|
||||
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
|
||||
|
||||
from notebooks.lib import read_sp, aggregate_sp_fd
|
||||
|
||||
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)
|
||||
c_data = aggregate_sp_fd(c_sp)
|
||||
rust_data = aggregate_sp_fd(rust_sp)
|
||||
|
||||
# %%
|
||||
|
||||
|
||||
Reference in New Issue
Block a user