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

Add Algorithm for Fresnel Diffraction #11580

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

jakerogers-1
Copy link

Fresnel diffraction of wave fields is commonly simulated within optical physics yet no algorithm exists within the repository presently to facilitate this. The included code utilizes the transfer function based approach found in the textbook Computational Fourier Optics by David Voelz and his related research publications to perform Fresnel diffraction for a given (coherent and monochromatic) wave field.

The original MATLAB has been translated into Python with a more user-friendly interface added and error handling.

jakerogers-1 and others added 2 commits September 24, 2024 16:46
Code for wave diffraction in the Fresnel regime was missing from the algorithms list and has been added.
@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Sep 24, 2024
@algorithms-keeper algorithms-keeper bot added require tests Tests [doctest/unittest/pytest] are required require type hints https://docs.python.org/3/library/typing.html labels Sep 24, 2024
Copy link

@algorithms-keeper algorithms-keeper bot left a comment

Choose a reason for hiding this comment

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

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.




def fresnel_diffract(wavefunc0, pixel_size, wavelength, prop_dist):

Choose a reason for hiding this comment

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

Please provide return type hint for the function: fresnel_diffract. If the function does not return a value, please provide the type hint as: def function() -> None:

As there is no test file in this pull request nor any test function or class in the file physics/fresnel_diffract.py, please provide doctest for the function fresnel_diffract

Please provide type hint for the parameter: wavefunc0

Please provide type hint for the parameter: pixel_size

Please provide type hint for the parameter: wavelength

Please provide type hint for the parameter: prop_dist

raise ValueError(
f'Expected a 1D or 2D wavefield, but got {err_shape}')

def _fresnel_diffract_2d(wavefunc0, pixel_size, wavelength, prop_dist):

Choose a reason for hiding this comment

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

Please provide return type hint for the function: _fresnel_diffract_2d. If the function does not return a value, please provide the type hint as: def function() -> None:

As there is no test file in this pull request nor any test function or class in the file physics/fresnel_diffract.py, please provide doctest for the function _fresnel_diffract_2d

Please provide type hint for the parameter: wavefunc0

Please provide type hint for the parameter: pixel_size

Please provide type hint for the parameter: wavelength

Please provide type hint for the parameter: prop_dist


return wavefuncz

def _fresnel_diffract_1d(wavefunc_0, pixel_size, wavelength, prop_dist):

Choose a reason for hiding this comment

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

Please provide return type hint for the function: _fresnel_diffract_1d. If the function does not return a value, please provide the type hint as: def function() -> None:

As there is no test file in this pull request nor any test function or class in the file physics/fresnel_diffract.py, please provide doctest for the function _fresnel_diffract_1d

Please provide type hint for the parameter: wavefunc_0

Please provide type hint for the parameter: pixel_size

Please provide type hint for the parameter: wavelength

Please provide type hint for the parameter: prop_dist

@algorithms-keeper algorithms-keeper bot added the awaiting reviews This PR is ready to be reviewed label Sep 24, 2024
@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Sep 24, 2024
Copy link
Contributor

@imSanko imSanko left a comment

Choose a reason for hiding this comment

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

Add more tests !

jakerogers-1 and others added 2 commits September 26, 2024 14:39
Tests covering dimensionality, error checking, conservation of energy, and zero propagation distance, have all been included.
@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Sep 26, 2024
@algorithms-keeper algorithms-keeper bot removed require tests Tests [doctest/unittest/pytest] are required require type hints https://docs.python.org/3/library/typing.html labels Sep 26, 2024
@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Sep 26, 2024
Copy link
Contributor

@imSanko imSanko left a comment

Choose a reason for hiding this comment

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

seems fair enough!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reviews This PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants