render in-memory caching
This commit is contained in:
parent
8a70a793ed
commit
975d6d9bd2
@ -11,6 +11,16 @@ RUN python3 /code/metrics.py
|
|||||||
RUN git fetch && git checkout 936f41735a4f7913e49fb16c44e89901bf703568
|
RUN git fetch && git checkout 936f41735a4f7913e49fb16c44e89901bf703568
|
||||||
RUN python3 /code/metrics.py
|
RUN python3 /code/metrics.py
|
||||||
|
|
||||||
|
RUN git fetch && git checkout f13a1382f8781231e01d375a13041884c87ddf0c
|
||||||
|
RUN python3 /code/metrics.py
|
||||||
|
|
||||||
|
RUN git fetch && git checkout ce65688e47b07f14ef2861971f64296c2197e778
|
||||||
|
RUN python3 /code/metrics.py
|
||||||
|
|
||||||
|
|
||||||
|
RUN git fetch && git checkout 7f1d72898ddd9ab40bf91e553f70a023a64fe647
|
||||||
|
RUN python3 /code/metrics.py
|
||||||
|
|
||||||
FROM python:3.11
|
FROM python:3.11
|
||||||
RUN python3 -m pip install matplotlib
|
RUN python3 -m pip install matplotlib
|
||||||
WORKDIR /code/
|
WORKDIR /code/
|
||||||
|
@ -77,6 +77,7 @@ def render_ploc():
|
|||||||
plt.plot(X, Yc * (k := Yp[0] / Yc[0]), fmt, label=f"c/d x{round(k, 1)}", c="C1", **kwargs)
|
plt.plot(X, Yc * (k := Yp[0] / Yc[0]), fmt, label=f"c/d x{round(k, 1)}", c="C1", **kwargs)
|
||||||
plt.plot(X, Yb * (k := Yp[0] / Yb[0]), fmt, label=f"blank x{round(k, 1)}", c="C2", **kwargs)
|
plt.plot(X, Yb * (k := Yp[0] / Yb[0]), fmt, label=f"blank x{round(k, 1)}", c="C2", **kwargs)
|
||||||
plt.legend()
|
plt.legend()
|
||||||
|
plt.ylim(bottom=0)
|
||||||
plt.savefig("/code/ploc.png")
|
plt.savefig("/code/ploc.png")
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ ENV SRCPATTERN="*.cs"
|
|||||||
FROM metrics-base as metrics-radn
|
FROM metrics-base as metrics-radn
|
||||||
RUN git clone https://gitea.parrrate.ru/PTV/radn-rs.git
|
RUN git clone https://gitea.parrrate.ru/PTV/radn-rs.git
|
||||||
WORKDIR /code/radn-rs/
|
WORKDIR /code/radn-rs/
|
||||||
RUN git fetch && git checkout 936f41735a4f7913e49fb16c44e89901bf703568
|
RUN git fetch && git checkout 7f1d72898ddd9ab40bf91e553f70a023a64fe647
|
||||||
|
|
||||||
FROM metrics-base as metrics-mdbook
|
FROM metrics-base as metrics-mdbook
|
||||||
RUN git clone https://github.com/rust-lang/mdBook.git
|
RUN git clone https://github.com/rust-lang/mdBook.git
|
||||||
|
@ -21,7 +21,7 @@ for i, commit in enumerate(reversed(commits)):
|
|||||||
lines = path.read_bytes().splitlines()
|
lines = path.read_bytes().splitlines()
|
||||||
lines = (line.strip() for line in lines)
|
lines = (line.strip() for line in lines)
|
||||||
lines = (line for line in lines if line)
|
lines = (line for line in lines if line)
|
||||||
# lines = set(lines)
|
lines = set(lines)
|
||||||
current_ctr.update(lines)
|
current_ctr.update(lines)
|
||||||
added = current_ctr - last_ctr
|
added = current_ctr - last_ctr
|
||||||
deleted = last_ctr - current_ctr
|
deleted = last_ctr - current_ctr
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
import json
|
import json
|
||||||
|
from functools import cache
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from matplotlib.colors import hsv_to_rgb
|
from matplotlib.colors import hsv_to_rgb
|
||||||
from scipy.io import wavfile
|
|
||||||
|
|
||||||
plt.rcParams["figure.figsize"] = [18, 9]
|
plt.rcParams["figure.figsize"] = [18, 9]
|
||||||
plt.style.use("dark_background")
|
plt.style.use("dark_background")
|
||||||
plt.subplots_adjust(left=0.05, right=0.99, top=0.95, bottom=0.05)
|
plt.subplots_adjust(left=0.05, right=0.99, top=0.95, bottom=0.05)
|
||||||
|
plt.margins(x=0.025)
|
||||||
|
|
||||||
|
|
||||||
with open("metrics.json", "r") as file:
|
with open("metrics.json", "r") as file:
|
||||||
@ -19,35 +20,101 @@ with open("metrics.json", "r") as file:
|
|||||||
def render_ploc():
|
def render_ploc():
|
||||||
X, Y, Ya, Yd = np.array(entries).transpose()
|
X, Y, Ya, Yd = np.array(entries).transpose()
|
||||||
plt.clf()
|
plt.clf()
|
||||||
plt.plot(X, Y)
|
plt.plot(X, Y, linewidth=1.0)
|
||||||
plt.fill_between(X, Y, Y - Ya, alpha=0.5, color="green")
|
plt.fill_between(
|
||||||
plt.fill_between(X, Y, Y + Yd, alpha=0.5, color="red")
|
X,
|
||||||
|
Y - Ya,
|
||||||
|
Y,
|
||||||
|
alpha=0.5,
|
||||||
|
color="green",
|
||||||
|
linewidth=0.0,
|
||||||
|
)
|
||||||
|
plt.fill_between(
|
||||||
|
X,
|
||||||
|
Y,
|
||||||
|
Y + Yd,
|
||||||
|
alpha=0.5,
|
||||||
|
color="red",
|
||||||
|
linewidth=0.0,
|
||||||
|
)
|
||||||
|
plt.ylim(bottom=0)
|
||||||
plt.savefig("/code/metrics/metrics.png")
|
plt.savefig("/code/metrics/metrics.png")
|
||||||
|
|
||||||
|
|
||||||
def render_cors(*, px, pc):
|
@cache
|
||||||
M = len(cors)
|
def get_m():
|
||||||
N = len(cors[0])
|
return len(cors)
|
||||||
Y = np.array(cors)
|
|
||||||
|
|
||||||
|
@cache
|
||||||
|
def get_n():
|
||||||
|
return len(cors[0])
|
||||||
|
|
||||||
|
|
||||||
|
@cache
|
||||||
|
def get_y():
|
||||||
|
return np.array(cors)
|
||||||
|
|
||||||
|
|
||||||
|
@cache
|
||||||
|
def _get_x(px: bool):
|
||||||
if px:
|
if px:
|
||||||
X = abs(np.diff(Y, axis=1, prepend=0)).sum(axis=0).cumsum()
|
return abs(np.diff(get_y(), axis=1, prepend=0)).sum(axis=0).cumsum()
|
||||||
else:
|
else:
|
||||||
X = np.arange(N)
|
return np.arange(get_n())
|
||||||
assert Y.shape == (M, N)
|
|
||||||
W = Y.max(axis=1)
|
|
||||||
|
def get_x(*, px: bool):
|
||||||
|
return _get_x(px)
|
||||||
|
|
||||||
|
|
||||||
|
@cache
|
||||||
|
def get_w():
|
||||||
|
return get_y().max(axis=1)
|
||||||
|
|
||||||
|
|
||||||
|
@cache
|
||||||
|
def _get_z(pc: bool):
|
||||||
|
M = get_m()
|
||||||
|
if pc:
|
||||||
|
W = get_w()
|
||||||
I = W.cumsum()
|
I = W.cumsum()
|
||||||
assert I.shape == (M,)
|
assert I.shape == (M,)
|
||||||
plt.clf()
|
return (I - W / 2) / I.max() * M
|
||||||
if pc:
|
|
||||||
Z = (I - W / 2) / I.max() * M
|
|
||||||
else:
|
else:
|
||||||
Z = np.arange(M)
|
return np.arange(M)
|
||||||
colours = hsv_to_rgb(np.array([3.0 * Z / M % 1, 0.4 + Z * 0, 0.6 + 0.15 * (Z / M)]).transpose())
|
|
||||||
|
|
||||||
|
def get_z(*, pc: bool):
|
||||||
|
return _get_z(pc)
|
||||||
|
|
||||||
|
|
||||||
|
@cache
|
||||||
|
def _get_c(pc: bool):
|
||||||
|
M = get_m()
|
||||||
|
Z = get_z(pc=pc)
|
||||||
|
W = get_w()
|
||||||
|
return hsv_to_rgb(np.array([3.0 * Z / M % 1, 0.4 + Z * 0, 0.6 + 0.15 * (Z / M)]).transpose())
|
||||||
|
|
||||||
|
|
||||||
|
def get_c(*, pc: bool):
|
||||||
|
return _get_c(pc)
|
||||||
|
|
||||||
|
|
||||||
|
def render_cors(*, px, pc):
|
||||||
|
M = get_m()
|
||||||
|
N = get_n()
|
||||||
|
Y = get_y()
|
||||||
|
X = get_x(px=px)
|
||||||
|
assert Y.shape == (M, N)
|
||||||
|
plt.clf()
|
||||||
|
C = get_c(pc=pc)
|
||||||
plt.stackplot(
|
plt.stackplot(
|
||||||
X,
|
X,
|
||||||
Y,
|
Y,
|
||||||
colors=colours,
|
colors=C,
|
||||||
aa=False,
|
aa=False,
|
||||||
|
linewidth=0.0,
|
||||||
)
|
)
|
||||||
plt.savefig(f"/code/metrics/metrics-px{int(px)}-pc{int(pc)}.png")
|
plt.savefig(f"/code/metrics/metrics-px{int(px)}-pc{int(pc)}.png")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user