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

Reimplimentation of strict thresholding #316

Merged

Conversation

w-k-jones
Copy link
Member

Fix for the bugs identified in strict thresholding in #314 and #315 . Strict thresholding is now handled in remove_parents, by removing features which do not have parents, rather than by modifying the input data.

  • Strict thresholding now works for target="minimum"
  • Strict thresholding produces identical results to non-stric thresholding if n_min_threshold is a fixed value
  • New tests added for strict thresholding
  • Have you followed our guidelines in CONTRIBUTING.md?
  • Have you self-reviewed your code and corrected any misspellings?
  • Have you written documentation that is easy to understand?
  • Have you written descriptive commit messages?
  • Have you added NumPy docstrings for newly added functions?
  • Have you formatted your code using black?
  • If you have introduced a new functionality, have you added adequate unit tests?
  • Have all tests passed in your local clone?
  • If you have introduced a new functionality, have you added an example notebook?
  • Have you kept your pull request small and limited so that it is easy to review?
  • Have the newest changes from this branch been merged?

@w-k-jones w-k-jones self-assigned this Jul 28, 2023
@w-k-jones w-k-jones added the bug Code that is failing or producing the wrong result label Jul 28, 2023
@w-k-jones w-k-jones requested review from lettlini, JuliaKukulies and freemansw1 and removed request for lettlini July 28, 2023 21:10
@codecov
Copy link

codecov bot commented Jul 28, 2023

Codecov Report

Patch coverage: 60.00% and project coverage change: -0.21% ⚠️

Comparison is base (d819159) 56.04% compared to head (c21905e) 55.84%.

Additional details and impacted files
@@                Coverage Diff                 @@
##           RC_v1.5_hotfix     #316      +/-   ##
==================================================
- Coverage           56.04%   55.84%   -0.21%     
==================================================
  Files                  15       15              
  Lines                3290     3302      +12     
==================================================
  Hits                 1844     1844              
- Misses               1446     1458      +12     
Flag Coverage Δ
unittests 55.84% <60.00%> (-0.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
tobac/feature_detection.py 83.94% <60.00%> (-2.53%) ⬇️

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

Copy link
Member

@JuliaKukulies JuliaKukulies left a comment

Choose a reason for hiding this comment

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

This looks all good to me and I am happy with letting remove_parents take care of the strict thresholding. Great solution @w-k-jones !

@w-k-jones
Copy link
Member Author

Thanks! In future we should possibly either rename remove_parents or split it into multiple methods that handle operations involving features and their parents to reflect its wider responsibility, but this can wait until a later refactor

Copy link
Collaborator

@harrietgilmour harrietgilmour left a comment

Choose a reason for hiding this comment

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

This all looks good! I also tested new implementation with own data and it appears to be working as expected. There are no longer tracks detected at a lower minimum value than the dataset.min() when using threshold='minimum' and strict_thresholding=True. It also produces the same number of tracks when using a single nminthreshold with strict_thresholding=True and strict_thresholding=False. Thanks for sorting this out :)

@w-k-jones
Copy link
Member Author

This all looks good! I also tested new implementation with own data and it appears to be working as expected. There are no longer tracks detected at a lower minimum value than the dataset.min() when using threshold='minimum' and strict_thresholding=True. It also produces the same number of tracks when using a single nminthreshold with strict_thresholding=True and strict_thresholding=False. Thanks for sorting this out :)

Thanks for the review! I'll merge now

@w-k-jones w-k-jones merged commit 2175cd2 into tobac-project:RC_v1.5_hotfix Aug 15, 2023
7 checks passed
@w-k-jones w-k-jones mentioned this pull request Aug 15, 2023
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Code that is failing or producing the wrong result
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants