Skip to content

finding different diffraction parameters - #11608

Open
Skywalkr-dev wants to merge 12 commits into
TheAlgorithms:masterfrom
Skywalkr-dev:diffraction
Open

Skywalkr-dev wants to merge 12 commits into
TheAlgorithms:masterfrom
Skywalkr-dev:diffraction

Conversation

@Skywalkr-dev

@Skywalkr-dev Skywalkr-dev commented Oct 1, 2024

Copy link
Copy Markdown

Describe your change:

**diffraction.py is a module used to calculate various parameters of single slit and double slit diffraction patterns such as
>>> checking if a given wavelength ,diffraction angle and slit width corresponds to the minimum intensity observed in the diffraction pattern.
>>> checking if a given wavelength ,diffraction angle and slit width corresponds to the minimum intensity observed in the diffraction pattern
>>> calculating the intensity of a fringe observed in a single slit diffraction pattern based on the slit width ,diffraction angle and wavelength.
>>> calculating the intensity of a fringe observed in a double slit diffraction pattern based on the path difference and the central maximum or the maximum intensity observed,
**

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

@algorithms-keeper algorithms-keeper Bot added awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass labels Oct 1, 2024
@algorithms-keeper algorithms-keeper Bot added the require type hints https://docs.python.org/3/library/typing.html label Oct 1, 2024

@algorithms-keeper algorithms-keeper Bot left a comment

Copy link
Copy Markdown

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.

Comment thread physics/diffraction.py Outdated
@@ -0,0 +1,90 @@
import math

def check_min_intensity(slit_width = 1,diff_angle=0, wavelength=100):

Copy link
Copy Markdown

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: check_min_intensity. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: slit_width

Please provide type hint for the parameter: diff_angle

Please provide type hint for the parameter: wavelength

Comment thread physics/diffraction.py Outdated
r_val = (n_val-math.floor(n_val)==0)
return r_val

def check_max_intensity(slit_width=1,diff_angle=0,wavelength=100):

Copy link
Copy Markdown

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: check_max_intensity. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: slit_width

Please provide type hint for the parameter: diff_angle

Please provide type hint for the parameter: wavelength

Comment thread physics/diffraction.py Outdated
r_val = (n_val-math.floor(n_val)==0)
return r_val

def intensity_single_slit(slit_width=1,diff_angle=0,wavelength=100):

Copy link
Copy Markdown

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: intensity_single_slit. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: slit_width

Please provide type hint for the parameter: diff_angle

Please provide type hint for the parameter: wavelength

Comment thread physics/diffraction.py Outdated
i_coeff = (math.sin(beta)/beta)**2
return f"{i_coeff} I0"

def intensity_double_slit(path_diff=0,intensity_max="I0"):

Copy link
Copy Markdown

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: intensity_double_slit. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: path_diff

Please provide type hint for the parameter: intensity_max

@algorithms-keeper algorithms-keeper Bot removed the tests are failing Do not merge until tests pass label Oct 1, 2024
@algorithms-keeper algorithms-keeper Bot added tests are failing Do not merge until tests pass and removed require type hints https://docs.python.org/3/library/typing.html tests are failing Do not merge until tests pass labels Oct 1, 2024
@algorithms-keeper algorithms-keeper Bot added tests are failing Do not merge until tests pass and removed tests are failing Do not merge until tests pass labels Oct 1, 2024
@algorithms-keeper algorithms-keeper Bot added tests are failing Do not merge until tests pass and removed tests are failing Do not merge until tests pass labels Oct 1, 2024
@algorithms-keeper algorithms-keeper Bot added the tests are failing Do not merge until tests pass label Oct 1, 2024
@algorithms-keeper algorithms-keeper Bot removed the tests are failing Do not merge until tests pass label Oct 1, 2024
@Skywalkr-dev
Skywalkr-dev marked this pull request as draft June 9, 2026 16:21
@Skywalkr-dev
Skywalkr-dev marked this pull request as ready for review September 14, 2026 06:44
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