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

Utility to denoise laser profile and adding a test for the same #315

Open
wants to merge 31 commits into
base: development
Choose a base branch
from

Conversation

Paaaaarth
Copy link
Contributor

@Paaaaarth Paaaaarth commented Oct 23, 2024

MERGE AFTER #326.

Denoising can be considered as one of the common thing that's done while creating a laser object and yet there is no trivial way to do so in LASY. With this pull request we aim to add this functionality i.e. mode decomposition based denoising. In its current state the code does two distinct things, mode decomposition and creating denoised profile.

Copy link
Contributor

@MaxThevenet MaxThevenet left a comment

Choose a reason for hiding this comment

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

Thanks for this PR! A few general points:

  1. Good idea to put this in a separate file denoise.py as you propose, if we consider having other denoising methods implemented later. Could you adapt the naming etc.? For instance, the function could be called: denoise_LG_modes or so.
  2. I would encourage you to check mode_decomposition.py, it can take either a full Laser profile or a Transverse profile, and explain what it does in each case. IMO the clearest would be for your function to take a generic profile that can be a TransverseProfile or a Laser but always return a TransverseProfile. In the future, we could always return the same type as input, I think that would be the best, but would take more work to handle the longitudinal data.
  3. Could you avoid ambiguous input arguments like parameters bundling different variables, unless necessary? Just pass the arguments you need, and no more (for instance you may get rid of polarization).
  4. Please document all input parameters, check other functions for example.
  5. Please add a CI test.

@Paaaaarth Paaaaarth changed the title [WIP] Utility to denoise laser profile [WIP] Utility to denoise laser profile and adding a test for the same Oct 28, 2024
@Paaaaarth Paaaaarth marked this pull request as draft October 29, 2024 12:54
lasy/utils/denoise.py Fixed Show fixed Hide fixed
tests/test_denoise.py Fixed Show fixed Hide fixed
@Paaaaarth Paaaaarth changed the title [WIP] Utility to denoise laser profile and adding a test for the same Utility to denoise laser profile and adding a test for the same Nov 19, 2024
lasy/utils/denoise.py Fixed Show fixed Hide fixed
@Paaaaarth Paaaaarth marked this pull request as ready for review November 21, 2024 13:24
@Paaaaarth
Copy link
Contributor Author

Paaaaarth commented Nov 22, 2024

With D4, We have added the additional capability of inputing an image file as transverse profile. Skimage package is used to extract the intensity data.

Comment on lines +78 to +80
modeCoeffs, waist = hermite_gauss_decomposition(
transverse_profile, wavelength, n_modes_x, n_modes_y, resolution, lo, hi
)

Check failure

Code scanning / CodeQL

Wrong number of arguments in a call Error

Call to
function hermite_gauss_decomposition
with too many arguments; should be no more than 5.
tests/test_denoise.py Fixed Show fixed Hide fixed
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