cupido/scripts/config.py
Giorgio Gilestro 28b7a227c0 load_roi_data: filter on barrier_opening.csv and stamp opening_s
For every session (training and testing alike), the loader now looks
up the corresponding row in barrier_opening.csv and:
  - drops the read if the ROI is in bad_rois (barrier never opened
    for that fly so its tracking has no biological meaning)
  - drops the read if the session is flagged unusable
  - stamps the session's opening_s onto every sample so downstream
    code can compute t_from_opening = t - opening_s

Tested against ETHOSCOPE_082 2024-09-17: training (bad_rois=1,3,5)
correctly drops ROIs 1/3/5; testing keeps all six; opening_s differs
between sessions as expected (646.8 vs 154.7).

Opt out with apply_barrier_filter=False if you need raw data.
2026-05-12 09:45:59 +01:00

42 lines
1.9 KiB
Python

"""Shared path constants for the Cupido tracking project."""
import os
from pathlib import Path
# Where this code repository lives (the directory containing scripts/, notebooks/, ...).
PROJECT_ROOT = Path(__file__).resolve().parent.parent
DATA_METADATA = PROJECT_ROOT / "data" / "metadata"
DATA_PROCESSED = PROJECT_ROOT / "data" / "processed"
FIGURES = PROJECT_ROOT / "figures"
LOGS_DIR = PROJECT_ROOT / "data" / "logs"
# Where the source videos live (read-only NFS mount).
VIDEOS_ROOT = Path("/mnt/ethoscope_data/videos")
# Where the project's bulky data lives — outside the cloud-synced repo so
# it doesn't churn the sync. This single root holds everything that's big
# or regenerable: tracking DBs, target-point JSONs, and the metadata
# spreadsheet (xlsx + TSV).
DATA_VOLUME = Path("/mnt/data/projects/cupido")
TARGETS_DIR = DATA_VOLUME / "targets"
TRACKING_OUTPUT_DIR = DATA_VOLUME / "tracked"
VIDEO_INFO_XLSX = DATA_VOLUME / "all_video_info_merged.xlsx"
VIDEO_INFO_TSV = DATA_VOLUME / "all_video_info_merged.tsv"
# A small CSV listing every video file we know about (built locally).
INVENTORY_CSV = DATA_METADATA / "video_inventory.csv"
# Hand-annotated barrier-opening times (output of the picker app). One
# row per testing session; columns: machine_name, session_date,
# session_time, opening_s, trim_first_s, bad_rois, analyst, notes.
BARRIER_OPENING_CSV = DATA_METADATA / "barrier_opening.csv"
# Where the ethoscope source tree is checked out (used by track_videos.py
# and auto_detect_targets.py — host-side scripts that import ethoscope
# from a local clone rather than from pip). Default assumes the standard
# layout `~/Code/ethoscope_project/ethoscope/src/ethoscope`; override with
# the ETHOSCOPE_SRC environment variable if your clone lives elsewhere.
ETHOSCOPE_SRC = Path(os.environ.get(
"ETHOSCOPE_SRC",
str(Path.home() / "Code" / "ethoscope_project" / "ethoscope" / "src" / "ethoscope"),
))