SLAP2 photon gain varies across sessions and paths (constant across trials); fixed photonScale and per-trial Vk don't match

未关闭
#45 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
20/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
matlab
领域
data

调研方向

Start by reading setParamsExtractTrial.m (where photonScale = 25 is fixed) and the Vk estimation in localizeSources_vIM.m, then reproduce the photon transfer curve that slap2_f0/stats.py computes from exported trials. The first empirical step is measuring single-photon amplitude on the raw/200 Hz data for the four sessions and both paths and comparing against acquisition metadata. Done means photon units are consistent across sessions and paths, either by fixing a preprocessing scaling or by estimating the gain once per session/path and feeding it to both extraction and localization.

由索引模型根据 Issue 内容生成。

描述

Summary

In SLAP2 data, the photon-noise gain (temporal variance per unit mean) is constant across trials of a session, but it differs by up to 1.8× between sessions, and in one session between its two paths. The true photon gain should be constant barring an instrument recalibration. So either the instrument settings changed, or some step before GIAnT's fit scales the data differently by session or path.

GIAnT assumes one gain for all SLAP2 data in extraction: photonScale = 25 in setParamsExtractTrial.m. Localization re-estimates Vk independently for every trial in localizeSources_vIM.m.

Measurement

Data: the 80 Hz registered movies (alignHz 80, after MultiRoiRegistration), as SiLo localizes on them. Taken from the first 180 s of the four integration-test sessions, run through GIAnT main at d2fb85c.

Method:

  • Per pixel, take the temporal mean and variance of movie − GIAnT's fitted activity, on background pixels (valid and outside every labeled region, so with no fitted activity).
  • Fit binned variance against mean across pixels: a photon transfer curve. The slope is the gain; the intercept reflects an offset or additive noise.
session path trial lines / cycle median bg mean var / mean PTC slope intercept
780125_2025-03-14 1 2 122 2.80 7.97 7.93 −0.02
803121_2025-10-29 1 3 247 5.82 10.74 10.73 −0.20
878030_2026-08-28 1 1 96 1.83 12.76 14.56 −3.38
878030_2026-08-28 1 2 96 1.86 12.36 13.95 −3.03
878030_2026-08-28 1 3 96 1.86 12.50 14.14 −3.12
878030_2026-08-28 1 5 96 1.91 12.70 14.16 −2.86
878030_2026-08-28 2 2 448 1.92 9.36 10.45 −2.17
885233_2026-10-02 1 1 73 3.04 9.63 10.40 −2.41
885233_2026-10-02 1 2 73 2.95 9.79 10.62 −2.52
885233_2026-10-02 1 4 73 2.91 9.88 10.59 −2.08
885233_2026-10-02 2 2 297 3.15 9.92 10.53 −1.90

Observations:

  • Constant across trials: within ±3% for the four 878030 Path 1 trials and the three 885233 Path 1 trials.
  • Different across sessions: the slope ranges from 7.9 to 14.6.
  • Different across paths in one session: 878030 Path 1 is 14.2 and Path 2 is 10.5. In 885233 the two paths agree (10.5).
  • Not explained by the alignment kernel: lines per cycle sets how many raw samples the 80 Hz kernel averages per pixel, but it shows no relation to the gain. Correcting for the kernel's effective sample count (exp(-|Δline|/134) within ±402 lines) makes the spread larger.
  • Not explained by registration smoothing: neighbour correlations of the noise are similar in every session (0.22–0.27 between rows, 0.36–0.40 between columns, 0.50–0.69 between consecutive frames).
  • Intercepts: about 0 in two sessions, and −2 to −3 counts² in the other two, equivalent to an offset of about +0.2 counts.

Why it matters

  • Extraction: it divides the data by a fixed photonScale. If the per-photon amplitude differs by 1.8× between sessions or paths, the noise model and the sparsity penalties are miscalibrated by that much from one recording to the next.
  • Localization: the per-trial Vk adapts to the gain. But it is the 10th percentile of a ratio over the brightest 10% of pixels, from the first 500 frames of each trial. It is recomputed for every trial even though the gain is constant within a session and path, so it adds trial-to-trial noise and bias to the Z-scores.

Caveats

  • These numbers come from the 80 Hz aligned movie, not the raw samples or the 200 Hz data that extractTrial fits.
  • The alignment kernel and registration interpolation scale the absolute values. That can't make the gain constant across trials yet session- and path-dependent unless those steps depend on session or path settings, and this should be checked.

Suggested next steps

  1. On raw data, check whether the single-photon amplitude differs between these sessions and paths. Compare against acquisition metadata (detector gain, digitizer settings, any averaging in the reader).
  2. If a preprocessing step causes it, fix the scaling so photon units are the same everywhere.
  3. If the instrument causes it (per path, or after recalibrations), estimate the photon scale once per session and path, pooled over trials, or read it from metadata. Use it in both extraction (photonScale) and localization (Vk), instead of the fixed 25 and the per-trial Vk.

Found while building training data for a blind-spot baseline network (AllenNeuralDynamics/slap2-F0-network; slap2_f0/stats.py computes these statistics from exported trials).

主要语言
MATLAB
星标
3
派生
3
平均合并
1 天 22 小时
30 天内合并 PR
31

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AllenNeuralDynamics/GIAnT-MATLAB 的其他 Issue

查看 AllenNeuralDynamics/GIAnT-MATLAB 的全部 Issue

相似的 Issue

更多 MATLAB Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。