Files
atm-curs-dl/gen/selectia/scor.py
Claude Agent 3a6da7a916 cele 7 diagrame din 11_selectia
Sunt diagrame conceptuale - funnel, bara de scor, matrice, cele patru
cadrane, Trinity, sectoare - nu grafice de pret, deci nu trec prin
svg_candles / pchart, care raman obligatorii doar pentru candele si
entry/SL/TP. Agent nou, diagramist, cate unul per diagrama, fiecare cu
generatorul lui in gen/selectia/; substitutia in .md o face
gen/az_selectia.py, ca sa nu scrie sapte agenti in acelasi fisier.

Regula de continut a agentului: fiecare cifra si eticheta trebuie sa
existe in document sau in citate. Ce nu reiese din sursa e scris pe
desen ca atare - ordinea celor 7 sectoare, ce se intampla sub 100%
relative volume. Fara semafor rosu/verde, care nu e in sursa.

Verificat cu ochii pe doua diagrame randate in browser.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ThN7ixZrowca8aTGrK1MUJ
2026-09-18 16:52:01 +00:00

101 lines
3.7 KiB
Python

#!/usr/bin/env python3
"""Diagrama pentru summaries/08_ANALIZA_ZILNICA/11_selectia_simbolului.md (SVG:scor).
Bara ATM score 0-14, impartita in F-score 0-9 (max 9) si value-score 0-5
(max 5). Marcate: 7/14 = "galben", 12-13 = "spuma", peste 7-8 = intra in
analiza. Fara semafor rosu/verde (nu e in sursa).
Cifrele si etichetele vin din text:
- ATM score = F-score (max 9) + value-score (max 5) = max 14 (.md:128)
- 7/14 "galben" (.md:137, 81_27042026.txt:180)
- 12-13 "spuma" (.md:136, 83_22042026.txt:197)
- peste 7-8 "intra in analiza" (.md:135, 83_22042026.txt:195)
Ruleaza: .venv/bin/python gen/selectia/scor.py -> gen/selectia/scor.svg
"""
from pathlib import Path
OUT = Path(__file__).with_suffix(".svg")
W, H = 700, 360
X0, X1 = 60, 640
ATM_MAX, F_MAX, V_MAX = 14, 9, 5
UNIT = (X1 - X0) / ATM_MAX
GRAY, BLUE, ORANGE, TXT, WHITE = "#777", "#1a5fb4", "#b06000", "#000000", "#ffffff"
BAR_TOP, BAR_H = 190, 46
BAR_BOT = BAR_TOP + BAR_H
def x(v):
return X0 + v * UNIT
def text(px, py, s, size=14, fill=TXT, anchor="middle", weight="normal"):
return (
f'<text x="{px:.1f}" y="{py:.1f}" font-size="{size}" fill="{fill}" '
f'text-anchor="{anchor}" font-weight="{weight}">{s}</text>'
)
def line(x1, y1, x2, y2, stroke=GRAY, width=1.5, dash=None):
d = f' stroke-dasharray="{dash}"' if dash else ""
return (
f'<line x1="{x1:.1f}" y1="{y1:.1f}" x2="{x2:.1f}" y2="{y2:.1f}" '
f'stroke="{stroke}" stroke-width="{width}"{d}/>'
)
def main():
p = []
p.append(f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {W} {H}" '
f'width="{W}" height="{H}">')
p.append(f'<rect x="0" y="0" width="{W}" height="{H}" fill="{WHITE}"/>')
p.append('<g font-family="system-ui, sans-serif">')
p.append(text(X0, 38, "ATM score: scala 0-14", 18, TXT, "start", "700"))
p.append(text(X0, 66, "ATM score = F-score (max 9) + value-score (max 5) = max 14",
14, TXT, "start"))
p.append('<defs><clipPath id="barclip">'
f'<rect x="{X0}" y="{BAR_TOP}" width="{X1 - X0}" height="{BAR_H}" rx="8"/>'
'</clipPath></defs>')
p.append(f'<rect x="{X0}" y="{BAR_TOP}" width="{X1 - X0}" height="{BAR_H}" '
f'rx="8" fill="{BLUE}"/>')
xf = x(F_MAX)
p.append(f'<rect x="{xf:.1f}" y="{BAR_TOP}" width="{X1 - xf:.1f}" height="{BAR_H}" '
f'fill="{ORANGE}" clip-path="url(#barclip)"/>')
p.append(line(xf, BAR_TOP, xf, BAR_BOT, WHITE, 2))
p.append(text((X0 + xf) / 2, BAR_TOP + 29, "F-score 0-9", 15, WHITE, "middle", "600"))
p.append(text((xf + X1) / 2, BAR_TOP + 29, "value-score 0-5", 15, WHITE, "middle", "600"))
for v in (0, 7, 9, 12, 13, 14):
xx = x(v)
p.append(line(xx, BAR_BOT, xx, BAR_BOT + 8))
p.append(text(xx, BAR_BOT + 28, str(v), 14, TXT))
xg = x(7)
p.append(line(xg, BAR_TOP - 30, xg, BAR_TOP, GRAY, 1.5, "3 3"))
p.append(text(xg, BAR_TOP - 38, "7/14 = galben", 14, TXT))
xa, xb = x(12), x(13)
yl = BAR_TOP - 35
p.append(f'<path d="M {xa:.1f} {BAR_TOP} L {xa:.1f} {yl:.1f} L {xb:.1f} {yl:.1f} '
f'L {xb:.1f} {BAR_TOP}" fill="none" stroke="{GRAY}" stroke-width="1.5"/>')
p.append(text((xa + xb) / 2, yl - 8, "12-13 = spuma", 14, TXT))
xa, xb = x(7), x(8)
yb = BAR_BOT + 60
p.append(f'<path d="M {xa:.1f} {yb - 10:.1f} L {xa:.1f} {yb:.1f} L {xb:.1f} {yb:.1f} '
f'L {xb:.1f} {yb - 10:.1f}" fill="none" stroke="{GRAY}" stroke-width="1.5"/>')
p.append(text((xa + xb) / 2, yb + 22, "peste 7-8: intră în analiză", 14, TXT))
p.append('</g></svg>')
OUT.write_text("\n".join(p) + "\n", encoding="utf-8")
print("scris", OUT)
if __name__ == "__main__":
main()