-
-
Notifications
You must be signed in to change notification settings - Fork 45.7k
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
base: master
Are you sure you want to change the base?
Add Algorithm for Fresnel Diffraction #11580
Conversation
Code for wave diffraction in the Fresnel regime was missing from the algorithms list and has been added.
for more information, see https://pre-commit.ci
…m/jakerogers-1/Python into Add-Fresnel-Diffraction-Algorithm
There was a problem hiding this 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.
physics/fresnel_diffract.py
Outdated
|
||
|
||
|
||
def fresnel_diffract(wavefunc0, pixel_size, wavelength, prop_dist): |
There was a problem hiding this comment.
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
physics/fresnel_diffract.py
Outdated
raise ValueError( | ||
f'Expected a 1D or 2D wavefield, but got {err_shape}') | ||
|
||
def _fresnel_diffract_2d(wavefunc0, pixel_size, wavelength, prop_dist): |
There was a problem hiding this comment.
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
physics/fresnel_diffract.py
Outdated
|
||
return wavefuncz | ||
|
||
def _fresnel_diffract_1d(wavefunc_0, pixel_size, wavelength, prop_dist): |
There was a problem hiding this comment.
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
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add more tests !
Tests covering dimensionality, error checking, conservation of energy, and zero propagation distance, have all been included.
for more information, see https://pre-commit.ci
…m/jakerogers-1/Python into Add-Fresnel-Diffraction-Algorithm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems fair enough!
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.