Skip to content

Extend absoluteToRelativeEvents with robust event filtering, trial inference, and flexible trial-start reference modes#3

Open
Copilot wants to merge 4 commits intomainfrom
copilot/update-absolute-to-relative-events
Open

Extend absoluteToRelativeEvents with robust event filtering, trial inference, and flexible trial-start reference modes#3
Copilot wants to merge 4 commits intomainfrom
copilot/update-absolute-to-relative-events

Conversation

Copy link
Contributor

Copilot AI commented Mar 17, 2026

NeuralEmbedding.absoluteToRelativeEvents previously required a positional numeric trialStartTimes input and assumed all events had valid Ts and trial fields. This update makes the method resilient to incomplete event structs and adds two explicit name-value modes for trial alignment and trial assignment recovery.

  • API update: named trial-start reference

    • Replaced positional second arg with trialStartReference name-value input.
    • Supports two modalities:
      • numeric vector of per-trial start times
      • event name present in evts; uses the first matching event per trial as trial start.
  • Input sanitization: drop unusable events

    • Events without a valid scalar finite Ts are discarded before processing.
  • Optional trial reconstruction from bounds

    • Added inferTrialFromBounds (default false).
    • When enabled and both trialstart + trialend exist, events with missing/invalid trial are assigned by Ts inclusion within [trialstart, trialend] windows.
  • Docs/examples updated in-place

    • Updated inline usage examples and nearby references to the new name-value call style.
% mode 1: numeric trial starts
evts = NeuralEmbedding.absoluteToRelativeEvents(evts, ...
    'trialStartReference', trialStartTimes);

% mode 2: derive starts from an event label (first per trial)
evts = NeuralEmbedding.absoluteToRelativeEvents(evts, ...
    'trialStartReference', "trialstart");

% optional: infer missing trial ids from trialstart/trialend bounds
evts = NeuralEmbedding.absoluteToRelativeEvents(evts, ...
    'trialStartReference', "trialstart", ...
    'inferTrialFromBounds', true);

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI and others added 2 commits March 17, 2026 11:18
… inference

Co-authored-by: Nabarb <23075957+Nabarb@users.noreply.github.com>
Co-authored-by: Nabarb <23075957+Nabarb@users.noreply.github.com>
Copilot AI changed the title [WIP] Update NeuralEmbedding.absoluteToRelativeEvents functionality Extend absoluteToRelativeEvents with robust event filtering, trial inference, and flexible trial-start reference modes Mar 17, 2026
Copilot AI requested a review from Nabarb March 17, 2026 11:20
@Nabarb Nabarb marked this pull request as ready for review March 17, 2026 13:03
…ly handle trial bounds

Replace inputParser with a name-value arguments interface for absoluteToRelativeEvents, add an input validator for trialStartReference, and expose inferTrialFromBounds as a named option. Improve robustness when pairing trial start/end timestamps by trimming unmatched leading ends or trailing starts and only keeping properly ordered start/end pairs. Minor tidy-ups to variable formatting.
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