Skip to content

Warn even kernel size instead of halting#11

Closed
jomy-kk wants to merge 1 commit intoscientisst:mainfrom
jomy-kk:patch-1
Closed

Warn even kernel size instead of halting#11
jomy-kk wants to merge 1 commit intoscientisst:mainfrom
jomy-kk:patch-1

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.

@sofia3ms
Copy link
Collaborator

Closed due to inactivity. Updates added in commit #66

@sofia3ms sofia3ms closed this Jun 27, 2025
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