Skip to content

Commit 930ab55

Browse files
committed
add countme files
1 parent ce75338 commit 930ab55

6 files changed

+174
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.csv*
2+
venv
3+
*.png

countme.py

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import pandas as pd
2+
import numpy as np
3+
import matplotlib.pyplot as plt
4+
import datetime
5+
6+
plt.style.use("default")
7+
plt.style.use("./cyberpunk.mplstyle")
8+
9+
#
10+
# Load data
11+
#
12+
13+
print("Loading data...")
14+
# https://data-analysis.fedoraproject.org/csv-reports/countme/totals.csv
15+
orig = pd.read_csv(
16+
"totals.csv",
17+
usecols=["week_end", "repo_tag", "os_variant", "hits"],
18+
parse_dates=["week_end"],
19+
# low_memory=False,
20+
dtype={
21+
"repo_tag": "object",
22+
"os_variant": "category",
23+
},
24+
)
25+
26+
# # Detailed data
27+
# orig = pd.read_csv(
28+
# "totals.csv",
29+
# parse_dates=["week_start", "week_end"],
30+
# # low_memory=False,
31+
# dtype={
32+
# "repo_tag": "object",
33+
# "repo_arch": "object",
34+
# "os_name": "category",
35+
# "os_version": "category",
36+
# "os_variant": "category",
37+
# "os_arch": "category",
38+
# },
39+
# )
40+
41+
# Select repos and filter outages
42+
print("Plotting...")
43+
d = orig[
44+
orig["repo_tag"].isin(
45+
[
46+
*[f"fedora-{v}" for v in range(30, 45)],
47+
# *[f"fedora-cisco-openh264-{v}" for v in range(40, 41)],
48+
]
49+
)
50+
]
51+
52+
d = d[
53+
# End of year partial week
54+
(d["week_end"] != pd.to_datetime("2024-12-29"))
55+
# & (d["week_end"] != pd.to_datetime("2023-10-23"))
56+
]
57+
58+
START_DATE = "2024-07-01" # "2021-3-1"
59+
END_DATE = datetime.datetime.now() # "2025-02-02"
60+
61+
for fig, oss in [
62+
("ublue", ["Bluefin", "Bazzite", "Aurora"]),
63+
("nonbazzite", ["Bluefin", "Aurora"]),
64+
]:
65+
plt.figure()
66+
for os in oss:
67+
mask = d["os_variant"].str.lower().str.contains(os.lower(), na=False)
68+
res = d[mask].groupby("week_end")["hits"].sum()
69+
plt.plot(res.index, res.values, label=f"{os} ({res[res.index.max()] / 1000:.1f}k)") # type: ignore
70+
# print(res)
71+
72+
plt.title("Active Devices per Week")
73+
plt.xlabel("Week")
74+
plt.ylabel("Hits")
75+
76+
plt.xlim([pd.to_datetime(START_DATE), pd.to_datetime(END_DATE)])
77+
78+
plt.xticks(rotation=45)
79+
plt.legend()
80+
plt.tight_layout()
81+
82+
plt.savefig(f"growth_{fig}.png")

cyberpunk.mplstyle

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# from seaborn dark
2+
legend.frameon: False
3+
legend.numpoints: 1
4+
legend.scatterpoints: 1
5+
xtick.direction: out
6+
ytick.direction: out
7+
#xtick.color: #2A3459
8+
#ytick.color: #2A3459
9+
axes.axisbelow: True
10+
axes.grid: True
11+
font.family: sans-serif
12+
font.sans-serif: Arial, Liberation Sans, DejaVu Sans, Bitstream Vera Sans, sans-serif
13+
grid.linestyle: -
14+
lines.solid_capstyle: round
15+
axes.linewidth: 0
16+
xtick.major.size: 0
17+
ytick.major.size: 0
18+
xtick.minor.size: 0
19+
ytick.minor.size: 0
20+
21+
22+
# neon colors: teal/cyan, pink, yellow, matrix green, red, violet
23+
axes.prop_cycle: cycler('color', ['08F7FE', 'FE53BB', 'F5D300', '00ff41', 'r', '9467bd', ])
24+
25+
image.cmap: cool
26+
27+
# font color: very light grey
28+
text.color: 0.9
29+
axes.labelcolor: 0.9
30+
xtick.color: 0.9
31+
ytick.color: 0.9
32+
33+
# background: bluish dark grey
34+
figure.facecolor: 212946
35+
axes.facecolor: 212946
36+
savefig.facecolor: 212946
37+
38+
# grid: bluish dark grey, slightly lighter than background
39+
grid.color: 2A3459

graph.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
pip3 install -r requirements.txt
4+
5+
wget https://data-analysis.fedoraproject.org/csv-reports/countme/totals.csv
6+
7+
python3 countme.py

requirements.in

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pandas
2+
numpy
3+
matplotlib

requirements.txt

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.13
3+
# by the following command:
4+
#
5+
# pip-compile
6+
#
7+
contourpy==1.3.1
8+
# via matplotlib
9+
cycler==0.12.1
10+
# via matplotlib
11+
fonttools==4.55.8
12+
# via matplotlib
13+
kiwisolver==1.4.8
14+
# via matplotlib
15+
matplotlib==3.10.0
16+
# via -r requirements.in
17+
numpy==2.2.2
18+
# via
19+
# -r requirements.in
20+
# contourpy
21+
# matplotlib
22+
# pandas
23+
packaging==24.2
24+
# via matplotlib
25+
pandas==2.2.3
26+
# via -r requirements.in
27+
pillow==11.1.0
28+
# via matplotlib
29+
pyparsing==3.2.1
30+
# via matplotlib
31+
python-dateutil==2.9.0.post0
32+
# via
33+
# matplotlib
34+
# pandas
35+
pytz==2025.1
36+
# via pandas
37+
six==1.17.0
38+
# via python-dateutil
39+
tzdata==2025.1
40+
# via pandas

0 commit comments

Comments
 (0)