Skip to content

Handle excluded sessions in subject summaries - #28

Merged
celefthe merged 3 commits into
mainfrom
celefthe/issue27
Sep 23, 2026
Merged

celefthe merged 3 commits into
mainfrom
celefthe/issue27

Conversation

@celefthe

Copy link
Copy Markdown
Member

Closes #27. visiomode-analysis subject now recognises sessions whose trials file carries an exclude suffix after .csv (e.g. ..._trials.csv.ignore). By default these sessions are kept in the subject summary without metrics, so they still count towards task_session. --no-ignore drops them altogether.

Changes

  • The exclude suffixes are .ignore, .ignored, .exclude, .excluded and .skip, matched in any case (EXCLUDE_SUFFIXES, checked by is_excluded()). collate_sessions() now globs *trials.csv* and skips files with any other suffix (e.g. .bak).
  • By default, an excluded session becomes a row with only its metadata (animal_id, session_date, protocol, environment, experiment, read from the file's first row) and every metric set to NaN. The file is never passed to session.summary(), so a broken or partial session can't stop the run. These rows still count towards session_id and task_session.
  • A new excluded column in the summary CSV (right after the metadata columns) flags these rows. It is always present and is all False with --no-ignore.
  • collate_sessions() and preprocess_subject() take a new ignore: bool = True parameter. ignore=False (subject --no-ignore) drops excluded sessions before ranking, and raises FileNotFoundError if no sessions are left.
  • Tests cover: metadata-only rows, excluded files never being summarised, task_session counting, each suffix in mixed case, other suffixes being skipped, dropping with --no-ignore and the error when nothing is left, plus two command-line tests.
  • Added a changelog entry under ## [Unreleased].

@celefthe
celefthe merged commit 0131556 into main Sep 23, 2026
3 checks passed
@celefthe
celefthe deleted the celefthe/issue27 branch September 23, 2026 16:54
@celefthe celefthe mentioned this pull request Sep 23, 2026
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.

Handle ignored sessions in subject summaries

1 participant