Grafo graphify (EquationMiner + gen_data), aggiorna_grafo.sh e istruzioni in CLAUDE.md

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
davideandClaude Sonnet 5.5 committed 2026-11-22 17:53:15 +01:00
1 parent e98e19a78c
commit 13e3c315d8
6 files changed
+656

No files matched your search

+5
View File
@@ -5,3 +5,8 @@ __pycache__/
.pytest_cache/ .pytest_cache/
input/*.csv input/*.csv
extern/ extern/
# graphify: si versionano solo grafo, report e HTML; il resto è rigenerabile
graphify-out/*
!graphify-out/graph.json
!graphify-out/graph.html
!graphify-out/GRAPH_REPORT.md
+12
View File
@@ -19,6 +19,18 @@ uv venv .venv && uv pip install -e ".[dev]"
``` ```
`--config`/`--output` vanno **prima** del sottocomando. `input/` contiene i CSV da analizzare; `output/`, `input/*.csv` e `extern/` (clone di `gen_data`) sono ignorati da git. Ogni analisi scrive in `output/<nome csv>/` (`01_domini`, `02_sovrapposizione`, `03_report`, vedi `uscita.PASSI`). `--config`/`--output` vanno **prima** del sottocomando. `input/` contiene i CSV da analizzare; `output/`, `input/*.csv` e `extern/` (clone di `gen_data`) sono ignorati da git. Ogni analisi scrive in `output/<nome csv>/` (`01_domini`, `02_sovrapposizione`, `03_report`, vedi `uscita.PASSI`).
## Grafo (graphify)
`graphify-out/graph.json` unisce EquationMiner e `extern/gen_data` (il repo che genera i dati su cui è costruito fitseg). **Dopo ogni modifica al codice (qui o in `extern/gen_data`) aggiorna subito il grafo** con `./aggiorna_grafo.sh` (scarica prima l'ultimo `gen_data` dal remote con `scarica_gen_data.sh -u`, poi rigenera). Equivale a, in quest'ordine (se `graph.json` è già l'unione, `update .` salta la ricostruzione e gen_data si duplica: va cancellato prima):
```bash
rm -f graphify-out/graph.json graphify-out/graph-equationminer.json
graphify update . && graphify update extern/gen_data
cp graphify-out/graph.json graphify-out/graph-equationminer.json
graphify merge-graphs graphify-out/graph-equationminer.json extern/gen_data/graphify-out/graph.json --out graphify-out/graph.json
```
Controllo: ≈ 326 + 71 nodi meno i condivisi (391 oggi); molti di più = duplicati. Solo codice (nessun LLM): i `.md` non entrano nel grafo senza `/graphify`.
## Architettura (`src/fitseg/`, un modulo per responsabilità) ## Architettura (`src/fitseg/`, un modulo per responsabilità)
`cli.py` (due sottocomandi, unico punto d'ingresso) → `config.py`, `dati.py` (lettura) → `domini.py` (gradini ⇒ domini, I/O di `domini.toml`) → `analisi.py` (ordina i domini, sceglie il modello) → `fit.py` (`adatta`) con `modelli.py` (registro `MODELLI`) → `uscita.py` (cartelle dei passi, grafici, report; il report incorpora le immagini con percorsi relativi `../01_domini/…`, quindi i nomi dei file/cartelle vanno cambiati in modo coerente). Nel report **ogni grandezza matematica è in LaTeX** (`$…$`, `$$…$$`; l'equazione in `MODELLI` è LaTeX, i valori si formattano con `uscita._num`): usa `\\` solo in stringhe raw e mantieni i `$` bilanciati per riga (c'è un test). `cli.py` (due sottocomandi, unico punto d'ingresso) → `config.py`, `dati.py` (lettura) → `domini.py` (gradini ⇒ domini, I/O di `domini.toml`) → `analisi.py` (ordina i domini, sceglie il modello) → `fit.py` (`adatta`) con `modelli.py` (registro `MODELLI`) → `uscita.py` (cartelle dei passi, grafici, report; il report incorpora le immagini con percorsi relativi `../01_domini/…`, quindi i nomi dei file/cartelle vanno cambiati in modo coerente). Nel report **ogni grandezza matematica è in LaTeX** (`$…$`, `$$…$$`; l'equazione in `MODELLI` è LaTeX, i valori si formattano con `uscita._num`): usa `\\` solo in stringhe raw e mantieni i `$` bilanciati per riga (c'è un test).
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Aggiorna gen_data dal remote (clone/pull) e rigenera graphify-out/graph.json (EquationMiner + gen_data).
set -euo pipefail
cd "$(dirname "$0")"
./scarica_gen_data.sh -u
rm -f graphify-out/graph.json graphify-out/graph-equationminer.json
graphify update . && graphify update extern/gen_data
cp graphify-out/graph.json graphify-out/graph-equationminer.json
graphify merge-graphs graphify-out/graph-equationminer.json extern/gen_data/graphify-out/graph.json --out graphify-out/graph.json
+152
View File
@@ -0,0 +1,152 @@
# Graph Report - EquationMiner (2026-11-22)
## Corpus Check
- 33 files · ~21,494 words
- Verdict: corpus is large enough that graph structure adds value.
- Unclassified: 3 file(s) not represented in the graph (top: (none) 2, .toml 1)
## Summary
- 329 nodes · 709 edges · 18 communities (16 shown, 2 thin omitted)
- Extraction: 88% EXTRACTED · 12% INFERRED · 0% AMBIGUOUS · INFERRED: 88 edges (avg confidence: 0.94)
- Token cost: 0 input · 0 output
## Graph Freshness
- Built from commit: `e98e19a7`
- Run `git rev-parse HEAD` and compare to check if the graph is stale.
- Run `graphify update .` after code changes (no API cost).
## Community Hubs (Navigation)
- uscita.py
- numpy
- Algoritmi
- cli.py
- pytest
- analisi.py
- CLAUDE.md
- test_domini.py
- test_report.py
- Test
- Uso
- Configurazione
- Output
- 5. Fit (`fit.adatta`)
- Panoramica
- scarica_gen_data.sh script
- pulisci.sh
- fitseg
## God Nodes (most connected - your core abstractions)
1. `analizza_domini()` - 24 edges
2. `segnale()` - 21 edges
3. ``test_fit.py` — fit e analisi (A7, A8, A9, A13, A18, A22, A23)` - 18 edges
4. `scegli()` - 16 edges
5. `adatta()` - 16 edges
6. `fit_scelto()` - 14 edges
7. `_passo_domini()` - 14 edges
8. `scrivi_report()` - 12 edges
9. `Algoritmi` - 12 edges
10. `Moduli` - 12 edges
## Surprising Connections (you probably didn't know these)
- `6. Scelta del modello (`analisi.scegli`)` --references--> `scegli()` [INFERRED]
docs/algoritmi.md → src/fitseg/analisi.py
- `5b. Costanti condivise (`analisi.analizza_domini`)` --references--> `analizza_domini()` [INFERRED]
docs/algoritmi.md → src/fitseg/analisi.py
- `Moduli` --references--> `valido()` [INFERRED]
docs/moduli.md → src/fitseg/analisi.py
- `Moduli` --references--> `fit_scelto()` [INFERRED]
docs/moduli.md → src/fitseg/analisi.py
- `Statistica` --references--> `scegli()` [INFERRED]
docs/assunzioni.md → src/fitseg/analisi.py
## Import Cycles
- None detected.
## Communities (18 total, 2 thin omitted)
### Community 0 - "uscita.py"
Cohesion: 0.07
Nodes (29): Architettura (`src/fitseg/`, un modulo per responsabilità), Comandi, Gotcha, Grafo (graphify), Test, `modelli.py` — registro dei modelli, `uscita.py` — cartelle, grafici, report, `test_report.py` — forma del report e dei grafici (+21 more)
### Community 1 - "numpy"
Cohesion: 0.12
Nodes (24): `test_fit.py` — fit e analisi (A7, A8, A9, A13, A18, A22, A23), analizza_domini(), _acf1(), adatta(), _partenza(), _costante(), _esp_decad(), segnale() (+16 more)
### Community 2 - "Algoritmi"
Cohesion: 0.08
Nodes (26): 1. Lettura dei dati (`dati.leggi_csv`), 2. Stima del rumore (`domini.sigma_rumore`), 3. Rilevamento dei gradini (`domini.trova_gradini`), 4. Costruzione dei domini (`domini.proponi`), 5b. Costanti condivise (`analisi.analizza_domini`), 6. Scelta del modello (`analisi.scegli`), 7. Riscaldamento come salto (`analisi._gradino`, `analisi._affina_salti`), Algoritmi (+18 more)
### Community 3 - "cli.py"
Cohesion: 0.09
Nodes (18): `analisi.py` — scelta e orchestrazione dei domini, `cli.py` — punto d'ingresso, `config.py` — configurazione, `dati.py` — lettura del CSV, `domini.py` — suddivisione in domini, `fit.py` — regressione di un modello, Moduli, Strutture dati comuni (+10 more)
### Community 4 - "pytest"
Cohesion: 0.10
Nodes (16): csv_sintetico(), test_cli_csv_non_valido_exit_4(), test_cli_domini_e_analizza(), test_cli_domini_non_validi_exit_6(), test_cli_errori(), test_chiave_mancante(), test_config_inesistente(), test_csv_colonna_mancante() (+8 more)
### Community 5 - "analisi.py"
Cohesion: 0.14
Nodes (20): _affina_salti(), _finale(), fit_scelto(), scegli(), _serie(), valido(), _valore(), valuta() (+12 more)
### Community 6 - "CLAUDE.md"
Cohesion: 0.34
Nodes (8): Estensioni possibili (non presenti), Limiti noti, Limiti noti ed estensioni, Scelte progettuali già fatte, Documentazione di fitseg, Avvio rapido, Documentazione, fitseg
### Community 7 - "test_domini.py"
Cohesion: 0.19
Nodes (15): `test_domini.py` — suddivisione (A5, A6, A21), test_confini_vicini_agli_istanti_dei_gradini(), test_domini_contigui_e_completi(), test_domini_toml_intervallo_vuoto_rifiutato(), test_domini_toml_non_contigui_rifiutati(), test_domini_toml_tipo_non_valido(), test_domini_toml_vuoto_rifiutato(), test_gradino_distribuito_su_due_campioni_sotto_soglia() (+7 more)
### Community 8 - "test_report.py"
Cohesion: 0.23
Nodes (11): scrivi_csv(), esegui(), test_costante_senza_r2_e_senza_zero_negativo(), test_dominio_indeterminato_senza_ripetizioni_e_con_il_minimo(), test_grafici_con_campioni_esclusi_e_modelli_alternativi(), test_grafico_indeterminato_senza_pannello_residui(), test_intervallo_del_dominio_include_l_ultimo_campione(), test_motivo_con_un_solo_modello_senza_parsimonia() (+3 more)
### Community 9 - "Test"
Cohesion: 0.20
Nodes (10): Cosa non è coperto, Il segnale sintetico (`tests/conftest.py`), Test, `test_cli.py` — CLI, `test_config_dati.py` — errori di configurazione e CSV (A1, A2), `test_selezione.py` — regola di scelta ([algoritmi.md](algoritmi.md) §6), Tre livelli, Validazione contro i parametri veri (`test_validazione.py`) (+2 more)
### Community 10 - "Uso"
Cohesion: 0.22
Nodes (9): 1. Installazione, 2. Dati di ingresso, 3. Comandi, 4. Cosa esce, 5. Codici di uscita, 6. Pulizia dei dati, 7. Sviluppo, Correggere i domini a mano (+1 more)
### Community 11 - "Configurazione"
Cohesion: 0.25
Nodes (8): Configurazione, `[dati]` — formato del CSV (`dati.py`), `[domini]` — riconoscimento dei domini (`domini.py`, `analisi.py`), `domini.toml` — domini modificabili (`domini.py`), Esempi, `[fit.modelli_per_tipo]` — modelli provati per tipo di dominio, `[fit]` — regressione e scelta (`fit.py`, `analisi.py`), `[output]` (`cli.py`)
### Community 12 - "Output"
Cohesion: 0.25
Nodes (8): `01_domini/domini.png`, `02_sovrapposizione/dominio<k>_<serie>.png`, `02_sovrapposizione/sovrapposizione_<serie>.png`, `03_report/report.md`, `03_report/risultati.json`, Colori, Come leggere i messaggi, Output
### Community 13 - "5. Fit (`fit.adatta`)"
Cohesion: 0.29
Nodes (7): 5.1 Modelli (`modelli.MODELLI`, $t' = t - t_0$), 5.2 Partenza, 5.3 Minimizzazione, 5.4 Incertezze, 5.5 Metriche, 5.6 Validità e identificabilità, 5. Fit (`fit.adatta`)
### Community 14 - "Panoramica"
Cohesion: 0.33
Nodes (6): Concetti, Cosa fa, Dove andare avanti, Esempio (seed 7 di `gen_data`), Il segnale, Panoramica
### Community 15 - "scarica_gen_data.sh script"
Cohesion: 0.50
Nodes (3): aggiorna_grafo.sh script, scarica_gen_data.sh script, uso()
## Knowledge Gaps
- **1 isolated node(s):** `fitseg`
These have ≤1 connection - possible missing edges or undocumented components. (Counts symbols only; 118 node(s) total have ≤1 connection when file, concept and rationale nodes are included.)
- **2 thin communities (<3 nodes) omitted from report** — run `graphify query` to explore isolated nodes.
## Suggested Questions
_Questions this graph is uniquely positioned to answer:_
- **Why does `Moduli` connect `cli.py` to `uscita.py`, `analisi.py`, `CLAUDE.md`?**
_High betweenness centrality (0.080) - this node is a cross-community bridge._
- **Are the 5 inferred relationships involving `analizza_domini()` (e.g. with `Architettura (`src/fitseg/`, un modulo per responsabilità)` and `5b. Costanti condivise (`analisi.analizza_domini`)`) actually correct?**
_`analizza_domini()` has 5 INFERRED edges - model-reasoned connections that need verification._
- **What connects `fitseg` to the rest of the system?**
_1 weakly-connected nodes found - possible documentation gaps or missing edges._
- **Should `uscita.py` be split into smaller, more focused modules?**
_Cohesion score 0.06509803921568627 - nodes in this community are weakly interconnected._
- **Why does `segnale()` connect `numpy` to `test_report.py`, `Test`, `pytest`, `test_domini.py`?**
_High betweenness centrality (0.063) - this node is a cross-community bridge._
- **Are the 17 inferred relationships involving ``test_fit.py` — fit e analisi (A7, A8, A9, A13, A18, A22, A23)` (e.g. with `test_adeguatezza_ignora_gli_scarti_casuali()` and `test_analisi_completa_sintetico()`) actually correct?**
_``test_fit.py` — fit e analisi (A7, A8, A9, A13, A18, A22, A23)` has 17 INFERRED edges - model-reasoned connections that need verification._
- **Should `numpy` be split into smaller, more focused modules?**
_Cohesion score 0.1241565452091768 - nodes in this community are weakly interconnected._
+477
View File
@@ -0,0 +1,477 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>graphify - graphify-out/graph.html</title>
<script src="https://unpkg.com/vis-network@9.1.6/standalone/umd/vis-network.min.js"
integrity="sha384-Ux6phic9PEHJ38YtrijhkzyJ8yQlH8i/+buBR8s3mAZOJrP1gwyvAcIYl3GWtpX1"
crossorigin="anonymous"></script>
<style>
:root {
--bg: #0f0f1a; --panel: #1a1a2e; --border: #2a2a4e; --input-border: #3a3a5e;
--text: #e0e0e0; --text-2: #aaa; --text-3: #ccc; --muted: #555; --count: #666;
--neighbor-border: #333; --node-label: #ffffff;
}
[data-theme="light"] {
--bg: #ffffff; --panel: #f8f9fa; --border: #d9dee5; --input-border: #c3cad4;
--text: #222222; --text-2: #666666; --text-3: #333333; --muted: #888888; --count: #777777;
--neighbor-border: #ccc; --node-label: #222222;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; display: flex; height: 100vh; overflow: hidden; }
#graph { flex: 1; }
#sidebar { width: 280px; background: var(--panel); border-left: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
#search-wrap { padding: 12px; border-bottom: 1px solid var(--border); }
#search { width: 100%; background: var(--bg); border: 1px solid var(--input-border); color: var(--text); padding: 7px 10px; border-radius: 6px; font-size: 13px; outline: none; }
#search:focus { border-color: #4E79A7; }
#search-results { max-height: 140px; overflow-y: auto; padding: 4px 12px; border-bottom: 1px solid var(--border); display: none; }
.search-item { padding: 4px 6px; cursor: pointer; border-radius: 4px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item:hover { background: var(--border); }
#info-panel { padding: 14px; border-bottom: 1px solid var(--border); min-height: 140px; }
#info-panel h3 { font-size: 13px; color: var(--text-2); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
#info-content { font-size: 13px; color: var(--text-3); line-height: 1.6; }
#info-content .field { margin-bottom: 5px; }
#info-content .field b { color: var(--text); }
#info-content .empty { color: var(--muted); font-style: italic; }
.neighbor-link { display: block; padding: 2px 6px; margin: 2px 0; border-radius: 3px; cursor: pointer; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--neighbor-border); }
.neighbor-link:hover { background: var(--border); }
#neighbors-list { max-height: 160px; overflow-y: auto; margin-top: 4px; }
#legend-wrap { flex: 1; overflow-y: auto; padding: 12px; }
#legend-wrap h3 { font-size: 13px; color: var(--text-2); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.legend-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; border-radius: 4px; font-size: 12px; }
.legend-item:hover { background: var(--border); padding-left: 4px; }
.legend-item.dimmed { opacity: 0.35; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.legend-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-count { color: var(--count); font-size: 11px; }
#stats { padding: 10px 14px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); }
#legend-controls { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 4px 0; }
#legend-controls label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; color: var(--text-2); user-select: none; }
#legend-controls label:hover { color: var(--text); }
.legend-cb, #select-all-cb { appearance: none; -webkit-appearance: none; width: 14px; height: 14px; border: 1.5px solid var(--input-border); border-radius: 3px; background: var(--bg); cursor: pointer; position: relative; flex-shrink: 0; }
.legend-cb:checked, #select-all-cb:checked { background: #4E79A7; border-color: #4E79A7; }
.legend-cb:checked::after, #select-all-cb:checked::after { content: ''; position: absolute; left: 3.5px; top: 1px; width: 4px; height: 7px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
#select-all-cb:indeterminate { background: #4E79A7; border-color: #4E79A7; }
#select-all-cb:indeterminate::after { content: ''; position: absolute; left: 2px; top: 5px; width: 8px; height: 2px; background: #fff; border: none; transform: none; }
#theme-wrap { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
#theme-wrap button { flex: 1; background: var(--bg); color: var(--text-2); border: 1px solid var(--input-border); border-radius: 4px; padding: 3px 0; font-size: 11px; cursor: pointer; }
#theme-wrap button:hover { color: var(--text); }
#theme-wrap button[aria-pressed="true"] { background: #4E79A7; border-color: #4E79A7; color: #fff; }
</style>
<script id="graphify-theme-init">
// Apply the saved theme before first paint (#3894). No saved choice keeps the
// historical dark look; "system" follows prefers-color-scheme.
(function () {
var pref = null;
try { pref = localStorage.getItem('graphify-theme'); } catch (e) {}
var t = pref === 'light' ? 'light'
: pref === 'system' && window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches ? 'light'
: 'dark';
document.documentElement.setAttribute('data-theme', t);
})();
</script>
</head>
<body>
<div id="graph"></div>
<div id="sidebar">
<div id="theme-wrap" role="group" aria-label="Theme">
<button type="button" data-theme-choice="light">Light</button>
<button type="button" data-theme-choice="dark">Dark</button>
<button type="button" data-theme-choice="system">System</button>
</div>
<div id="search-wrap">
<input id="search" type="text" placeholder="Search nodes..." autocomplete="off">
<div id="search-results"></div>
</div>
<div id="info-panel">
<h3>Node Info</h3>
<div id="info-content"><span class="empty">Click a node to inspect it</span></div>
</div>
<div id="legend-wrap">
<h3>Communities</h3>
<div id="legend-controls">
<label><input type="checkbox" id="select-all-cb" checked onchange="toggleAllCommunities(!this.checked)">Select All</label>
</div>
<div id="legend"></div>
</div>
<div id="stats">329 nodes &middot; 709 edges &middot; 18 communities</div>
</div>
<script>
const RAW_NODES = [{"id": "src_fitseg_config_erroreconfig", "label": "ErroreConfig", "color": {"background": "#76B7B2", "border": "#76B7B2", "highlight": {"background": "#ffffff", "border": "#76B7B2"}}, "size": 14.2, "font": {"size": 0, "color": "#ffffff"}, "title": "ErroreConfig", "community": 3, "community_name": "cli.py", "source_file": "src/fitseg/config.py", "file_type": "code", "degree": 5}, {"id": "src_fitseg_dati_erroredati", "label": "ErroreDati", "color": {"background": "#76B7B2", "border": "#76B7B2", "highlight": {"background": "#ffffff", "border": "#76B7B2"}}, "size": 14.2, "font": {"size": 0, "color": "#ffffff"}, "title": "ErroreDati", "community": 3, "community_name": "cli.py", "source_file": "src/fitseg/dati.py", "file_type": "code", "degree": 5}, {"id": "tests_test_validazione_genera", "label": "genera()", "color": {"background": "#59A14F", "border": "#59A14F", "highlight": {"background": "#ffffff", "border": "#59A14F"}}, "size": 11.7, "font": {"size": 0, "color": "#ffffff"}, "title": "genera()", "community": 4, "community_name": "pytest", "source_file": "tests/test_validazione.py", "file_type": "code", "degree": 2}, {"id": "tests_conftest_cfg", "label": "cfg()", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 12.5, "font": {"size": 0, "color": "#ffffff"}, "title": "cfg()", "community": 9, "community_name": "Test", "source_file": "tests/conftest.py", "file_type": "code", "degree": 3}, {"id": "tests_conftest_sintetico", "label": "sintetico()", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 13.3, "font": {"size": 0, "color": "#ffffff"}, "title": "sintetico()", "community": 9, "community_name": "Test", "source_file": "tests/conftest.py", "file_type": "code", "degree": 4}, {"id": "src_fitseg_uscita_colori_domini", "label": "colori_domini()", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 14.2, "font": {"size": 0, "color": "#ffffff"}, "title": "colori_domini()", "community": 0, "community_name": "uscita.py", "source_file": "src/fitseg/uscita.py", "file_type": "code", "degree": 5}, {"id": "src_fitseg_uscita_eq_numerica", "label": "_eq_numerica()", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 16.7, "font": {"size": 12, "color": "#ffffff"}, "title": "_eq_numerica()", "community": 0, "community_name": "uscita.py", "source_file": "src/fitseg/uscita.py", "file_type": "code", "degree": 8}, {"id": "src_fitseg_uscita_eq_numerica_segno", "label": "segno()", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 10.8, "font": {"size": 0, "color": "#ffffff"}, "title": "segno()", "community": 0, "community_name": "uscita.py", "source_file": "src/fitseg/uscita.py", "file_type": "code", "degree": 1}, {"id": "src_fitseg_uscita_etichetta", "label": "_etichetta()", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 11.7, "font": {"size": 0, "color": "#ffffff"}, "title": "_etichetta()", "community": 0, "community_name": "uscita.py", "source_file": "src/fitseg/uscita.py", "file_type": "code", "degree": 2}, {"id": "src_fitseg_uscita_grafico_domini", "label": "grafico_domini()", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 17.5, "font": {"size": 12, "color": "#ffffff"}, "title": "grafico_domini()", "community": 0, "community_name": "uscita.py", "source_file": "src/fitseg/uscita.py", "file_type": "code", "degree": 9}, {"id": "src_fitseg_uscita_grafico_gradino", "label": "_grafico_gradino()", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 13.3, "font": {"size": 0, "color": "#ffffff"}, "title": "_grafico_gradino()", "community": 0, "community_name": "uscita.py", "source_file": "src/fitseg/uscita.py", "file_type": "code", "degree": 4}, {"id": "src_fitseg_uscita_legenda", "label": "_legenda()", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 13.3, "font": {"size": 0, "color": "#ffffff"}, "title": "_legenda()", "community": 0, "community_name": "uscita.py", "source_file": "src/fitseg/uscita.py", "file_type": "code", "degree": 4}, {"id": "src_fitseg_uscita_limiti_y", "label": "_limiti_y()", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 12.5, "font": {"size": 0, "color": "#ffffff"}, "title": "_limiti_y()", "community": 0, "community_name": "uscita.py", "source_file": "src/fitseg/uscita.py", "file_type": "code", "degree": 3}, {"id": "src_fitseg_uscita_num", "lLine truncated
const RAW_EDGES = [{"from": "src_fitseg_config_leggi", "to": "src_fitseg_config_erroreconfig", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "src_fitseg_config", "to": "src_fitseg_config_erroreconfig", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "src_fitseg_config_erroreconfig", "to": "src_fitseg_config_py_exception", "label": "inherits", "title": "inherits [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "docs_moduli_cli_py_punto_d_ingresso", "to": "src_fitseg_config_erroreconfig", "label": "references", "title": "references [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "docs_moduli_config_py_configurazione", "to": "src_fitseg_config_erroreconfig", "label": "references", "title": "references [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "src_fitseg_dati_leggi_csv", "to": "src_fitseg_dati_erroredati", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "src_fitseg_dati", "to": "src_fitseg_dati_erroredati", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "src_fitseg_dati_erroredati", "to": "src_fitseg_dati_py_exception", "label": "inherits", "title": "inherits [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "docs_moduli_cli_py_punto_d_ingresso", "to": "src_fitseg_dati_erroredati", "label": "references", "title": "references [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "docs_moduli_dati_py_lettura_del_csv", "to": "src_fitseg_dati_erroredati", "label": "references", "title": "references [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "tests_test_validazione_genera", "to": "tests_test_validazione_py_fixture", "label": "references", "title": "references [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "tests_test_validazione", "to": "tests_test_validazione_genera", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "tests_conftest_cfg", "to": "tests_conftest_py_fixture", "label": "references", "title": "references [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "tests_conftest", "to": "tests_conftest_cfg", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "docs_test_il_segnale_sintetico_tests_conftest_py", "to": "tests_conftest_cfg", "label": "references", "title": "references [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "tests_conftest_sintetico", "to": "tests_conftest_segnale", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "tests_conftest_sintetico", "to": "tests_conftest_py_fixture", "label": "references", "title": "references [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "tests_conftest", "to": "tests_conftest_sintetico", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "docs_test_il_segnale_sintetico_tests_conftest_py", "to": "tests_conftest_sintetico", "label": "references", "title": "references [INFERRED]", "dashes": true, "width": 1, "color": {"opacity": 0.35}, "confidence": "INFERRED"}, {"from": "src_fitseg_uscita_grafico_domini", "to": "src_fitseg_uscita_colori_domini", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "src_fitseg_uscita_sovrapposizione_domini", "to": "src_fitseg_uscita_colori_domini", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "src_fitseg_uscita_sovrapposizione_generale", "to": "src_fitseg_uscita_colori_domini", "label": "calls", "title": "calls [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "src_fitseg_uscita", "to": "src_fitseg_uscita_colori_domini", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "src_fiLine truncated
const LEGEND = [{"cid": 0, "color": "#4E79A7", "label": "uscita.py", "count": 51}, {"cid": 1, "color": "#F28E2B", "label": "numpy", "count": 39}, {"cid": 2, "color": "#E15759", "label": "Algoritmi", "count": 33}, {"cid": 3, "color": "#76B7B2", "label": "cli.py", "count": 32}, {"cid": 4, "color": "#59A14F", "label": "pytest", "count": 32}, {"cid": 5, "color": "#EDC948", "label": "analisi.py", "count": 30}, {"cid": 6, "color": "#B07AA1", "label": "CLAUDE.md", "count": 20}, {"cid": 7, "color": "#FF9DA7", "label": "test_domini.py", "count": 19}, {"cid": 8, "color": "#9C755F", "label": "test_report.py", "count": 15}, {"cid": 9, "color": "#BAB0AC", "label": "Test", "count": 11}, {"cid": 10, "color": "#4E79A7", "label": "Uso", "count": 9}, {"cid": 11, "color": "#F28E2B", "label": "Configurazione", "count": 8}, {"cid": 12, "color": "#E15759", "label": "Output", "count": 8}, {"cid": 13, "color": "#76B7B2", "label": "5. Fit (`fit.adatta`)", "count": 7}, {"cid": 14, "color": "#59A14F", "label": "Panoramica", "count": 6}, {"cid": 15, "color": "#EDC948", "label": "scarica_gen_data.sh script", "count": 5}, {"cid": 16, "color": "#B07AA1", "label": "pulisci.sh", "count": 3}, {"cid": 17, "color": "#FF9DA7", "label": "fitseg", "count": 1}];
// HTML-escape helper — prevents XSS when injecting graph data into innerHTML
function esc(s) {
return String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;').replace(/'/g,'&#39;');
}
// Build vis datasets
const nodesDS = new vis.DataSet(RAW_NODES.map((n, i) => ({
id: n.id, label: n.label, color: n.color, size: n.size,
font: n.font, title: n.title,
// Fermat/golden-angle spiral seed positions (#3699): spreading nodes out
// before physics runs keeps avoidOverlap from computing near-zero-distance
// repulsion that blows the BarnesHut recursion into a stack overflow on large
// graphs. `i` is the map index — physics still settles small graphs identically.
x: 30 * Math.sqrt(i) * Math.cos(i * 2.4),
y: 30 * Math.sqrt(i) * Math.sin(i * 2.4),
community: n.community, community_name: n.community_name,
source_file: n.source_file, file_type: n.file_type, degree: n.degree,
member_count: n.member_count,
})));
const edgesDS = new vis.DataSet(RAW_EDGES.map((e, i) => ({
id: i, from: e.from, to: e.to,
label: '',
title: e.title,
dashes: e.dashes,
width: e.width,
color: e.color,
arrows: { to: { enabled: true, scaleFactor: 0.5 } },
})));
const container = document.getElementById('graph');
const network = new vis.Network(container, { nodes: nodesDS, edges: edgesDS }, {
physics: {
enabled: true,
solver: 'forceAtlas2Based',
forceAtlas2Based: {
gravitationalConstant: -60,
centralGravity: 0.005,
springLength: 120,
springConstant: 0.08,
damping: 0.4,
avoidOverlap: 0.8,
},
stabilization: { iterations: 200, fit: true },
},
interaction: {
hover: true,
tooltipDelay: 100,
hideEdgesOnDrag: true,
navigationButtons: false,
keyboard: false,
},
nodes: { shape: 'dot', borderWidth: 1.5 },
edges: { smooth: { type: 'continuous', roundness: 0.2 }, selectionWidth: 3 },
});
// Theme toggle (#3894): Light / Dark / System, persisted in localStorage.
const THEME_KEY = 'graphify-theme';
const themeMQ = window.matchMedia ? window.matchMedia('(prefers-color-scheme: light)') : null;
let themeLabelColor = '#ffffff'; // matches the per-node font color set in Python
function themePref() {
let p = null;
try { p = localStorage.getItem(THEME_KEY); } catch (e) {}
return (p === 'light' || p === 'dark' || p === 'system') ? p : null;
}
function applyTheme(pref) {
const t = pref === 'light' ? 'light' : (pref === 'system' && themeMQ && themeMQ.matches) ? 'light' : 'dark';
const root = document.documentElement;
if (!root) return;
root.setAttribute('data-theme', t);
document.querySelectorAll('[data-theme-choice]').forEach(b => {
b.setAttribute('aria-pressed', String(b.dataset.themeChoice === (pref || 'dark')));
});
const labelColor = getComputedStyle(root).getPropertyValue('--node-label').trim();
if (labelColor && labelColor !== themeLabelColor) {
themeLabelColor = labelColor;
nodesDS.update(nodesDS.get().map(n => ({ id: n.id, font: Object.assign({}, n.font, { color: labelColor }) })));
}
}
document.querySelectorAll('[data-theme-choice]').forEach(b => {
b.addEventListener('click', () => {
const pref = b.dataset.themeChoice;
try { localStorage.setItem(THEME_KEY, pref); } catch (e) {}
applyTheme(pref);
});
});
if (themeMQ) {
const onSchemeChange = () => { if (themePref() === 'system') applyTheme('system'); };
if (themeMQ.addEventListener) themeMQ.addEventListener('change', onSchemeChange);
else if (themeMQ.addListener) themeMQ.addListener(onSchemeChange);
}
applyTheme(themePref());
network.once('stabilizationIterationsDone', () => {
network.setOptions({ physics: { enabled: false } });
});
function showInfo(nodeId) {
const n = nodesDS.get(nodeId);
if (!n) return;
const neighborIds = network.getConnectedNodes(nodeId);
const neighborItems = neighborIds.map(nid => {
const nb = nodesDS.get(nid);
const color = nb ? nb.color.background : '#555';
return `<span class="neighbor-link" style="border-left-color:${esc(color)}" data-nid="${esc(nid)}">${esc(nb ? nb.label : nid)}</span>`;
}).join('');
const isMetaNode = !n.file_type && !n.source_file;
let html = `<div class="field"><b>${esc(n.label)}</b></div>`;
if (!isMetaNode) {
html += `<div class="field">Type: ${esc(n.file_type || 'unknown')}</div>`;
}
html += `<div class="field">Community: ${esc(n.community_name || '')}</div>`;
if (!isMetaNode) {
html += `<div class="field">Source: ${esc(n.source_file || '-')}</div>`;
} else if (n.member_count !== undefined && n.member_count !== null) {
html += `<div class="field">Members: ${esc(n.member_count)}</div>`;
}
html += `<div class="field">Degree: ${n.degree}</div>`;
if (neighborIds.length) {
html += `<div class="field" style="margin-top:8px;color:var(--text-2);font-size:11px">Neighbors (${neighborIds.length})</div><div id="neighbors-list">${neighborItems}</div>`;
}
document.getElementById('info-content').innerHTML = html;
}
function focusNode(nodeId) {
network.focus(nodeId, { scale: 1.4, animation: true });
network.selectNodes([nodeId]);
showInfo(nodeId);
}
// Neighbor links use a data attribute + one delegated listener rather than an
// inline onclick. A node id/label sourced from a document or a scraped URL
// (graphify add) can contain a double-quote; dropping the stringified id
// unescaped into a quoted onclick both broke every link and allowed a hostile
// source to inject an event handler into the local report (stored XSS, #1838).
// esc() on data-nid keeps the value inside the attribute; the listener reads it
// back verbatim. Bound to document so it survives the innerHTML rebuild that
// recreates #neighbors-list on each showInfo().
document.addEventListener('click', e => {
const el = e.target.closest('.neighbor-link');
if (el && el.dataset.nid !== undefined) focusNode(el.dataset.nid);
});
// Sidebar tooltips reuse vis-network's .vis-tooltip style and 100ms tooltipDelay.
// Names get one only when CSS ellipsis truncates them (the full text is still in
// the DOM); counts always get one, to say what the number is. Text is set with
// textContent only (labels are untrusted). Delegated on document so rows rebuilt
// later (search results, showInfo()) are covered.
const sidebarTip = document.createElement('div');
sidebarTip.className = 'vis-tooltip';
sidebarTip.style.cssText = 'white-space: normal; max-width: 360px; overflow-wrap: break-word;';
document.body.appendChild(sidebarTip);
let sidebarTipTimer = null;
let sidebarTipEl = null; // element whose text the tooltip shows
let sidebarTipZone = null; // element the pointer must leave to hide it
function hideSidebarTip() {
clearTimeout(sidebarTipTimer);
sidebarTip.style.visibility = 'hidden';
sidebarTip.textContent = '';
sidebarTipEl = sidebarTipZone = null;
}
document.addEventListener('mouseover', e => {
const zone = e.target.closest && e.target.closest('.legend-count, .legend-item, .search-item, .neighbor-link');
// Anywhere on a legend row except its count (dot, checkbox, gaps, padding)
// stands for the row's name, so moving within the row never re-triggers it.
const el = zone && zone.classList.contains('legend-item') ? zone.querySelector('.legend-label') : zone;
if (!el || el === sidebarTipEl) return;
hideSidebarTip();
const isCount = el.classList.contains('legend-count');
if (!isCount && el.scrollWidth <= el.clientWidth) return;
const text = isCount ? `${el.textContent} ${el.textContent === '1' ? 'node' : 'nodes'}` : el.textContent;
sidebarTipEl = el;
sidebarTipZone = zone;
const x = e.clientX, y = e.clientY;
sidebarTipTimer = setTimeout(() => {
sidebarTip.textContent = text;
sidebarTip.style.left = sidebarTip.style.top = '0px'; // measure at full max-width
sidebarTip.style.visibility = 'visible';
const w = sidebarTip.offsetWidth, h = sidebarTip.offsetHeight;
sidebarTip.style.left = Math.max(4, Math.min(x + 12, window.innerWidth - w - 4)) + 'px';
sidebarTip.style.top = (y + 16 + h > window.innerHeight ? Math.max(4, y - h - 8) : y + 16) + 'px';
}, 100);
});
document.addEventListener('mouseout', e => {
if (sidebarTipZone && !sidebarTipZone.contains(e.relatedTarget)) hideSidebarTip();
});
// A click rebuilds or hides the row (showInfo(), search pick) without a mouseout.
document.addEventListener('mousedown', hideSidebarTip);
// Track hovered node — hover detection is more reliable than click params
let hoveredNodeId = null;
network.on('hoverNode', params => {
hoveredNodeId = params.node;
container.style.cursor = 'pointer';
});
network.on('blurNode', () => {
hoveredNodeId = null;
container.style.cursor = 'default';
});
container.addEventListener('click', () => {
if (hoveredNodeId !== null) {
showInfo(hoveredNodeId);
network.selectNodes([hoveredNodeId]);
}
});
network.on('click', params => {
if (params.nodes.length > 0) {
showInfo(params.nodes[0]);
} else if (hoveredNodeId === null) {
document.getElementById('info-content').innerHTML = '<span class="empty">Click a node to inspect it</span>';
}
});
const searchInput = document.getElementById('search');
const searchResults = document.getElementById('search-results');
searchInput.addEventListener('input', () => {
const q = searchInput.value.toLowerCase().trim();
searchResults.innerHTML = '';
if (!q) { searchResults.style.display = 'none'; return; }
const matches = RAW_NODES.filter(n => n.label.toLowerCase().includes(q)).slice(0, 20);
if (!matches.length) { searchResults.style.display = 'none'; return; }
searchResults.style.display = 'block';
matches.forEach(n => {
const el = document.createElement('div');
el.className = 'search-item';
el.textContent = n.label;
el.style.borderLeft = `3px solid ${n.color.background}`;
el.style.paddingLeft = '8px';
el.onclick = () => {
network.focus(n.id, { scale: 1.5, animation: true });
network.selectNodes([n.id]);
showInfo(n.id);
searchResults.style.display = 'none';
searchInput.value = '';
};
searchResults.appendChild(el);
});
});
document.addEventListener('click', e => {
if (!searchResults.contains(e.target) && e.target !== searchInput)
searchResults.style.display = 'none';
});
const hiddenCommunities = new Set();
const selectAllCb = document.getElementById('select-all-cb');
function updateSelectAllState() {
const total = LEGEND.length;
const hidden = hiddenCommunities.size;
selectAllCb.checked = hidden === 0;
selectAllCb.indeterminate = hidden > 0 && hidden < total;
}
function toggleAllCommunities(hide) {
document.querySelectorAll('.legend-item').forEach(item => {
hide ? item.classList.add('dimmed') : item.classList.remove('dimmed');
});
document.querySelectorAll('.legend-cb').forEach(cb => {
cb.checked = !hide;
});
LEGEND.forEach(c => {
if (hide) hiddenCommunities.add(c.cid); else hiddenCommunities.delete(c.cid);
});
const updates = RAW_NODES.map(n => ({ id: n.id, hidden: hide }));
nodesDS.update(updates);
updateSelectAllState();
}
const legendEl = document.getElementById('legend');
LEGEND.forEach(c => {
const item = document.createElement('div');
item.className = 'legend-item';
const cb = document.createElement('input');
cb.type = 'checkbox';
cb.className = 'legend-cb';
cb.checked = true;
cb.addEventListener('change', (e) => {
e.stopPropagation();
if (cb.checked) {
hiddenCommunities.delete(c.cid);
item.classList.remove('dimmed');
} else {
hiddenCommunities.add(c.cid);
item.classList.add('dimmed');
}
const updates = RAW_NODES
.filter(n => n.community === c.cid)
.map(n => ({ id: n.id, hidden: !cb.checked }));
nodesDS.update(updates);
updateSelectAllState();
});
item.innerHTML = `<div class="legend-dot" style="background:${c.color}"></div>
<span class="legend-label">${c.label}</span>
<span class="legend-count">${c.count}</span>`;
item.prepend(cb);
item.onclick = (e) => {
if (e.target === cb) return;
cb.checked = !cb.checked;
cb.dispatchEvent(new Event('change'));
};
legendEl.appendChild(item);
});
</script>
<script>
// Render hyperedges as shaded regions
const hyperedges = [];
// afterDrawing passes ctx already transformed to network coordinate space.
// Draw node positions raw — no manual pan/zoom/DPR math needed.
// Andrew's monotone chain. Returns the hull in counter-clockwise order, which
// is what the perimeter must be traced in. Collinear and duplicate points
// collapse to the extremes, so degenerate member sets render as a segment
// rather than a zero-area crossed path.
function convexHull(pts) {
const p = pts.slice().sort((a, b) => (a.x - b.x) || (a.y - b.y));
if (p.length < 3) return p;
const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);
const build = seq => {
const out = [];
for (const q of seq) {
while (out.length >= 2 && cross(out[out.length - 2], out[out.length - 1], q) <= 0) out.pop();
out.push(q);
}
out.pop();
return out;
};
const hull = build(p).concat(build(p.slice().reverse()));
return hull.length >= 3 ? hull : p;
}
network.on('afterDrawing', function(ctx) {
hyperedges.forEach(h => {
// Legend toggles only set `hidden` on nodes; getPositions() still
// returns them, so skip hidden members or their hull lingers.
const positions = h.nodes
.filter(nid => { const n = nodesDS.get(nid); return n && n.hidden !== true; })
.map(nid => network.getPositions([nid])[nid])
.filter(p => p !== undefined);
if (positions.length < 2) return;
ctx.save();
ctx.globalAlpha = 0.12;
ctx.fillStyle = '#6366f1';
ctx.strokeStyle = '#6366f1';
ctx.lineWidth = 2;
ctx.beginPath();
// Centroid and expanded hull in network coordinates.
// The perimeter must follow hull order, not h.nodes order: tracing the
// raw member order self-intersects whenever the layout does not happen
// to place members in angular order, filling as crossed wedges.
const cx = positions.reduce((s, p) => s + p.x, 0) / positions.length;
const cy = positions.reduce((s, p) => s + p.y, 0) / positions.length;
const hull = convexHull(positions);
const expanded = hull.map(p => ({
x: cx + (p.x - cx) * 1.15,
y: cy + (p.y - cy) * 1.15
}));
ctx.moveTo(expanded[0].x, expanded[0].y);
expanded.slice(1).forEach(p => ctx.lineTo(p.x, p.y));
ctx.closePath();
ctx.fill();
ctx.globalAlpha = 0.4;
ctx.stroke();
// Label
ctx.globalAlpha = 0.8;
ctx.fillStyle = '#4f46e5';
ctx.font = 'bold 11px sans-serif';
ctx.textAlign = 'center';
ctx.fillText(h.label, cx, cy - 5);
ctx.restore();
});
});
</script>
</body>
</html>
+1
View File
@@ -0,0 +1 @@
{"directed":false,"multigraph":false,"graph":{"schema_version":1,"graphify_version":"0.9.109"},"nodes":[{"label":"ErroreConfig","_callable":true,"_callable_class":true,"_origin":"ast","community":3,"community_name":"cli.py","file_type":"code","norm_label":"erroreconfig","source_file":"src/fitseg/config.py","source_location":"L16","repo":"repo","local_id":"src_fitseg_config_erroreconfig","id":"repo::src_fitseg_config_erroreconfig"},{"label":"ErroreDati","_callable":true,"_callable_class":true,"_origin":"ast","community":3,"community_name":"cli.py","file_type":"code","norm_label":"erroredati","source_file":"src/fitseg/dati.py","source_location":"L6","repo":"repo","local_id":"src_fitseg_dati_erroredati","id":"repo::src_fitseg_dati_erroredati"},{"label":"genera()","_callable":true,"_origin":"ast","_py_fixture":"?","community":4,"community_name":"pytest","file_type":"code","norm_label":"genera()","source_file":"tests/test_validazione.py","source_location":"L18","repo":"repo","local_id":"tests_test_validazione_genera","id":"repo::tests_test_validazione_genera"},{"label":"cfg()","_callable":true,"_origin":"ast","_py_fixture":"?","community":9,"community_name":"Test","file_type":"code","norm_label":"cfg()","source_file":"tests/conftest.py","source_location":"L25","repo":"repo","local_id":"tests_conftest_cfg","id":"repo::tests_conftest_cfg"},{"label":"sintetico()","_callable":true,"_origin":"ast","_py_fixture":"?","community":9,"community_name":"Test","file_type":"code","norm_label":"sintetico()","source_file":"tests/conftest.py","source_location":"L39","repo":"repo","local_id":"tests_conftest_sintetico","id":"repo::tests_conftest_sintetico"},{"label":"colori_domini()","_callable":true,"_origin":"ast","community":0,"community_name":"uscita.py","file_type":"code","norm_label":"colori_domini()","source_file":"src/fitseg/uscita.py","source_location":"L29","repo":"repo","local_id":"src_fitseg_uscita_colori_domini","id":"repo::src_fitseg_uscita_colori_domini"},{"label":"_eq_numerica()","_callable":true,"_origin":"ast","community":0,"community_name":"uscita.py","file_type":"code","norm_label":"_eq_numerica()","source_file":"src/fitseg/uscita.py","source_location":"L57","repo":"repo","local_id":"src_fitseg_uscita_eq_numerica","id":"repo::src_fitseg_uscita_eq_numerica"},{"label":"segno()","_callable":true,"_origin":"ast","community":0,"community_name":"uscita.py","file_type":"code","norm_label":"segno()","source_file":"src/fitseg/uscita.py","source_location":"L61","repo":"repo","local_id":"src_fitseg_uscita_eq_numerica_segno","id":"repo::src_fitseg_uscita_eq_numerica_segno"},{"label":"_etichetta()","_callable":true,"_origin":"ast","community":0,"community_name":"uscita.py","file_type":"code","norm_label":"_etichetta()","source_file":"src/fitseg/uscita.py","source_location":"L71","repo":"repo","local_id":"src_fitseg_uscita_etichetta","id":"repo::src_fitseg_uscita_etichetta"},{"label":"grafico_domini()","_callable":true,"_origin":"ast","community":0,"community_name":"uscita.py","file_type":"code","norm_label":"grafico_domini()","source_file":"src/fitseg/uscita.py","source_location":"L108","repo":"repo","local_id":"src_fitseg_uscita_grafico_domini","id":"repo::src_fitseg_uscita_grafico_domini"},{"label":"_grafico_gradino()","_callable":true,"_origin":"ast","community":0,"community_name":"uscita.py","file_type":"code","norm_label":"_grafico_gradino()","source_file":"src/fitseg/uscita.py","source_location":"L178","repo":"repo","local_id":"src_fitseg_uscita_grafico_gradino","id":"repo::src_fitseg_uscita_grafico_gradino"},{"label":"_legenda()","_callable":true,"_origin":"ast","community":0,"community_name":"uscita.py","file_type":"code","norm_label":"_legenda()","source_file":"src/fitseg/uscita.py","source_location":"L95","repo":"repo","local_id":"src_fitseg_uscita_legenda","id":"repo::src_fitseg_uscita_legenda"},{"label":"_limiti_y()","_callable":true,"_origin":"ast","community":0,"community_name":"uscita.py","file_type":"code","norm_label":"_limiti_y()","source_file":"src/fitseg/uscita.py","source_location":"L101","repo":"repo","local_id":"src_fitseg_uscita_limiti_y","id":"repo::src_fitseg_uscita_limiti_y"},{"label":"_num()","_callable":true,"_origin":"ast","community":0,"community_name":"uscita.py","file_type":"code","norm_label":"_num()","source_file":"src/fitseg/uscita.py","source_location":"L41","repo":"repo","local_id":"src_fitseg_uscita_num","id":"repo::src_fitseg_uscita_num"},{"label":"_params()","_callable":true,"_origin":"ast","community":0,"community_name":"uscita.py","file_type":"code","norm_label":"_params()","source_file":"src/fitseg/uscita.py","source_location":"L51","repo":"repo","local_id":"src_fitseg_uscita_params","id":"repo::src_fitseg_uscita_params"},{"label":"_riga_equazione()","_callable":true,"_origin":"ast","community":0,"community_name":"uscita.py","file_type":"code","norm_label":"_riga_equazione()","source_file":"src/fitseg/uscita.py","source_location":"L265","repo":"repo","local_id":"src_fitseg_uscitaLine truncated