Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
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.
This PR adds a
find_peaksmethod toTsdandTsdFrame.The method mostly wraps
scipy.signal.find_peaks, but ensures correct epochs and Pynapple formatting.Usage
For
Tsd:You can set various requirements for finding peaks, for example a minimum width (these are just passed to
scipy.signal.find_peaks):If you further want the peak properties returned, you can pass
return_prop=True:For
TsdFrame:It works similarly, but we return a
TsGroupcontaining the same outputs per column:You can again set various requirements for finding peaks, for example a minimum width:
If you want the peak properties returned, you can again pass
return_prop=True:Documentation
Both methods have docstrings, including examples.
In a future PR we will use these methods in the tutorials, but for the moment I don't think they need a user guide.
Testing
Adds thorough testing for the
find_peaksmethods for both classes, checking input/output types, correct peak extraction, metadata, etc.Related issues
#550 #584
Questions for reviewers
In the case of a
TsdFramewe return aTsGroupcontaining entries per column.However,
TsGrouprequires integer keys, whereasTsdFramecolumns can be strings.The current implementation sets the
TsGroupkeys to be indices starting from 0.That might not be very intuitive for the user if they do have string columns.
A simplification would be to return a
dictinstead of aTsGroup, but then we won't be tracking thetime_support.