Skip to content

Release: F0 network s8_ft, physics-grounded variance & cubic_clamped warping, raster annotator, WMF seeding, and speedups (dev into main) - #109

Merged
KasparP merged 33 commits into
mainfrom
dev
Dec 3, 2026
Merged

KasparP merged 33 commits into
mainfrom
dev

Conversation

@KasparP

@KasparP KasparP commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

This merges dev into main, the release after v0.1.13 (#86). It brings the pull requests merged into dev since then (#88 through #111); each was reviewed by Copilot before it went into dev. The README's release notes have a new section, "Changes since v0.1.13", for users (#108, #111).

Performance of s8_ft versus earlier models

On held-out GFP ground truth without activity, s8_ft eliminates the systematic 1.7% (s7_ft) and 2.2% (s6_ft) baseline underestimation—landing within 0.14–0.17% of the true mean—and more than triples s7_ft's 8-frame baseline tracking gain over the static mean image (-0.86% MSE change vs -0.27% for s7_ft and -0.08% for s6_ft). By reading per-trial registration statistics (*_REGSTATS-80Hz.h5) and frame-by-frame sub-pixel motion blur, s8_ft keeps quiet-frame noise calibrated (z_var = 0.996 on GFP, 0.972 on held-out sensor mice) while cutting spurious event-induced variance inflation threefold (+5.3% on event frames vs +15.3% in s7_ft and +14.6% in s6_ft). Where events are injected, s8_ft does not follow event time courses (+0.5% slope) and absorbs +16.1% of mean added activity into the static baseline level—slightly less than s7_ft (+17.4%) and nearly half of an identically trained control model without the statistics encoder (+31.0%), whereas s6_ft erred in the opposite direction (-8.4%). On held-out iGluSnFR4f recordings, s8_ft matches s7_ft on unmasked labeled dendrite (4/8 mice each: 2/4 held-out test mice and 2/4 validation mice) and improves dim activity-free support (-30.0% vs -24.2%), with two practical caveats: like earlier models it still absorbs roughly half the mean shift of very weak (1–2%) sources, and it requires *_REGSTATS-80Hz.h5 sidecars (s7_ft remains available when they are absent).

What this adds

The F0 network (s8_ft) and automatic --fast + --sd prediction

Support-independent core baseline (F0_core)

Physics-grounded variance, spatial pooling, projected SNR, and clamped bicubic warping

SILo, registration, raster annotation, and spine readout

Checks

  • Lint as CI runs it (flake8 . and interrogate --verbose .): passes (0 flake8 issues, 3882 / 3882 = 100.0% docstring coverage).
  • Merging into main runs tag_and_publish, which makes the patch bump (v0.1.14). PyPI publishing remains off.

KasparP and others added 28 commits November 30, 2026 20:55
* Wire F0 network /sd into raster source localization

- Pass --sd in silo_baseline._predict_args so slap2-f0 predict-registered writes /sd alongside /baseline.
- Add read_network_sd in baseline_map and wire baseline_sd into localize_sources and localize_trial, scaling by sqrt(varFacDS_t / mean_t(varFacDS)) with optional single-frame dim-pixel floor and SiloParams.localization_sd toggle.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address Copilot review: invalidate pre-/sd network localization hash, use unsmoothed vf_raw, and propagate net_var to bootstrap null

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Release fb_var alongside bsd_v after _network_std

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Eliminate float64 copy in _network_std and release buffers before null_calibration

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Floor zero-baseline regions in bootstrap null when network uncertainty is positive

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Use correlated additive noise and dedicated calibration at zero-baseline pixels

- Split external noise_var in null_movie into compound-Poisson shot noise up to
  gain * max(0, baseline) * var_factor plus zero-mean correlated Gaussian
  additive noise for excess/nonpositive-baseline variance
- Calibrate nonpositive-baseline regions with positive noise_var against their
  own additive-noise null score distribution (with cropped draws to reach
  _MIN_BIN_VALUES when needed)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Bound noise_var split memory and preserve variance-floor attenuation in null calibration

- Accumulate _photons_and_nv statistics and build float32 shot/additive arrays in
  256-frame blocks without retaining full-trial float64 temporaries
- Normalize squared-maxima null calibration by per-pixel floor attenuation
  alpha = mean_t(noise_var / std^2) (and stratify soft_threshold by alpha) so
  equal-baseline regions with distinct network SDs calibrate accurately

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Separate imbalanced attenuation plateaus in soft-threshold null calibration

- Use midpoint / value-space edges in _alpha_bands before merging underfilled
  bins so imbalanced attenuation plateaus stay separated
- Add unit and end-to-end regression tests for 9:1 imbalanced plateaus under
  score='soft_threshold' with variance_floor=True

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… warping, and solver /sd (#89)

* Add pooling-conserved kernel variance, projected SNR, clamped bicubic warping, and solver /sd

- Add variance_mode='kernel' (kappa_dt * sum(c * F2) / sum(c * F1)^2) in PixelFormer
  and trial_data to track 200 Hz scan-phase variance while preserving spatial ROI
  pooling conservation, plus per-pixel q_spatial for estimate_photon_scale
- Add snr_mode='projected' in activity_noise projecting residuals through the WLS
  extractor to account for patchwise bilinear spatial covariance and short-lag
  temporal correlation
- Add non-negativity-clamped Keys bicubic resampling (cubic_clamped) in alignment,
  plan, and baseline_map to avoid second-interpolation peak droop without ringing
- Add apply_trial_sd_finv (solver_sd=True) scaling trial.finv by 80 Hz pooling-
  deattenuated network /sd, and mask discarded frames in read_varfac
- Add didactic release documentation (docs/source/variance_and_interpolation.rst,
  silo.rst, README.md)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix NaN coordinates, discard masking, temporal calibration, and lag centering

- Guard NaN query coordinates in _bilinear_bounds so unaligned trials return NaN instead of raising IndexError under cubic_clamped
- Exclude 80 Hz motion-discarded frames (via recNegErr / discard_frames) when averaging varFacDS, q80, /sd, and baseline in apply_trial_sd_finv
- Guard 0 / NaN in estimate_photon_scale and divide by (finv / kernel_scale) * q_spatial using exact temporal calibration for both kernel and freshness modes
- Preserve the full frame axis in _projected_trace_noise and center projected residuals by median and paired-sample means before estimating lag correlation
- Add regression tests covering NaN warps, discarded-frame spikes, kernel-formed noise calibration, residual DC offsets, and gapped lag correlation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Project y - b with per-pixel WLS weights and shorth lower-tail estimation

- Compute per-frame WLS trace projections directly from y - b using pixel-frame validity weights (0 on finish_pixels synthetic samples, referenced to the 25th-percentile finv) and source-specific observation masks with partial-footprint variance renormalization
- Estimate quiet mode center and noise variance via shortest-half (shorth) lower-tail statistics so fitted LS or nonnegative NNLS activity never absorbs footprint-aligned noise or inflates SNR
- Verify half-pixel kernel variance against exact analytical mixed-corner F2/F1^2 and add regression tests for LS/NNLS fitted activity and per-pixel synthetic fills

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Bound projected WLS memory, handle singular frames, center before rescaling, and hash SD discard filters

- Solve per-frame WLS projected-noise normal systems in bounded 256-frame blocks to cap memory on large connected source groups
- Fall back per frame inside _solve_wls_block when a single frame's missing pixels make overlapping footprints collinear, excluding only that singular frame
- Subtract _shorth_center in raw projected units before rescaling by sqrt(var_ref_k / cov_t[k]) so constant baseline offsets do not become time-varying under varying finv
- Include motion_thresh and discard_initial_s in prepare stage_settings when solver_sd is active

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Chunk /sd & varFacDS reads in 256-frame blocks and decouple spatial coverage from finv

- Stream /sd and slap2/varFacDS in 256-frame blocks inside apply_trial_sd_finv and _alignment_pooling_stats so full-FOV trials never allocate movie-sized float64 stacks
- Check per-frame source observation coverage using spatial pixel coverage (obs_b * inv_rv) rather than finv-weighted precision so legitimate high-finv scan-phase frames are never dropped from _projected_trace_noise

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Update container settings hash and summary schema tests for new SiloParams fields

- Include variance_mode in test_settings_hash_ignores_key_order_only dict literal matching TrialLoadParams
- Update expected /params count from 48 to 51 in test_experiment_summary_schema for varianceMode, snrMode, and warpInterp

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
per_trial_summary.h5 stored sources/spatial/per_trial_profiles dense and
uncompressed: trials x sources x rows x cols float32, almost all zeros
(or NaN for trials without sources). 18 trials of a 0.6 megapixel field
with 218 sources took 9.1 GB, and a 200-trial session about 100 GB per
path. The dataset is now deflated (level 1, shuffle) in chunks of one
image column, the axis along which it is written and read, split along
the trial axis when a column exceeds 1 GiB. README.md and
docs/source/file_formats.rst describe the storage, as they do for
varFacDS.

On that recording the file takes 0.67 GB instead of 15.5 GB with
identical values. Writing costs time: the summaries took 132 s instead
of 73 s, about 3% of that recording's extraction (1,303 s against
1,261 s for 36 trial-paths). On a smaller field (24 trial-paths) the
file takes 0.14 GB instead of 1.28 GB and the extraction 231 s against
227 s.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
summary: store the per-trial footprint images deflate-compressed
… frames (#90)

The scan images a few percent of the registered frame. Localization ran its
filters on whole frames and held several whole-frame copies of a trial, so
few workers fitted in memory and most of the work was done on empty pixels.

- Every per-pixel step, the filter in time included, runs on frames x valid
  pixels. The filters in space and the local-maximum score run on rectangles
  around the valid pixels grown by the filters' reach (activity_score_tiled,
  score_tiles): the same terms in the same order.
- The bootstrap null is made and scored at the valid pixels too
  (null_movie_valid, with the shot and additive components and the cropped
  draws for pixels of nonpositive baseline).
- localize_trial reads an HDF5 movie 64 frames at a time and keeps the
  activity channel at the imaged pixels (SparseMovie); the discards come
  from the alignment alone, so the valid pixels are counted while reading.
  The baseline, its SD and the variance factor are read from their files at
  the valid pixels only (PixelReader; the baseline tile by tile).
- The soft-threshold score keeps the whole-frame path (its scale comes from
  the whole filtered movie).

Results are bit-identical to the whole-frame code: unit tests compare the
tiled score, the null (model SD and network SD) and the lazy loader with the
whole-frame versions.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
On a CUDA device trials were registered one at a time. With
ExecutionOptions.gpu_workers (giant register --gpu-workers N), N
processes share the device. Each keeps to an equal part of 85% of the
device's memory and releases what torch holds back after a trial;
without that, the processes' caches filled a 48 GB card and the summary
statistics of a few trials were skipped for lack of memory. A trial that
still runs out of memory, or ends without its statistics file, is
registered again alone.

24 trial-paths of 20 s (0.17 megapixel frames), each run alone on an
idle machine with the inputs dropped from the file cache: 107.5 s one at
a time, 62.0 s with 6 processes (1.73x); peak GPU memory 40.7 GB and
24.2 GB. All 1,896 datasets of the 72 output files are bit-identical.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ile over trials (#92)

baseline_trial_mean read the network baselines in 64-frame blocks. The
files are stored in chunks of 256 frames (2 MB compressed chunks, above
HDF5's default chunk cache), so every chunk was decompressed four times.
The frames are now read in the stored type in whole storage chunks,
whatever their depth, and summed in the same 64-frame blocks as before (a
block that a storage chunk does not end on is completed from the next
read), so the result is unchanged to the bit.

The not-imaged check took np.nanpercentile along the trials, which loops
over pixels in Python. nanpercentile_over_trials sorts the stack once and
gives numpy's result to the bit, including NaN where a neighbour of the
percentile is infinite and ValueError for a percentile outside 0 to 100.

giant spine readout, each run alone on an idle machine with the inputs
dropped from the file cache: 79 s before and 38 s after on 24
trial-paths; 349 s and 184 s on 36 trial-paths of a larger frame. Every
dataset of the product is bit-identical.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
nansvd called numpy's full SVD up to ten times per ROI and channel and
kept three components. leading_svd takes them from the eigenvectors of
the smaller Gram matrix. A soma-sized ROI takes 2.6 s instead of 24.9 s.

The full SVD is still used where the Gram matrix would not reproduce it:
for data that are not float64 or whose shorter side is under 64, for zero
components or as many as the shorter side, when a leading singular value
is under 1e-7 of the largest, and when two of the k + 1 leading singular
values agree to 1e-7 of the largest (tied components are not determined
by the data). Otherwise the reconstruction from the components agrees
with the full SVD's to about 1e-15 of the largest singular value for
well-conditioned data and to about 1e-11 where the smallest of the k is
1e-6 of the largest.

Full extraction of 36 trial-paths with user ROIs (0.58 megapixel
frames), each run alone on an idle machine: CPU time 34,897 s before and
19,372 s after, wall time 1,344 s and 1,261 s. The user-ROI traces agree
to 7e-15 relative; every other dataset is bit-identical.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
When ROIs are deleted between the acquisitions of a session, the registered
images of later trials start at another raster position (slap2/cropRow,
slap2/cropCol in the alignment files). The plan placed every trial at the
same top left corner, so the template and the across-trial alignment were
off by the difference (49 and 138 px on one of our sessions).

- plan_path(frame_origins=...) moves each trial by its start relative to the
  earliest of the path for the template and the alignment, and keeps that
  offset in the trial's map from the consensus frame (ExtractionPlan.
  frame_offset, alignment/frame_offset in the plan file).
- The summary writes frame_info/trial_frame_offset when an offset is not
  zero and adds it back to the offline shifts; the typed summary reader
  returns it (FrameInfo.trial_frame_offset).
- The plan's settings hash holds the origins only when they differ, so plans
  of sessions without the change are reused.

On a session without a change of origin every numeric output is identical.
On the session with two deletions, 72 trials planned with this change agree
with the same trials cut to their common field to 0.4 px (rigid alignment)
and to 1 px wherever patchwise alignment is itself stable.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…t 100% again) (#96)

interrogate (which must report 100%) found four functions without a
docstring on dev: score_tiles.cost in extraction/raster/localization.py,
and PixelReader.__init__, SparseMovie.__init__ and _HalfSums.__init__ in
extraction/raster/trial.py. They say what block, exclude and the tiling
cost are exactly: block applies to datasets without spatial tiles, exclude
is a boolean array used as given, and the cost counts overlapping margins
twice. Docstrings only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
nanmedfilt2 took the 5 x 5 NaN-median at every pixel of the frame. A SLAP2
frame is imaged at a few percent of its pixels, and a window without a
value is NaN whatever is done with it, so only the windows that hold a
value are sorted now. On real activity images: 0.129 s to 0.007 s (337 x
497) and 0.359 s to 0.019 s (515 x 902), the same bytes.

The arguments are checked first: size must be a positive odd integer (any
integer type) and the image two-dimensional, else ValueError. For windows
of 600 or more elements (sides from 25; the package uses 5) an empty
window gives the plain np.nan, where the earlier form could hand on the
bits of a NaN of the window.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
giant silo-collect took about nine minutes on a long session, most of it
in work that scales with the number of trials and could be avoided. No
value that is written changes.

- The kinetics test and the summaries' first pass read each trial's
  activity-channel least-squares traces and sizes from the results files
  (results.trial_ls, results.trial_shape; PathResult.activity_ls and
  PathResult.sizes) instead of assembling and denoising the whole trial
  three times. They check the files as trial_outcome does, with shared
  code, read the traces from the same open files that were checked, and
  assemble in full whatever cannot be judged without its data.
- kinetics._plateaus finds the plateau maxima with array operations
  instead of a Python loop over every run (same integers; one row only).
- Per-trial footprint images: a block is built in the file's orientation,
  NaN are zeroed once per trial, and the chunks are shuffled and deflated
  in up to 8 threads and written with write_direct_chunk, the same stored
  bytes as HDF5's own filters give (checked chunk by chunk). Only into a
  shuffle-then-deflate dataset in one-column chunks of the dataset's own
  type; everything else is written as before.
- Spot event test: where each page of the registered movie is its own
  chunk, only the activity channel's pages are read.

Measured, each run alone: 270 trials and 2 paths, 524 s to 301 s; 202
trials and 2 paths, 674 s to 301 s; 12 trials, 21.0 s to about 15 s. The
experiment and per-trial summaries are identical dataset by dataset to
the unchanged code's, except the two time strings.

Reviewed with the Codex CLI in kortdriessen#10.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…un in worker processes (#100)

giant silo-plan runs one process per path with cpu_count // paths BLAS
threads each. Two things made it slower and far more expensive than
needed; the plan files are the same bit for bit.

- Idle OpenBLAS threads spin after every call (the default timeout is
  2**28 cycles), and the plan makes many small calls. The plan's worker
  processes now start with OPENBLAS_THREAD_TIMEOUT=4 (make_pool and
  run_jobs take blas_idle): on a 12-trial set, 536 s of CPU time became 34
  s in the same wall time.
- The patchwise alignment refit one trial after another (72 % of the plan
  on a 270-trial session). A round's trials, and the two half images'
  refits, are now given to spawned worker processes when the stage runs
  with more than one worker: up to 8 per path, at most one per 4 trials,
  started at the first refit. A refit's last bits depend on the number of
  BLAS threads, so the workers start with the thread count of the BLAS
  loaded in the planning process and each worker's count is checked;
  where it cannot be read or matched, in a daemonic process, or where the
  workers cannot be started (then with a warning), the refits stay in
  the planning process. The workers compute under the caller's numpy
  error settings and their warnings are issued again in the caller.
  --workers 1 starts no process at all in the plan stage. From Python,
  silo.plan starts them for a single path (planned in the caller) only
  with workers_from_here=True, which giant silo-plan sets.

Pools are started through one function, parallel.spawn_pool: every worker
is spawned while the variables are set (a start barrier; before, a worker
started late could miss them), the environment is changed under one lock
and restored exactly, the start has a deadline, and a failed, interrupted
or late start kills its workers.

Measured, each run alone: 270 trials and 2 paths, 127 s wall / 471 s CPU
to 49.5 s / 275 s; 202 trials and 2 paths, 151 s / 1,081 s to 87 s / 401
s; plans identical dataset by dataset (593 of 593, 457 of 457, and 89 of
89 on a 12-trial set with the final code: 291 s of CPU time to 41 s).

A workers argument that is not a positive integer now raises ValueError
in align_trials_patchwise, refine_alignment, plan_path and plan_one.

Reviewed with the Codex CLI in kortdriessen#9.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ermutations (#101)

giant spine readout took 40 to 50 minutes on a long session, nearly all
of it in two places that are done per trial or per source with nothing
shared: averaging every trial's network baseline file (12 to 25 minutes,
one process), and the trend tests' permutations (given to threads, which
gained nothing: many small numpy calls under the interpreter lock).

