Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Term Entry] Python Scipy Function: find_peaks() #5895

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

naajiha
Copy link

@naajiha naajiha commented Dec 26, 2024

Description

-Added the find_peaks() term for python from the scipy package
-Closes issue #5853

Issue Solved

Type of Change

  • Adding a new entry

Checklist

  • All writings are my own.
  • My entry follows the Codecademy Docs style guide.
  • My changes generate no new warnings.
  • I have performed a self-review of my own writing and code.
  • I have checked my entry and corrected any misspellings.
  • I have made corresponding changes to the documentation if needed.
  • I have confirmed my changes are not being pushed from my forked main branch.
  • I have confirmed that I'm pushing from a new branch named after the changes I'm making.
  • I have linked any issues that are relevant to this PR in the Issues Solved section.

@CLAassistant
Copy link

CLAassistant commented Dec 26, 2024

CLA assistant check
All committers have signed the CLA.

@mamtawardhani mamtawardhani self-assigned this Dec 26, 2024
@mamtawardhani mamtawardhani added new entry New entry or entries status: under review Issue or PR is currently being reviewed scipy Python scipy enteries labels Dec 26, 2024
@mamtawardhani
Copy link
Collaborator

CLA assistant check Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.You have signed the CLA already but the status is still pending? Let us recheck it.

Hey @naajiha please sign the CLA

@naajiha
Copy link
Author

naajiha commented Dec 26, 2024

signed

Copy link
Collaborator

@mamtawardhani mamtawardhani left a comment

Choose a reason for hiding this comment

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

Hey @naajiha , thank you for contributing to Codecademy Docs, the entry is nicely written! 😄

I've suggested a few changes, could you please review and modify those at your earliest convenience? Thank you! 😃

@@ -0,0 +1,45 @@
---
Title: 'find_peaks()'
Description: 'Finds the peaks in a signal.'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Description: 'Finds the peaks in a signal.'
Description: 'Finds the indices of local maxima (peaks) in a 1D signal array based on specified conditions.'

- 'learn-python-3'
---

The **`find_peaks()`** function is used to find peaks in a signal. It returns the indices of local maxima in a signal.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The **`find_peaks()`** function is used to find peaks in a signal. It returns the indices of local maxima in a signal.
In SciPy, the **`find_peaks()`** function identifies the indices of local maxima (peaks) in a 1D signal array based on specified conditions.

## Syntax

```pseudo
find_peaks(signal);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please correct the syntax. Here is the reference documentation: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.find_peaks.html

Comment on lines +23 to +25
The `signal` parameter is an array of numbers.

The default height of the peaks is defined by the height parameter. If the parameter is unspecified, the height is set to 0. The width parameter is used to filter out peaks that have a width less than the specified width. The rel_height parameter is used to filter out peaks that have a relative height less than the specified relative height. The threshold parameter is used to filter out peaks that have a value less than the specified threshold. The distance parameter is used to filter out peaks that have a distance between peaks less than the specified distance. The prominence parameter is used to filter out peaks that have a prominence less than the specified prominence. The wlen parameter is used to filter out peaks that have a width less than the specified width. The plateau_size parameter is used to filter out peaks that have a plateau size less than the specified plateau size.
Copy link
Collaborator

Choose a reason for hiding this comment

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

All the parameters should be in bullet points, an example could be:

  • x: The input 1D array or signal in which peaks are to be identified.
  • height: Specifies the required height of peaks. A tuple can set minimum and maximum peak heights.
  • threshold: Specifies the required threshold for the vertical distance between a peak and its neighbors.
  • .
  • .
  • .

print(peaks)
```

The above code creates a signal with some peaks, finds the peaks in the signal, and prints the indices of the peaks.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Showcase the output of this code using a shell block

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.

3 participants