Files
mymt5opp/scripts/inspect_report.py
gavindiaz 63a829cc46 phase 7-8 完成 + warmup 修复 + 产物结构化重组
主要内容:
- Phase 8 PROMOTE: finalist #1 (trial #324) registry 条目,自动生成
- Optuna objective warmup bug 修复 (shared/optimizer/objective.py)
- studies/ 目录按用途重组为 optuna/ + finalists/ + features/ 三层
- reports/ 加入 Optuna 中文 dashboard (5 主图 + 18 slice + 15 contour)
- 新增 PROJECT_GUIDE.md 项目说明文档
- 新增 build_registry_entry.py / build_optuna_dashboard.py / build_feature_datasets.py
- .gitignore: 允许提交 studies/*.db (Optuna DB) 和 reports/*.html (MT5 + dashboard)
2026-06-27 00:28:07 +08:00

38 lines
1.4 KiB
Python

"""Inspect the HTML structure to find test period / sections."""
from pathlib import Path
from lxml import html
for label, fn in [("IS", "IS-ReportTester-52845377.html"), ("OOS", "OOS-ReportTester-52845377.html")]:
p = Path("reports") / fn
raw = p.read_bytes()
text = raw.decode("utf-16") if raw[:2] in (b"\xff\xfe", b"\xfe\xff") else raw.decode("utf-8", errors="replace")
tree = html.fromstring(text)
print(f"=== {label} ({fn}) ===")
# Find the test period row
for row in tree.iter("tr"):
cells = row.findall("td") or row.findall("th")
if len(cells) < 2:
continue
label_t = cells[0].text_content().strip()
if any(k in label_t for k in ["期间", "Period", "建模", "Model",
"前向", "Forward", "起止", "Date"]):
value = cells[1].text_content().strip()
print(f" {label_t}: {value}")
# Look for big section headers
print(f" -- h1/h2/h3 headers --")
for tag in ("h1", "h2", "h3", "h4"):
for el in tree.iter(tag):
t = (el.text_content() or "").strip()
if t:
print(f" <{tag}>: {t}")
# Count tables and tr
tables = tree.findall(".//table")
print(f" tables: {len(tables)}")
total_tr = sum(len(t.findall(".//tr")) for t in tables)
print(f" total <tr>: {total_tr}")
print()