Skip to content

Wrapping Hilbert transform#582

Merged
gviejo merged 13 commits intodevfrom
568-wrapping-hilbert-transform
Apr 9, 2026
Merged

Wrapping Hilbert transform#582
gviejo merged 13 commits intodevfrom
568-wrapping-hilbert-transform

Conversation

@wulfdewolf
Copy link
Copy Markdown
Collaborator

@wulfdewolf wulfdewolf commented Apr 5, 2026

This PR introduces a new signal module, which contains functions for extracting envelopes and phases (using Hilbert transform).
Most of the functions are wrappers around scipy.signal.hilbert:

  • apply_hilbert_transform
  • compute_hilbert_envelope
  • compute_hilbert_phase

Also moved detect_oscillatory_events to this module, since it is a better fit than filtering.

In the future we will add a function to this module that uses something like find_peaks and then interpolation to extract phases, see #584.

Documentation

The new functions have detailed docstring examples.
A new user-guide was added for this module specifically, it focuses on extracting phases/envelopes.
Places that used the Hilbert transform that now use this module:

  • the filtering tutorial where spike phases are extracted
  • the ripple detection module that is in the making

Testing

Tests have been added for:

  • input/output checks
  • output versus scipy.

Related issues

Addresess #568.

@wulfdewolf wulfdewolf requested a review from gviejo as a code owner April 5, 2026 12:00
@wulfdewolf wulfdewolf linked an issue Apr 5, 2026 that may be closed by this pull request
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 5, 2026

Codecov Report

❌ Patch coverage is 90.00000% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pynapple/process/signal.py 89.47% 4 Missing and 2 partials ⚠️
Files with missing lines Coverage Δ
pynapple/core/time_series.py 93.22% <100.00%> (ø)
pynapple/process/__init__.py 100.00% <100.00%> (ø)
pynapple/process/filtering.py 94.54% <ø> (+2.70%) ⬆️
pynapple/process/signal.py 89.47% <89.47%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gviejo gviejo changed the base branch from main to dev April 6, 2026 15:12
Comment thread doc/user_guide/13_phases_and_envelopes.md Outdated
Comment thread doc/user_guide/13_phases_and_envelopes.md
Comment thread doc/user_guide/13_phases_and_envelopes.md
Comment thread pynapple/process/signal.py Outdated
Comment thread doc/user_guide/13_phases_and_envelopes.md Outdated
Comment thread pynapple/process/signal.py Outdated
Comment thread pynapple/process/signal.py Outdated
@gviejo gviejo merged commit 0b73978 into dev Apr 9, 2026
16 checks passed
@gviejo gviejo deleted the 568-wrapping-hilbert-transform branch April 9, 2026 15:17
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.

Wrapping Hilbert transform

2 participants