Skip to content

Rework Event-context generation: one entry group per process, no temporal tags left (#1509) - #1550

Merged
VisLab merged 5 commits into
hed-standard:mainfrom
VisLab:address_issues
Dec 6, 2026
Merged

VisLab merged 5 commits into
hed-standard:mainfrom
VisLab:address_issues

Conversation

@VisLab

@VisLab VisLab commented Dec 6, 2026

Copy link
Copy Markdown
Member

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.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread hed/tools/analysis/event_manager.py Resolved
VisLab and others added 3 commits December 6, 2026 11:13
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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>
@VisLab VisLab changed the title Generate Event-context per specification 3.2.8.5 Rework Event-context generation: one entry group per process, no temporal tags left (#1509) Dec 6, 2026
@VisLab
VisLab merged commit ec34c23 into hed-standard:main Dec 6, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Event-context generation gives wrong results in five cases

2 participants