Skip to content

Fix time support for perievent#593

Merged
gviejo merged 1 commit intodevfrom
592-perievent-timesupport
Apr 20, 2026
Merged

Fix time support for perievent#593
gviejo merged 1 commit intodevfrom
592-perievent-timesupport

Conversation

@wulfdewolf
Copy link
Copy Markdown
Collaborator

This short PR fixes the time support issue we had for compute_perievent when there are no spikes at all around the passed events.

We were passing the time support to the individual Ts objects, which were ultimately ignored when stored in the TsGroup:

for event_idx, event_time in enumerate(event_times):
        start_time = event_time - window[0]
        end_time = event_time + window[1]

        mask = (data.t >= start_time) & (data.t <= end_time)
        shifted_times = data.t[mask] - event_time

        aligned[event_idx] = nap.Ts(shifted_times, time_support=new_time_support)

    return nap.TsGroup(
        aligned, metadata={"events": event_times}, time_support=new_time_support
    )

That is now fixed by passing the new_time_support to the TsGroup.

Testing

I added two tests to capture this specifically

Related issues

#592

@wulfdewolf wulfdewolf requested a review from gviejo as a code owner April 20, 2026 16:12
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
pynapple/process/perievent.py 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gviejo gviejo merged commit acb16d9 into dev Apr 20, 2026
27 of 46 checks passed
@gviejo gviejo deleted the 592-perievent-timesupport branch April 20, 2026 21:30
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