feat: add CaDecon Python bridge for automated deconvolution export#108
Merged
Conversation
Enable `calab.decon(traces, fs)` to open CaDecon in the browser and receive structured results (activity matrix + per-cell scalars + kernel params) back to Python via a two-POST binary transport pattern. - Add npy-writer.ts (inverse of npy-parser) for binary activity export - Extend bridge server with /api/v1/results/activity (.npy) and /api/v1/results (JSON) endpoints, plus configurable app param - Add decon() orchestrator, CaDeconResult NamedTuple, biexp waveform builder, and `calab cadecon` CLI subcommand - Wire ExportButton in CaDecon UI with loading/disabled states - 22 new tests (7 npy-writer, 5 bridge endpoints, 7 CaDeconResult, 3 waveform) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract shared _run_bridge() helper from tune()/decon() to eliminate ~60 lines of duplicated polling/heartbeat/shutdown boilerplate. Extract sortedCellIndices() in export-utils to avoid double-sorting lookup keys. Remove postActivityToBridge/postResultsToBridge from public io exports since they're internal to exportCaDeconToBridge. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
calab.decon(traces, fs)— new Python bridge that opens CaDecon in the browser and returns structuredCaDeconResult(activity matrix, per-cell alphas/baselines/PVEs, kernel waveforms, metadata).npy(potentially 10s of MB) followed by JSON scalars/metadata, mirroring the inbound data flowcalab cadeconCLI — new subcommand for file-based automated deconvolution with optional output savingNew files
packages/io/src/npy-writer.tspackages/io/src/__tests__/npy-writer.test.tsapps/cadecon/src/lib/export-utils.tspython/tests/test_decon.pyModified files
packages/io/src/bridge.tspostActivityToBridge,postResultsToBridge,exportCaDeconToBridgepackages/io/src/index.tsapps/cadecon/.../GroundTruthControls.tsxpython/.../_{compute,server,apps,cli,init}CaDeconResult, server endpoints,decon(), CLIpython/tests/test_bridge.pyTest plan
npm run format)calab.decon(traces, fs=30, app_url="http://localhost:5175/")→ run solver → Export to Python → verify result fields🤖 Generated with Claude Code