Repository navigation
Rework Event-context generation: one entry group per process, no temporal tags left (#1509) - #1550
Merged
Merged
Conversation
Remove any existing Event-context group, then add one group with an entry per ongoing process. Each entry is a group without Onset, Duration or Delay, uses Def, and records its start time as (Label/Initiation-time, Time-value/x s). A process is not in the context of a row at its start or end time, nor of a row joined with an earlier row of the same onset. An unmatched Offset or an Onset without a Def anchor raises HedFileError instead of KeyError or IndexError. Fixes hed-standard#1509 cases 1-4.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The adjacent-row comparison differs from onset grouping, causing a separate event marker to be treated as joined and lose its ongoing context.
1 open issue
What changed in this PR
Updates HED event-context generation to follow specification 3.2.8.5, addressing cases 1-4 of #1509 while retaining delayed-start time points.
Changes:
- Replaces existing context groups with grouped process entries and initiation times.
- Excludes process boundaries and joined rows from context, and improves temporal error handling.
- Adds regression coverage and documents changes to context-based summaries.
| File | Description |
|---|---|
| tests/tools/analysis/test_hed_type.py | Expects structured unmatched-offset errors. |
| tests/tools/analysis/test_hed_type_factors.py | Updates error expectations and context counts. |
| tests/tools/analysis/test_event_manager.py | Updates boundary and same-onset assertions. |
| tests/tools/analysis/test_event_context.py | Adds event-context regression tests. |
| hed/tools/analysis/temporal_event.py | Groups process entries and adds initiation times. |
| hed/tools/analysis/hed_tag_manager.py | Replaces existing context and supports missing onsets. |
| hed/tools/analysis/event_manager.py | Filters context membership and improves temporal errors. |
| CHANGELOG.md | Documents behavior and summary-count changes. |
Review effort: Balanced
docs/tool_guide.md gives an overview of the hed.tools subpackages and holds the rules for generating Event-context groups, moved here from the HED specification, which no longer states how a tool generates the group. The page notes that the generator does not yet follow every rule (hed-standard#1509). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
EventManager decided that a row was joined into an earlier event marker by comparing its onset with the row before it, while the rows are joined by comparing with the first row of the marker. For onsets 1, 1.0000000008 and 1.0000000016 the third row is a separate event marker but was treated as joined and lost its Event-context. _joined_rows now uses df_util._indexed_dict_from_onsets, the grouping that joins rows. Update the hed-tests submodule to 86ccaf7. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Generating Event-context is a one-way conversion: the result holds no Onset, Offset, Inset, Duration or Delay tag. EventManager now removes the Inset tag from an Inset group, so (Def/PlayMovie, (Blue), Inset) gives (Def/PlayMovie, (Blue)), and places a group with Delay at its delayed time without the Delay tag, so (Delay/1 s, (Sound)) gives (Sound). Entries keep (Label/Initiation-time, Time-value/x s). The Tool guide and CHANGELOG describe the conversion; references to specification 3.2.8.5, which no longer states how the group is generated, are removed (hed-standard#1509). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The same-onset test assertions preserve row-merging behavior that conflicts with issue #1509’s requirement to retain each row’s tags, leaving the claimed fix incomplete.
1 open issue
1 resolved since last review
Review effort: Balanced
Rows with the same time form one event marker (specification 3.2.10.4): their annotations are joined in the first row and the later rows are empty. The guide now says so, with the example of case 4 of hed-standard#1509. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.

Remove any existing Event-context group, then add one group with an entry per ongoing process. Each entry is a group without Onset, Duration or Delay, uses Def, and records its start time as (Label/Initiation-time, Time-value/x s). A process is not in the context of a row at its start or end time, nor of a row joined with an earlier row of the same onset. An unmatched Offset or an Onset without a Def anchor raises HedFileError instead of KeyError or IndexError. Fixes #1509 cases 1-4.