Per-frame F0 baseline rises artificially at the end of each analysis trial

オープン
#17 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 5 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
28/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
領域
data

調査の方向性

Start in extractTrial and trace how splitFreq, fitB, and the sources/temporal/F0 baseline are produced. Plot B and the splitFreq low-pass for single pixels near trial ends, as suggested, to identify where the rise begins. Done means the baseline no longer rises artificially at trial ends and F0 behaves consistently across trial edges; the issue gives no test or validation entry point.

索引モデルが issue の本文から書いたものです。

説明

bug

Summary

Source extraction's per-frame baseline (B in extractTrial, reported per source as sources/temporal/F0) rises over the last few seconds of every analysis trial. Over the same frames the raw fluorescence falls, so the rise comes from the baseline fit rather than the data. It also contributes to steps in F0 at trial edges.

Evidence

Dataset: 780125 Neuron1, 2025-03-14 (Z:\ophys\Maedeh\V1_visual_stimuli\780125\slap2_780125_2025-03-14_09-30-06\Neuron1), analysis trials 2–6 (five 28 s trials, about 0.55 s apart), SLAP2, 200 Hz analysis rate.

Method: each source's per-frame F0 was divided by its own median and averaged across sources, with discarded frames excluded. Each trial was then normalized to its own mean and the trials were averaged. global/F (raw whole-field fluorescence) is the reference.

Path2 (dendrites, 68 sources) Path1 (soma plane, 107 sources)
Last 2 s vs. trial middle, F0 +1.2% +2.2%
Last 2 s vs. trial middle, global F −1.0% −3.4%
First 2 s vs. trial middle, F0 +6.8% +4.8%
First 2 s vs. trial middle, global F +3.1% +6.4%
F0 step across the 4 trial edges +4.2, +2.3, +1.9, +1.5% −0.6, −3.5, +0.1, −0.5%
Global F step across the same edges +2.5, +0.3, −0.1, +0.8% −1.9, +1.3, +0.3, +2.0%
  • Trial ends: F0 and raw fluorescence move in opposite directions, so this looks like an artifact.
  • Trial starts: raw fluorescence really is higher (recovery during the gap between trials), but on Path2 F0's start excess is about twice global F's, so F0 likely overshoots there too.
  • Not footprint scale: sources/temporal/F0 = H'B/sum(H.^2) depends on footprint shape, but the median sum(H.^2) is constant across trials, and the footprint-weighted mean of B shows the same pattern.

Likely causes (not yet confirmed)

  • splitFreq interpolates the lower envelope of page means with interp1(..., 'linear', 'extrap'), so the baseline is extrapolated past the last full page. lowess and movmean smoothing are also less constrained at the ends.
  • fitB includes sinePredictors and the surround high-pass terms, which are unconstrained at the trial boundaries.

Suggested next steps

  • Plot B and the splitFreq low-pass for single pixels near trial ends, to see which step introduces the rise.
  • Consider fitting the baseline over padded data (reflect at the edges) or fitting adjacent trials jointly, so the baseline can't diverge at trial edges.

Workaround in progress

The per-trial F0 images being added to per_trial_summary.h5 (per_trial_F0_im) will leave out the first and last few seconds of each trial when averaging. The per-frame F0 traces (sources/temporal/F0) are still affected.

主要言語
MATLAB
スター
3
フォーク
3
平均マージ
4日 6時間
マージ済み PR(30日)
6

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

AllenNeuralDynamics/GIAnT-MATLAB のほかの issue

AllenNeuralDynamics/GIAnT-MATLAB の issue をすべて見る

似ている issue

MATLAB の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。