proportional plots
This commit is contained in:
parent
4edbf9eb11
commit
8a70a793ed
1
.gitignore
vendored
1
.gitignore
vendored
@ -160,4 +160,5 @@ cython_debug/
|
|||||||
#.idea/
|
#.idea/
|
||||||
|
|
||||||
*.png
|
*.png
|
||||||
|
*.wav
|
||||||
commits.json
|
commits.json
|
||||||
|
@ -8,6 +8,9 @@ COPY metrics.py /code/metrics.py
|
|||||||
RUN git fetch && git checkout 54a6912baf715816e3dcbfd074c0e2d7b8c74fe3
|
RUN git fetch && git checkout 54a6912baf715816e3dcbfd074c0e2d7b8c74fe3
|
||||||
RUN python3 /code/metrics.py
|
RUN python3 /code/metrics.py
|
||||||
|
|
||||||
|
RUN git fetch && git checkout 936f41735a4f7913e49fb16c44e89901bf703568
|
||||||
|
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/
|
||||||
|
@ -66,6 +66,7 @@ def render_ploc():
|
|||||||
units.append((x, *ys))
|
units.append((x, *ys))
|
||||||
X, Yp, Yc, Yb = np.array(units).transpose()
|
X, Yp, Yc, Yb = np.array(units).transpose()
|
||||||
plt.clf()
|
plt.clf()
|
||||||
|
plt.axhline(8000, alpha=0.5)
|
||||||
plt.axhline(7000, alpha=0.5)
|
plt.axhline(7000, alpha=0.5)
|
||||||
plt.axhline(6000, alpha=0.5)
|
plt.axhline(6000, alpha=0.5)
|
||||||
plt.axhline(0, alpha=0.5)
|
plt.axhline(0, alpha=0.5)
|
||||||
|
@ -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 f29ea3dbc8d10b83a0a1536f65d4b9f16f457d46
|
RUN git fetch && git checkout 936f41735a4f7913e49fb16c44e89901bf703568
|
||||||
|
|
||||||
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
|
||||||
@ -53,7 +53,9 @@ 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
|
||||||
|
RUN python3 -m pip install scipy
|
||||||
WORKDIR /code/
|
WORKDIR /code/
|
||||||
COPY --from=metrics /code/metrics.json metrics.json
|
COPY --from=metrics /code/metrics.json metrics.json
|
||||||
|
RUN mkdir /code/metrics/
|
||||||
COPY render.py render.py
|
COPY render.py render.py
|
||||||
RUN python3 render.py
|
RUN python3 render.py
|
||||||
|
@ -3,6 +3,7 @@ import json
|
|||||||
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")
|
||||||
@ -21,24 +22,38 @@ def render_ploc():
|
|||||||
plt.plot(X, Y)
|
plt.plot(X, Y)
|
||||||
plt.fill_between(X, Y, Y - Ya, alpha=0.5, color="green")
|
plt.fill_between(X, Y, Y - Ya, alpha=0.5, color="green")
|
||||||
plt.fill_between(X, Y, Y + Yd, alpha=0.5, color="red")
|
plt.fill_between(X, Y, Y + Yd, alpha=0.5, color="red")
|
||||||
plt.savefig("/code/metrics.png")
|
plt.savefig("/code/metrics/metrics.png")
|
||||||
|
|
||||||
|
|
||||||
def render_cors():
|
def render_cors(*, px, pc):
|
||||||
M = len(cors)
|
M = len(cors)
|
||||||
N = len(cors[0])
|
N = len(cors[0])
|
||||||
X = np.arange(N)
|
|
||||||
Y = np.array(cors)
|
Y = np.array(cors)
|
||||||
|
if px:
|
||||||
|
X = abs(np.diff(Y, axis=1, prepend=0)).sum(axis=0).cumsum()
|
||||||
|
else:
|
||||||
|
X = np.arange(N)
|
||||||
|
assert Y.shape == (M, N)
|
||||||
|
W = Y.max(axis=1)
|
||||||
|
I = W.cumsum()
|
||||||
|
assert I.shape == (M,)
|
||||||
plt.clf()
|
plt.clf()
|
||||||
C = M
|
if pc:
|
||||||
|
Z = (I - W / 2) / I.max() * M
|
||||||
|
else:
|
||||||
|
Z = 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())
|
||||||
plt.stackplot(
|
plt.stackplot(
|
||||||
X,
|
X,
|
||||||
Y,
|
Y,
|
||||||
colors=[hsv_to_rgb((i / C, 0.25, 0.75)) for i in range(C)],
|
colors=colours,
|
||||||
aa=False,
|
aa=False,
|
||||||
)
|
)
|
||||||
plt.savefig("/code/metrics-cors.png")
|
plt.savefig(f"/code/metrics/metrics-px{int(px)}-pc{int(pc)}.png")
|
||||||
|
|
||||||
|
|
||||||
render_ploc()
|
render_ploc()
|
||||||
render_cors()
|
render_cors(px=False, pc=False)
|
||||||
|
render_cors(px=False, pc=True)
|
||||||
|
render_cors(px=True, pc=False)
|
||||||
|
render_cors(px=True, pc=True)
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
clear
|
clear
|
||||||
docker compose up -d --build metrics
|
docker compose up -d --build metrics
|
||||||
mkdir metrics
|
docker cp temp-metrics:/code/metrics/ .
|
||||||
docker cp temp-metrics:/code/metrics.png ./metrics/metrics.png
|
|
||||||
docker cp temp-metrics:/code/metrics-cors.png ./metrics/metrics-cors.png
|
|
||||||
docker compose down
|
docker compose down
|
||||||
|
Loading…
Reference in New Issue
Block a user