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

Small fix to find_global_peaks_rough #28

Merged
merged 4 commits into from
Dec 15, 2023
Merged

Conversation

alckasoc
Copy link
Contributor

@alckasoc alckasoc commented Dec 5, 2023

Summary by CodeRabbit

  • Refactor
    • Improved the peak finding algorithm to enhance accuracy in identifying peak points in data tensors.
    • Adjusted the threshold handling to better filter out values below the specified limit, ensuring more reliable peak detection.

@alckasoc alckasoc requested review from talmo and gitttt-1234 December 5, 2023 06:57
Copy link
Contributor

coderabbitai bot commented Dec 5, 2023

Walkthrough

The recent changes focus on enhancing the peak detection process in the sleap_nn/inference/peak_finding.py file. The modifications involve a more intricate calculation for identifying peak values and indices along with refined handling of values under a certain threshold. These changes aim to improve the accuracy and robustness of peak detection while maintaining the function's original signature.

Changes

File Path Change Summary
.../inference/peak_finding.py Updated find_global_peaks_rough to refine peak detection logic, including handling of threshold values.

Poem

In the realm of tensors, peaks must be found,
With a rabbit's keen eye, no peak is left bound.
🐇 Through the code, it hops with grace,
Finding each max, in its proper place.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on X ?


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can reply to a review comment made by CodeRabbit.
  • You can tag CodeRabbit on specific lines of code or files in the PR by tagging @coderabbitai in a comment.
  • You can tag @coderabbitai in a PR comment and ask one-off questions about the PR and the codebase. Use quoted replies to pass the context for follow-up questions.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Copy link

codecov bot commented Dec 5, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c590ae5) 99.78% compared to head (72d88a9) 99.78%.
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #28   +/-   ##
=======================================
  Coverage   99.78%   99.78%           
=======================================
  Files          19       19           
  Lines         949      952    +3     
=======================================
+ Hits          947      950    +3     
  Misses          2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c590ae5 and de9ef46.
Files selected for processing (1)
  • sleap_nn/inference/peak_finding.py (1 hunks)
Additional comments: 1
sleap_nn/inference/peak_finding.py (1)
  • 118-119: The code correctly replaces peak values below the threshold with NaN and sets the corresponding max_values to 0. This change aligns with the PR objectives and summary, which mention adjusting the handling of values below a specified threshold.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between b774c5a and 1caef62.
Files selected for processing (1)
  • sleap_nn/inference/peak_finding.py (1 hunks)
Additional comments: 2
sleap_nn/inference/peak_finding.py (2)
  • 118-121: The change from replacing values below the threshold with NaN to 0 could have implications on downstream processing that relies on NaN to indicate invalid or absent data. Ensure that this change is communicated to all users of the function and that it does not negatively impact any dependent code.

  • 113-115: The summary does not mention the change in the order of concatenation for peak indices (max_indices_x and amax_indices_y). This change in the order of peak points could affect how the peaks are interpreted downstream. It is important to verify that this change is intentional and that it does not introduce any issues with the interpretation of peak data.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 3

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 1caef62 and 72d88a9.
Files selected for processing (1)
  • sleap_nn/inference/peak_finding.py (1 hunks)
Additional comments: 1
sleap_nn/inference/peak_finding.py (1)
  • 113-115: The peak_points tensor is constructed by concatenating max_indices_x and amax_indices_y, which are derived from separate maximum value calculations. This mixing of indices from different calculations is unusual and could be intentional for a specific reason, but it should be clarified to ensure it's not a mistake.

sleap_nn/inference/peak_finding.py Show resolved Hide resolved
sleap_nn/inference/peak_finding.py Show resolved Hide resolved
sleap_nn/inference/peak_finding.py Show resolved Hide resolved
@alckasoc alckasoc merged commit ff6801b into main Dec 15, 2023
5 checks passed
@alckasoc alckasoc deleted the vincent/find-global-peaks-fix branch December 15, 2023 09:19
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.

3 participants