Skip to content

Commit 6ef3935

Browse files
committed
fix: add README
1 parent 66d6c6d commit 6ef3935

2 files changed

Lines changed: 104 additions & 0 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,14 @@ Do *not* use these cards! They may appear to work, but they can cause spurious g
269269
- PNY Elite
270270
- MicroCenter
271271

272+
#### Writing new SD Cards
273+
274+
```
275+
sudo parted /dev/sdd --script mklabel gpt mkpart primary fat32 4MiB 100%
276+
sudo mkfs.fat -F 32 -s 128 -S 512 /dev/sdd1
277+
sudo partclone.fat32 -r -s sdcard_ectocore.img -o /dev/sdd1 --force
278+
```
279+
272280
# license
273281

274282
- Apache License 2.0 for no-OS-FatFS (Copyright 2021 Carl John Kugler III)

dev/analyze_sdcards6.py

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#!/usr/bin/env -S uv --quiet run --script
2+
# /// script
3+
# requires-python = ">=3.13"
4+
# dependencies = [
5+
# "numpy",
6+
# "plotly",
7+
# "click",
8+
# ]
9+
# ///
10+
import glob
11+
import os
12+
import click
13+
import numpy as np
14+
import plotly.graph_objects as go
15+
import plotly.io as pio
16+
17+
pio.renderers.default = "browser"
18+
19+
20+
def parse_line(line):
21+
if b"sdcard" not in line:
22+
return None
23+
parts = line.split(b"sdcard", 1)
24+
fields = parts[1].split()
25+
if len(fields) != 5:
26+
return None
27+
try:
28+
return float(fields[0])
29+
except:
30+
return None
31+
32+
33+
def parse_file(fname):
34+
vals = []
35+
with open(fname, "rb") as f:
36+
for line in f:
37+
c = parse_line(line)
38+
if c is not None:
39+
vals.append(c)
40+
return np.array(vals)
41+
42+
43+
def extract_label(fname):
44+
base = os.path.basename(fname)
45+
return base[:-4] if base.endswith(".txt") else base
46+
47+
48+
@click.command()
49+
@click.argument("folder", type=click.Path(exists=True))
50+
def main(folder):
51+
folder = os.path.abspath(folder)
52+
fnames = sorted(glob.glob(os.path.join(folder, "*.txt")))
53+
data = {}
54+
55+
for fname in fnames:
56+
arr = parse_file(fname)
57+
if len(arr):
58+
data[extract_label(fname)] = arr
59+
60+
if not data:
61+
return
62+
63+
labels = list(data.keys())
64+
xs = []
65+
ys = []
66+
67+
for label in labels:
68+
arr = data[label]
69+
xs.extend([label] * len(arr))
70+
ys.extend(arr)
71+
72+
fig = go.Figure()
73+
fig.add_trace(
74+
go.Box(
75+
x=xs,
76+
y=ys,
77+
boxpoints="all",
78+
jitter=0.3,
79+
pointpos=-1.8,
80+
marker=dict(size=3),
81+
)
82+
)
83+
84+
fig.update_layout(
85+
title="CPU Utilization",
86+
yaxis=dict(title="cpu"),
87+
xaxis=dict(title="File", tickangle=-45),
88+
showlegend=False,
89+
height=600,
90+
)
91+
92+
fig.show()
93+
94+
95+
if __name__ == "__main__":
96+
main()

0 commit comments

Comments
 (0)