Skip to content

Conversation

@mfep
Copy link
Collaborator

@mfep mfep commented Jan 5, 2026

Added padding_method parameter to paganin_filter. Options:

  • next_power_of_2 (default, original method): Pads data to the size that is the next power of 2
  • next_fast_length: Pads data to the next size that is fast for FFT. This can be zero padding. Uses less memory than next_power_of_2
  • Integer: specifies padding extent in pixels.

Updated tests and zenodo tests.

Fixes: Paganin filter padding options

@mfep mfep self-assigned this Jan 5, 2026
@mfep mfep requested a review from dkazanc January 5, 2026 13:29
distance: float = 1.0,
energy: float = 53.0,
ratio_delta_beta: float = 250,
padding_method: Union[
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think padding_method parameter can be slightly confusing to users. I would think that the padding method is something how you deal with the boundary, e.g. edge/symmetric/reflect etc. I believe we do not expose such option for now and by default it is always edge . Here it is how the padding value is calculated. So may be this parameter should be called calculate_padding_value_method instead? But then, we also allow to provide an integer to it, which makes it slightly ambiguous.
Also the padding integer should be a list, separated for X and Y dimensions. So may be we should remove this option for now and provide only "next_power_of_2", "next_fast_length" ? Hope it makes sense?


cp = cupywrapper.cp
cupy_run = cupywrapper.cupy_run
next_fast_len = cupywrapper.next_fast_len
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd rather make an import from scipy here, cupywrapper is mostly to deal with the CuPy related imports

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