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

Warn even kernel size instead of halting #11

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

Conversation

jomy-kk
Copy link

@jomy-kk jomy-kk commented May 13, 2023

Wouldn't it be more friendly if BioSPPy solved for the user the issue of passing an even kernel size when median filtering? Because raising an error halts the program, which isn't necessary since it's not problematic. Here's a proposal to solve the issue and alert the user.

Wouldn't it be more friendly if BioSPPy solved for the user the issue of passing an even kernel size when median filtering? Because raising an error halts the program, which isn't necessary since it's not problematic. Here's a proposal to solve the issue and alert the user.
@rafaelscsilva rafaelscsilva self-requested a review June 1, 2023 09:45
Copy link
Member

@rafaelscsilva rafaelscsilva left a comment

Choose a reason for hiding this comment

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

Thank you @jomy-kk for noticing this usability issue and proposing a solution, which is greatly appreciated. Instead of raising a Warning, I would suggest using the warnings Python module to achieve this since it prevents halting the program. To ensure good formatting in BioSPPy here's my suggestion:

  1. Add the warnings module to the list of imports (preferably right after the compatibility imports)
# built-in
import warnings
  1. Change the Warning exception to a UserWarning
warnings.warn("When the kernel is 'median', size must be odd, so the size was decremented by one.")

Let me know if this suggestion achieves the intended purpose of your PR. If so, I kindly ask you to update your PR with these changes.

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.

2 participants