Skip to content

2D posterior guessing webapp (export + paint-and-compare) - #7

Draft
CommanderPho wants to merge 1 commit into
masterfrom
cursor/2d-posterior-guessing-567b
Draft

2D posterior guessing webapp (export + paint-and-compare)#7
CommanderPho wants to merge 1 commit into
masterfrom
cursor/2d-posterior-guessing-567b

Conversation

@CommanderPho

@CommanderPho CommanderPho commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

Adds an export-then-app workflow for interactive 2D posterior guessing:

  1. Export placefields, occupancy, spike counts, and true posteriors to a portable NPZ bundle (pho/posterior_guessing/ + scripts/export_posterior_guessing_bundle.py).
  2. Webapp (apps/posterior_guessing/) lets users scrub decoded time bins, inspect tuning curves of cells that fired, paint a guessed posterior on a blank canvas, press Enter to reveal the true posterior (different colormap), get a Hellinger-affinity score, and save predictions to disk.

A synthetic demo bundle is included at data/posterior_guessing/synthetic_demo_pf2d_guessing.npz.

How to run

# optional: regenerate synthetic demo
python scripts/export_posterior_guessing_bundle.py --synthetic

# from a decoder/pipeline pickle (when NeuroPy/pyPhoPlaceCellAnalysis are available)
python scripts/export_posterior_guessing_bundle.py --from-pkl /path/to/decoder.pkl --session-id my_session

uvicorn apps.posterior_guessing.server:app --reload --port 8765
# open http://127.0.0.1:8765

Tests

pytest tests/test_posterior_guessing.py — schema round-trip, scoring invariants, API hides true posterior until reveal (5 passed).

Open in Web Open in Cursor 

Export portable NPZ bundles (synthetic demo included), FastAPI + canvas UI
to scrub bins, paint guessed posteriors, reveal truth, score overlap, and
persist predictions for later analysis.

Co-authored-by: Pho Hale <CommanderPho@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants