Skip to content

Commit c9c1da6

Browse files
committed
fix: mass chart, GIF sync, descriptor card colors, SVG cleanup
ecosystem/result.py mass_history was never written to to_summary_dict() -- only species_mass_history was serialized. build_index read an empty list and produced no SVG path, showing "total mass conserved across run" even when mass dropped from 6789 to 303 au in a signal run. Fixed: mass_history added to the measures dict in to_summary_dict(). scripts/build_index.py Added backward-compat fallback: if mass_history is absent (older runs without the fix), reconstruct it by summing species_mass_history rows. viz/templates/ecosystem.html GIF sync: on tab switch, both mass and signal GIFs now restart from frame 0 via src-clear trick (img.src = ''; img.src = src) before the opacity swap. Switching mass↔signal always shows the same simulation moment on both sides. viz/templates/index.html receptor_sensitivity descriptor card changed from purple to teal to match emission_activity and signal_retention -- all three are signal-only descriptors and should share the same visual treatment. docs/signal-field.svg Full redraw: tighter font sizes (8-9.5px), proper label/mono/dim hierarchy, all text fits within containers, cross-arrows labeled concisely, footer note on conservation. No text overflow anywhere.
1 parent 28824e1 commit c9c1da6

5 files changed

Lines changed: 146 additions & 112 deletions

File tree

docs/signal-field.svg

Lines changed: 128 additions & 108 deletions
Loading

scripts/build_index.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,11 @@ def _render_ecosystem_run(run_dir: Path, publish: bool = False) -> str:
772772
min_dist = spawn.get("min_dist", "")
773773
measures = summary.get("measures", {})
774774
mass_history: list[float] = measures.get("mass_history", [])
775+
# Backward compat: older runs lack mass_history; reconstruct from species sums.
776+
if not mass_history:
777+
smh: list[list[float]] = measures.get("species_mass_history", [])
778+
if smh:
779+
mass_history = [sum(s[i] for s in smh) for i in range(len(smh[0]))]
775780
snapshot_steps: list[int] = measures.get("snapshot_steps", [])
776781
initial_mass = measures.get("initial_mass", 0.0)
777782
final_mass = measures.get("final_mass", 0.0)

src/biota/ecosystem/result.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ def to_summary_dict(self) -> dict[str, object]:
173173
"min_mass": m.min_mass,
174174
"mass_turnover": m.mass_turnover,
175175
"snapshot_steps": m.snapshot_steps,
176+
"mass_history": m.mass_history,
176177
"species_mass_history": m.species_mass_history,
177178
"species_territory_history": m.species_territory_history,
178179
"interaction_coefficients": m.interaction_coefficients,

0 commit comments

Comments
 (0)