Skip to content

Commit db4092f

Browse files
committed
feat: extract ACO pheromone data in worker results for heatmap visualization
1 parent c646339 commit db4092f

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎backend/app/services/worker.py‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,24 @@ def main():
573573
print(f"[worker] Clinical integration failed: {e}", flush=True)
574574
timing.append({"label": "Clinical integration (failed)", "duration_s": round(clin_dur, 2)})
575575

576+
# Extract ACO pheromone data (if available)
577+
try:
578+
if experiment.has_pheromone():
579+
pheromone_data = experiment.get_pheromone()
580+
results["pheromone"] = [
581+
{
582+
"feature": dict(p)["feature_name"],
583+
"feature_idx": dict(p)["feature_idx"],
584+
"tau_positive": round(dict(p)["tau_positive"], 6),
585+
"tau_negative": round(dict(p)["tau_negative"], 6),
586+
"tau_total": round(dict(p)["tau_total"], 6),
587+
}
588+
for p in pheromone_data
589+
]
590+
print(f"[worker] Extracted pheromone data: {len(results['pheromone'])} features", flush=True)
591+
except Exception as e:
592+
print(f"[worker] Pheromone extraction skipped: {e}", flush=True)
593+
576594
# Save results first — display_results() may panic in Rust and kill the process
577595
with open(results_path, "w") as f:
578596
json.dump(results, f, indent=2, default=str)

0 commit comments

Comments
 (0)