Both now go to spawned worker processes (--workers on giant spine readout
and giant spine images, default up to 8, at most 61 on Windows), started
with the BLAS/OpenMP thread variables at 1 by the package's pool start
(parallel.spawn_pool) and only when there is work for them; at most twice
as many tasks as workers are in flight. Every value is computed by the
same function on the same inputs, so nothing depends on the number of
workers. When a readout fails or is interrupted, the tasks not yet
handed to the workers are cancelled and the readout does not wait for
the workers; the workers ignore Ctrl-C, which the command handles.

From Python, make_spine_summary starts processes only when workers is
given and more than 1 (None now means the calling process; it used up
to 8 threads for the permutations); a script that asks for workers needs
the __main__ guard. In a daemonic process, and with a warning where the
workers cannot be started, the work is done in the calling process.
trend_tests(pool=...) and network_f0_stack(pool=...) are new optional
arguments.

Measured, each run alone, outputs identical dataset by dataset: 12
trials and 2 paths, 33.7 s to 11.6 s; one path of a 270-trial session
with 2,000 permutations, 407 s to 90 s; trend tests alone (204 trials, 96
sources), 57.5 s to 8.6 s. A whole 202-trial session with 2,000
permutations takes 186 s.

Reviewed with the Codex CLI in kortdriessen#11.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* silo: solver_sd off by default

