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

added kwargs for psf.convolve #278

Merged
merged 4 commits into from
Oct 15, 2024
Merged

added kwargs for psf.convolve #278

merged 4 commits into from
Oct 15, 2024

Conversation

maxecharles
Copy link
Collaborator

Allows for "fft" convolution method which is faster for medium-to-large arrays (thanks @ataras2)

@LouisDesdoigts
Copy link
Owner

This looks good but a few small tweaks are needed.

  1. I would change from a straight **kwargs to method='auto'. This is just to make it a bit more robust, since the only other option is precision, which we dont want to touch.
  2. Docstring needs to be updated on the method
  3. Unit test. Just under this line add another convolve with the method input.

@maxecharles
Copy link
Collaborator Author

This good for the test?

assert isinstance(psf.convolve(np.ones((2, 2)), method="fft"), PSF)

@LouisDesdoigts
Copy link
Owner

Yep more than happy for that as the test

src/dLux/psfs.py Outdated
@@ -79,21 +79,26 @@ def downsample(self: PSF, n: int) -> PSF:
"""
return self.set("data", dlu.downsample(self.data, n, mean=False))

def convolve(self: PSF, other: Array) -> PSF:
def convolve(self: PSF, other: Array, method="auto") -> PSF:
Copy link
Owner

Choose a reason for hiding this comment

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

Last tweak - type hint for the method input: method: str="auto")

@LouisDesdoigts
Copy link
Owner

Last thing is the type hint for the method argument

@maxecharles
Copy link
Collaborator Author

I'm trying my best I promise

Copy link
Owner

@LouisDesdoigts LouisDesdoigts left a comment

Choose a reason for hiding this comment

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

Looks good

@LouisDesdoigts LouisDesdoigts merged commit 93af2a5 into main Oct 15, 2024
2 checks passed
@maxecharles maxecharles deleted the convolve branch October 15, 2024 03:50
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