3D graphs

This commit is contained in:
Joshua Coles 2023-03-17 19:02:58 +00:00
parent b970948ba8
commit 571bc09516
2 changed files with 129 additions and 65 deletions

File diff suppressed because one or more lines are too long

View File

@ -28,6 +28,24 @@ def read_xyz(path: str):
return df
def read_xyz_alt(path: str):
df = pd.read_csv(path)
df['N'] = df.index + 1
# Find the outermost corner of this object
df['r'] = (
(df.x.abs() + np.sqrt(0.5)) ** 2 +
(df.y.abs() + np.sqrt(0.5)) ** 2 +
(df.z.abs() + np.sqrt(0.5)) ** 2
) ** 0.5
df['cr'] = df.r.cummax()
df['fd'] = np.log(df.N) / np.log(df.cr)
df['run'] = os.path.splitext(Path(path).name)[0]
return df
def read_load(load_dir: str, reader=read_xy):
paths = glob(f'{load_dir}/*.csv')
return pd.concat([reader(path) for path in paths])
@ -78,3 +96,16 @@ def fd_stats(dfs):
fds = [mean_of_tail(df.fd, 0.1) for df in dfs]
fds_clean = [f for f in fds if f < np.inf]
return np.mean(fds_clean), np.mean(fds_clean) / np.sqrt(fds_clean.length())
def linear(x, a, b):
return x * a + b
def mean_across(df):
runs = df.run.unique().size
data = df.groupby('N').agg({'fd': ['mean', 'std', ['stderr', lambda fd: np.std(fd) / np.sqrt(runs)]]}) \
.reset_index() \
.replace([np.inf, -np.inf], np.nan)
return data