The option of #89 multiplies the solver's variance per pixel by the
ratio of the F0 network's noise variance to the solver's own model. The
network's variance is accurate (within 4% of the variance measured in
the registered GFP movie at every brightness) and is 0.2 times the
model's on the dimmest pixels and 4 to 5 times on the brightest, while
the event penalty lam is tuned to the model. With the option on, real
events on bright structures are dropped (injected events of size 4 and 8
at the brightest 15% of sources: 37% found, 98% without the option).

The default is now False; --set solver_sd=true switches the scaling on.
The saved params hold solverSd only when it is on.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* tests: the kept frames reach the prepare stage's settings only with solver_sd

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
…d on the footprint's support (#50)

F0 is the baseline projected onto the footprint, (h . B) / (h . h), so dF / F0
weights the pixels by the footprint and falls when the footprint widens (5 x 5
support: 5-7% lower on real recordings than with 3 x 3). F0_core is the baseline
of the 3 x 3 pixels around the footprint's peak pixel in footprint units,
sum_C B / sum_C h: dF / F0_core is the core's dF/F, the flux of the source's
activity in its core over the baseline there.

- solver_baseline: core_mask, source_core_f0 (CORE_HALF 1).
- solver: SubproblemResult / TrialResult / TrialActivity carry f0_core per
  channel; assembly places it when every subproblem has one.
