Remove duplicated code

This commit is contained in:
Joshua Coles 2023-03-17 21:48:13 +00:00
parent 1155064306
commit 1b00fb5253
2 changed files with 23 additions and 41 deletions

View File

@ -6,7 +6,7 @@
<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<cc:Work>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:date>2023-03-17T21:13:46.394313</dc:date>
<dc:date>2023-03-17T21:47:50.660553</dc:date>
<dc:format>image/svg+xml</dc:format>
<dc:creator>
<cc:Agent>
@ -41,12 +41,12 @@ z
<g id="xtick_1">
<g id="line2d_1">
<defs>
<path id="me761353d38" d="M 0 0
<path id="m8979bdaa04" d="M 0 0
L 0 3.5
" style="stroke: #000000; stroke-width: 0.8"/>
</defs>
<g>
<use xlink:href="#me761353d38" x="70.553388" y="307.584" style="stroke: #000000; stroke-width: 0.8"/>
<use xlink:href="#m8979bdaa04" x="70.553388" y="307.584" style="stroke: #000000; stroke-width: 0.8"/>
</g>
</g>
<g id="text_1">
@ -91,7 +91,7 @@ z
<g id="xtick_2">
<g id="line2d_2">
<g>
<use xlink:href="#me761353d38" x="136.140165" y="307.584" style="stroke: #000000; stroke-width: 0.8"/>
<use xlink:href="#m8979bdaa04" x="136.140165" y="307.584" style="stroke: #000000; stroke-width: 0.8"/>
</g>
</g>
<g id="text_2">
@ -132,7 +132,7 @@ z
<g id="xtick_3">
<g id="line2d_3">
<g>
<use xlink:href="#me761353d38" x="201.726942" y="307.584" style="stroke: #000000; stroke-width: 0.8"/>
<use xlink:href="#m8979bdaa04" x="201.726942" y="307.584" style="stroke: #000000; stroke-width: 0.8"/>
</g>
</g>
<g id="text_3">
@ -168,7 +168,7 @@ z
<g id="xtick_4">
<g id="line2d_4">
<g>
<use xlink:href="#me761353d38" x="267.313719" y="307.584" style="stroke: #000000; stroke-width: 0.8"/>
<use xlink:href="#m8979bdaa04" x="267.313719" y="307.584" style="stroke: #000000; stroke-width: 0.8"/>
</g>
</g>
<g id="text_4">
@ -215,7 +215,7 @@ z
<g id="xtick_5">
<g id="line2d_5">
<g>
<use xlink:href="#me761353d38" x="332.900496" y="307.584" style="stroke: #000000; stroke-width: 0.8"/>
<use xlink:href="#m8979bdaa04" x="332.900496" y="307.584" style="stroke: #000000; stroke-width: 0.8"/>
</g>
</g>
<g id="text_5">
@ -271,7 +271,7 @@ z
<g id="xtick_6">
<g id="line2d_6">
<g>
<use xlink:href="#me761353d38" x="398.487273" y="307.584" style="stroke: #000000; stroke-width: 0.8"/>
<use xlink:href="#m8979bdaa04" x="398.487273" y="307.584" style="stroke: #000000; stroke-width: 0.8"/>
</g>
</g>
<g id="text_6">
@ -457,12 +457,12 @@ z
<g id="ytick_1">
<g id="line2d_7">
<defs>
<path id="mbc9cae7394" d="M 0 0
<path id="mad915df7e5" d="M 0 0
L -3.5 0
" style="stroke: #000000; stroke-width: 0.8"/>
</defs>
<g>
<use xlink:href="#mbc9cae7394" x="57.6" y="307.128527" style="stroke: #000000; stroke-width: 0.8"/>
<use xlink:href="#mad915df7e5" x="57.6" y="307.128527" style="stroke: #000000; stroke-width: 0.8"/>
</g>
</g>
<g id="text_8">
@ -490,7 +490,7 @@ z
<g id="ytick_2">
<g id="line2d_8">
<g>
<use xlink:href="#mbc9cae7394" x="57.6" y="272.183001" style="stroke: #000000; stroke-width: 0.8"/>
<use xlink:href="#mad915df7e5" x="57.6" y="272.183001" style="stroke: #000000; stroke-width: 0.8"/>
</g>
</g>
<g id="text_9">
@ -533,7 +533,7 @@ z
<g id="ytick_3">
<g id="line2d_9">
<g>
<use xlink:href="#mbc9cae7394" x="57.6" y="237.237476" style="stroke: #000000; stroke-width: 0.8"/>
<use xlink:href="#mad915df7e5" x="57.6" y="237.237476" style="stroke: #000000; stroke-width: 0.8"/>
</g>
</g>
<g id="text_10">
@ -549,7 +549,7 @@ z
<g id="ytick_4">
<g id="line2d_10">
<g>
<use xlink:href="#mbc9cae7394" x="57.6" y="202.291951" style="stroke: #000000; stroke-width: 0.8"/>
<use xlink:href="#mad915df7e5" x="57.6" y="202.291951" style="stroke: #000000; stroke-width: 0.8"/>
</g>
</g>
<g id="text_11">
@ -565,7 +565,7 @@ z
<g id="ytick_5">
<g id="line2d_11">
<g>
<use xlink:href="#mbc9cae7394" x="57.6" y="167.346425" style="stroke: #000000; stroke-width: 0.8"/>
<use xlink:href="#mad915df7e5" x="57.6" y="167.346425" style="stroke: #000000; stroke-width: 0.8"/>
</g>
</g>
<g id="text_12">
@ -613,7 +613,7 @@ z
<g id="ytick_6">
<g id="line2d_12">
<g>
<use xlink:href="#mbc9cae7394" x="57.6" y="132.4009" style="stroke: #000000; stroke-width: 0.8"/>
<use xlink:href="#mad915df7e5" x="57.6" y="132.4009" style="stroke: #000000; stroke-width: 0.8"/>
</g>
</g>
<g id="text_13">
@ -629,7 +629,7 @@ z
<g id="ytick_7">
<g id="line2d_13">
<g>
<use xlink:href="#mbc9cae7394" x="57.6" y="97.455375" style="stroke: #000000; stroke-width: 0.8"/>
<use xlink:href="#mad915df7e5" x="57.6" y="97.455375" style="stroke: #000000; stroke-width: 0.8"/>
</g>
</g>
<g id="text_14">
@ -645,7 +645,7 @@ z
<g id="ytick_8">
<g id="line2d_14">
<g>
<use xlink:href="#mbc9cae7394" x="57.6" y="62.509849" style="stroke: #000000; stroke-width: 0.8"/>
<use xlink:href="#mad915df7e5" x="57.6" y="62.509849" style="stroke: #000000; stroke-width: 0.8"/>
</g>
</g>
<g id="text_15">
@ -822,7 +822,7 @@ L 388.649256 290.246443
L 391.928595 292.151486
L 395.207934 295.488
L 398.487273 293.708953
" clip-path="url(#p3666199b34)" style="fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square"/>
" clip-path="url(#p64819cf2ed)" style="fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square"/>
</g>
<g id="line2d_16">
<path d="M 73.832727 54.647546
@ -925,7 +925,7 @@ L 388.649256 295.042039
L 391.928595 293.274822
L 395.207934 289.398872
L 398.487273 289.140531
" clip-path="url(#p3666199b34)" style="fill: none; stroke: #ff7f0e; stroke-width: 1.5; stroke-linecap: square"/>
" clip-path="url(#p64819cf2ed)" style="fill: none; stroke: #ff7f0e; stroke-width: 1.5; stroke-linecap: square"/>
</g>
<g id="patch_3">
<path d="M 57.6 307.584
@ -1374,7 +1374,7 @@ z
</g>
</g>
<defs>
<clipPath id="p3666199b34">
<clipPath id="p64819cf2ed">
<rect x="57.6" y="41.472" width="357.12" height="266.112"/>
</clipPath>
</defs>

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -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)
# %%