Add per-row include flag to TSV; expand flies_analysis_simple narrative

- export_video_db_index.py now writes a boolean `include` column
  (default True). Flip it to False to drop a noisy/unusable row from
  analysis without deleting it.
- load_roi_data filters on `include` automatically (back-compat:
  missing column = load everything).
- flies_analysis_simple.ipynb section headers now explain *why* each
  step exists (barrier alignment, body-area baseline, merged-blob
  heuristic, Hungarian identity tracking) rather than just naming
  the step.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Giorgio Gilestro 2026-05-01 09:09:59 +01:00
parent 723d1f3682
commit 9f3ee24a23
4 changed files with 25 additions and 29 deletions

View file

@ -165,6 +165,12 @@ def main() -> None:
df["testing_video_path"] = test_videos
df["testing_db_path"] = test_dbs
# Reason: an analyst flag for excluding individual fly/session rows that
# turn out to be too noisy or otherwise unusable. Default True; flip to
# False directly in the TSV to drop a row from analysis without having
# to delete it. load_roi_data() respects this flag.
df["include"] = True
df.to_csv(args.out, sep="\t", index=False)
n_rows = len(df)

View file

@ -70,6 +70,12 @@ def load_roi_data(meta: pd.DataFrame | None = None) -> pd.DataFrame:
if meta is None:
meta = pd.read_csv(VIDEO_INFO_TSV, sep="\t")
# Honor the per-row `include` flag if the TSV has one. Rows with
# include=False are dropped (typically too-noisy videos the analyst
# has marked out). Missing column → load everything (back-compat).
if "include" in meta.columns:
meta = meta[meta["include"].astype(bool)]
db_cache: dict = {}
chunks: list[pd.DataFrame] = []