Skip to content

Fix report generation for sessions with no responses and legacy singletarget sessions - #24

Merged
celefthe merged 7 commits into
mainfrom
develop
Sep 14, 2026
Merged

celefthe merged 7 commits into
mainfrom
develop

Conversation

@celefthe

Copy link
Copy Markdown
Member

Running visiomode-analysis session on a 2021 singletarget session in which every trial was a miss failed with IndexError: index -1 is out of bounds for axis 0 with size 0. Three problems were stacked: the reaction-time plots called np.percentile on an empty array; singletarget (the pre-rename spelling of targetonly) fell through to the Go/NoGo and 2AFC code paths, so the report tried to plot hit/false-alarm RTs; and the legacy hit/false_alarm/miss outcome labels were only remapped after flattening, so the per-trial SDT inference never matched them and every trial came out unclassified. This branch also merges main back in so the PR does not revert the v0.2.0 release.

Changes

  • plots.plot_rt_median / plot_rt_medians_from_dict return NaN markers for empty RT arrays and leave the y-axis to auto-range when the stimulus duration is unknown (legacy sessions without a spec report it as -1 ms, which produced a [0, -0.001] range).
  • session.TARGETONLY_PROTOCOLS / session.is_targetonly() centralise the targetonly and singletarget alias; used in _flatten_trials, generate_report, and the report template (via a new is_targetonly template variable). Output filenames keep the original protocol token.
  • Legacy outcome labels are normalised per trial inside _flatten_trials (_normalise_legacy_outcome) before stimulus reconstruction and SDT inference; the post-flatten DataFrame remap is kept as a no-op safety net.
  • Tests: new write_legacy_singletarget_json conftest factory; regression tests for the empty-RT plots, unknown stimulus duration, the singletarget alias, legacy label normalisation, summary(), generate_report(), and the CLI. 105 tests pass, mypy is clean.
  • CHANGELOG: three entries under ## [Unreleased] / ### Fixed.

@celefthe
celefthe merged commit 82ac30d into main Sep 14, 2026
6 checks passed
@celefthe
celefthe deleted the develop branch September 14, 2026 23:41
@celefthe celefthe mentioned this pull request Sep 14, 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.

1 participant