Skip to content

parse_stimuli: treat a single ingested parameter dict as one stimulus - #368

Merged
stevevanhooser merged 2 commits into
mainfrom
claude/hopeful-fermi-m3qetb
Nov 13, 2026
Merged

stevevanhooser merged 2 commits into
mainfrom
claude/hopeful-fermi-m3qetb

Conversation

@stevevanhooser

@stevevanhooser stevevanhooser commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Python port of VH-Lab/NDI-matlab#1239.

Problem

In MATLAB, parse_stimuli failed on ingested stimulus data because readmetadata_ingested could return a struct array instead of a cell array of structs. MATLAB#1239 normalizes this in readmetadata_ingested and adds a guard in parse_stimuli.

Python

ndi_daq_metadatareader.readmetadata_ingested already wraps a single dict in a list, so the reader side needs no change. parse_stimuli did not guard the same case: if data["parameters"] arrived as a dict, the list comprehension would walk its keys and record each key name as a "stimulus" — silently, with no error. This adds the matching guard in ndi_app_stimulus_decoder._presentation_document.

Changes

  • src/ndi/app/stimulus/decoder.py: wrap a dict parameters in a list before building stimuli.
  • tests/test_app_stimulus_decoder.py: test_a_single_parameter_struct_is_one_stimulus_not_its_keys.
  • Bridge files: decoder and metadatareader bumped to NDI-matlab 9ded19a (the MATLAB fix commit). metadatareader carries a decision_log noting no Python change was needed.

Merge order

Merge VH-Lab/NDI-matlab#1239 first. The bridge hashes point at 9ded19a, which is on the paired NDI-matlab branch; until it reaches NDI-matlab main, the bridge drift check on NDI-python main would not find it.

Testing

black --check and ruff check pass on the changed files; the bridge tests (test_matlab_bridge_hashes.py, _status.py, _completeness.py) pass locally against the paired NDI-matlab branch. Full suite passes in CI.

🤖 Generated with Claude Code

https://claude.ai/code/session_011v7R5tmYTvR18nFhD2nvuA

Mirrors VH-Lab/NDI-matlab#1239: ingested metadata can decode to a single
struct rather than a list. Iterating a dict would walk its keys and record
each key as a stimulus; wrap it in a list instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011v7R5tmYTvR18nFhD2nvuA
Clears the drift check against the paired NDI-matlab branch
(VH-Lab/NDI-matlab#1239). decoder is ported in this PR; metadatareader needs
no Python change, recorded in its decision_log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011v7R5tmYTvR18nFhD2nvuA
@stevevanhooser
stevevanhooser merged commit e2a7f50 into main Nov 13, 2026
28 of 29 checks passed
@stevevanhooser
stevevanhooser deleted the claude/hopeful-fermi-m3qetb branch November 13, 2026 17:31
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.

2 participants