Repository navigation
parse_stimuli: treat a single ingested parameter dict as one stimulus - #368
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Python port of VH-Lab/NDI-matlab#1239.
Problem
In MATLAB,
parse_stimulifailed on ingested stimulus data becausereadmetadata_ingestedcould return a struct array instead of a cell array of structs. MATLAB#1239 normalizes this inreadmetadata_ingestedand adds a guard inparse_stimuli.Python
ndi_daq_metadatareader.readmetadata_ingestedalready wraps a single dict in a list, so the reader side needs no change.parse_stimulidid not guard the same case: ifdata["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 inndi_app_stimulus_decoder._presentation_document.Changes
src/ndi/app/stimulus/decoder.py: wrap a dictparametersin a list before buildingstimuli.tests/test_app_stimulus_decoder.py:test_a_single_parameter_struct_is_one_stimulus_not_its_keys.decoderandmetadatareaderbumped to NDI-matlab9ded19a(the MATLAB fix commit).metadatareadercarries 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 --checkandruff checkpass 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