- results files: optional /subproblems/<k>/f0_core (older files read without);
  TrialShape.has_core.
- summary: sources/temporal/F0_core beside F0 (not in MATLAB's schema; NaN in a
  trial whose results have none; absent when none has); the summary codec reads
  and writes it (Source.f0_core).
- Existing fields, MATLAB's layout and the stage hashes are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With many solver processes on one machine the solver is limited by memory
traffic, not by cores. This keeps every floating-point operation, its
order and its type, so every result is the same to the last bit, and
moves less memory:

- _LossWork: the loss, its gradient and its curvature are written into
  buffers kept for the whole fit, and the factors that do not change
  during a fit are formed once. Used by the activity and footprint
  problems for the solver's own calls (arrays of one type, no autograd,
  no autocast or inference mode); any other call takes variance_loss as
  before.
- _KeptSum: the time kernel's doubling schedule of shifted additions is
  laid out once per input layout with two kept tensors, on the thread
  that first called the kernel; TimeKernel.conv and conv_adj still return
  new tensors.
- Footprint fit: with the variance held fixed, the curvature product
  c @ xx does not change during the fit and is formed once.
- Noise estimate: the per-frame weighted-least-squares blocks run in the
  solver's threads, each computed exactly as before, under the caller's
  numpy error settings.

Measured, each run alone, every results file identical dataset by
dataset: 87 trial-paths with 20 solver processes of 4 threads, 280 s to
216 s; one process of 4 threads on 4 trial-paths, 124 s to 72 s (final
code).

Reviewed with the Codex CLI in kortdriessen#8.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ions (#50)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GIAnT-MATLAB seeds sources either from the combined activity image
(getActImPeaks, the default) or, with peakMethod='wmf', by whitened
matched filtering of the aligned per-trial activity images
(findSourcesWMF.m). Python had only the first; peak_method="wmf" raised
NotImplementedError. This ports findSourcesWMF.m at GIAnT-MATLAB e61873b.

- extraction/raster/wmf.py: find_sources_wmf (trials on axis 0,
  zero-based [row, col] seeds, strongest first, MATLAB's diagnostics).
- plan.py: with peak_method="wmf" and at least four imaged valid trials
  the plan seeds from the aligned trials; with fewer it falls back to
  get_act_im_peaks, as SILo.m does. Seeds in a soma are dropped after the
  fit as in MATLAB.
- SiloParams / PlanParams: wmf_peak_th (3), wmf_dip (3), wmf_deblend_th
  (8; infinity skips the deblending fit). They enter the plan's hash and
  file only when peak_method="wmf", so existing plans stay valid and a
  Gaussian plan is the file it was. giant silo-collect refuses a plan
  seeded with another method or other WMF values.
- With WMF every source is judged by the evidence test (a WMF value is
  not on the activity image's SD scale).

The default stays getactimpeaks; nothing changes unless peak_method is
set (plan files of the default seeding are identical to dev's on a real
12-trial set).

Parity with MATLAB: 12 reference cases with every intermediate stage
(seeds within 1.4e-14 px), and one whole session, 28 runs over 14
settings and both paths: the same seeds in the same order (positions
within 5.5e-10 px). Four of the reference cases are checked in with
MATLAB's outputs.

Reviewed with the Codex CLI in kortdriessen#15.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ser (#106)

Raster sessions had no way to draw the soma ROIs that giant silo reads
(giant annotate is Band Scan only). giant annotate-raster [TRIAL_TABLE]
serves a local page and writes <savedr>/annotations/annotations.h5 on
every change.

- It reads only the trial table and the alignment files. Trials are put
  on one canvas by their frame origin and a whole-pixel shift onto a
  session template.
- ROIs are polygons drawn on the mean image of the session, of a range of
  trials or of one trial: somata (no sources are seeded inside) and plain
  ROIs (a trace). A timeline shows every trial's brightness, match to the
  session, sharpness, motion, discarded frames and online z.
- The file is GIAnT-MATLAB's schema 2 in the frame of an anchor trial, so
  read_annotations and MATLAB's loadAnnotationsH5 read it unchanged; the
  editable state is kept under /annotator. A file the annotator did not
  write is backed up before it is replaced.
- An ROI that was not edited keeps exactly its stored mask; one that
  crosses the anchor frame or covers no pixel is refused; a save belongs
  to the session and to the revision of the state the page started from,
  so a stale tab cannot replace ROIs.

A new command and a new package giant_python.annotator with its page;
nothing existing changes.

Reviewed with the Codex CLI in kortdriessen#13.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ine (#107)

On a many-core workstation the streamed giant silo leaves most cores idle
during extraction: one process loads every trial, cuts its subproblems,
hands them to the solver pool and writes the results, one trial after
another. Options that are off by default add what a shell loop over the
staged commands did:

- giant silo-prepare --prepare-workers N: N processes each load one trial
  at a time and write its container.
- giant silo-solve JOB --trial-workers M: M processes each solve one
  container's subproblems with --solver-threads threads.
- giant silo --prepare-workers N --trial-workers M: both pools at once
  after localization and planning; a container goes to a solver process
  as soon as it is written and is removed when its results file exists
  (--save-subproblems DIR keeps them in DIR). At most N + 2M trial-paths
  are in flight. A container already beside a current results file is
  left alone.

With it: set_threads() also limits the BLAS libraries already loaded (a
solver process of 4 threads ran about 130); the prepare stage leaves the
plan's per-trial image stacks in the file (2.6 GB per path and process on
a 202-trial session); a worker that dies is reported with the trial-paths
in flight; one reader of /proc/self/maps for the package.

Measured, each run alone: 24 trial-paths, 175 s streamed to 128 s; 36
trial-paths with user ROIs, 1,278 s to 595 s; a 202-trial session, 14.6 s
to 3.9 s per trial-path (the whole session in 40 min). The summaries are
those of the streamed run (text datasets apart, and roi_fsvd at 6.8e-16,
which depends on the loading process's BLAS threads on dev too).

No default changes; the streamed run remains the default.

Reviewed with the Codex CLI in kortdriessen#14.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Pass --fast automatically in silo_baseline._predict_args when out_frames is not specified (ast=True default).
- Update README.md and docs/source/silo.rst for the s8_ft release checkpoint and add the Changes since v0.1.13 release notes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… notes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pass --fast by default in predict_baselines and update docs for s8_ft

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The baseline solver scores mismatched window sizes and omits the final window, potentially selecting the wrong cluster and distorting noise and SNR estimates.

1 open issue
What changed in this PR

This release expands GIAnT’s raster annotation and source-extraction capabilities, updates F0 prediction, and accelerates registration, SILo, and spine analysis.

Changes:

  • Adds automatic fast F0 prediction with noise estimates and physics-grounded variance handling.
  • Adds raster annotation support, WMF seeding integration, and trial-frame offsets.
  • Introduces process-based parallelism, targeted numerical optimizations, and regression coverage.
File Description
tests/​spine/​test_spine_trends.py Checks permutation results across pool modes.
tests/​spine/​test_spine_pipeline.py Tests worker behavior and output equivalence.
tests/​spine/​test_spine_images.py Tests chunked reads and parallel image generation.
tests/​spine/​test_spine_coverage.py Verifies percentile equivalence and edge cases.
tests/​spine/​conftest.py Controls worker defaults in tests.
tests/​registration/​test_cli.py Tests GPU worker options and retries.
tests/​raster/​wmf_reference.py Loads MATLAB WMF reference data.
tests/​raster/​test_raster_wmf_deblend.py Tests WMF fitting boundaries.
tests/​raster/​test_raster_trial.py Tests sparse loading and pixel reads.
tests/​raster/​test_raster_trial_data.py Validates leading-component SVD accuracy.
tests/​raster/​test_raster_spots.py Tests channel-selective movie reads.
tests/​raster/​test_raster_silo_params.py Tests scientific settings and WMF compatibility.
tests/​raster/​test_raster_silo_network.py Tests prediction flags and noise settings.
tests/​raster/​test_raster_silo_load_ahead.py Checks execution-option compatibility.
tests/​raster/​test_raster_seeding.py Updates WMF input-error expectations.
tests/​raster/​test_raster_null.py Verifies sparse bootstrap equivalence.
tests/​raster/​test_raster_kinetics.py Checks vectorized peak detection.
tests/​raster/​test_raster_container.py Includes variance mode in hash coverage.
tests/​raster/​data/​make_matlab_wmf.m Generates MATLAB WMF references.
tests/​raster/​data/​make_matlab_wmf_h5.py Packs compact WMF fixtures.
tests/​raster/​data/​compare_matlab_wmf.py Audits WMF intermediate and final results.
tests/​annotator/​synthetic.py Creates synthetic annotation sessions.
tests/​annotator/​__init__.py Defines the annotator test package.
src/​giant_python/​spine/​trends.py Supports pooled permutation tasks.
src/​giant_python/​spine/​pipeline.py Manages readout worker lifecycle.
src/​giant_python/​spine/​images.py Optimizes baseline reads and parallel averaging.
src/​giant_python/​spine/​coverage.py Vectorizes percentiles over trials.
src/​giant_python/​registration/​frames.py Accumulates squared temporal-kernel weights.
src/​giant_python/​pipeline/​silo_spots.py Skips unused channel pages.
src/​giant_python/​pipeline/​silo_solve.py Adds whole-trial solver processes.
src/​giant_python/​pipeline/​silo_session.py Centralizes pool startup and thread limits.
src/​giant_python/​pipeline/​silo_collect.py Reads trial sizes and traces without full assembly.
src/​giant_python/​pipeline/​silo_baseline.py Enables automatic fast prediction and noise output.
src/​giant_python/​pipeline/​register.py Adds shared-GPU workers and serial retries.
src/​giant_python/​parallel.py Adds coordinated process-pool startup and cleanup.
src/​giant_python/​models/​experiment_summary.py Exposes trial-frame offsets.
src/​giant_python/​extraction/​raster/​solver.py Updates photon scaling and result validation.
src/​giant_python/​extraction/​raster/​solver_setup.py Adds selectable noise-estimation modes.
src/​giant_python/​extraction/​raster/​solver_baseline.py Adds projected noise estimation and threaded blocks.
src/​giant_python/​extraction/​raster/​seeding.py Integrates WMF conventions and guidance.
src/​giant_python/​extraction/​raster/​kinetics.py Vectorizes plateau detection.
src/​giant_python/​export/​f0_training.py Excludes discarded frames from variance exports.
src/​giant_python/​cli.py Exposes raster annotation and GPU workers.
src/​giant_python/​cli_spine.py Exposes process workers for spine commands.
src/​giant_python/​cli_silo.py Exposes preparation and whole-trial solver workers.
src/​giant_python/​annotator/​state.py Validates ROI state and polygon geometry.
src/​giant_python/​annotator/​__init__.py Introduces the raster annotator package.
pyproject.toml Bundles the annotator page.
docs/​source/​spine.rst Documents process workers and cancellation.
docs/​source/​index.rst Links variance and interpolation documentation.
docs/​source/​file_formats.rst Documents offsets and compressed footprints.
docs/​source/​architecture.rst Describes shared parallel utilities.

Review effort: Balanced

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The span calculation includes one more sample than the median, which can select the wrong shortest half and distort the projected noise/SNR calculation.

1 open issue

Review effort: Balanced

Fix _shorth_center window span to match exact m-sample slices

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The new variance and projected-SNR defaults alter scientific outputs, requiring domain-expert validation of calibration and source selection on representative recordings.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

KasparP and others added 3 commits December 3, 2026 06:06
SILo: F0_core, each source's core baseline: a dF/F that does not depend on the footprint's support (#50)
…se notes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
docs: add Performance of s8_ft versus earlier models to release notes
@KasparP
KasparP merged commit ba46480 into main Dec 3, 2026
3 checks passed
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.

3 participants