-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Create malus_law.py #7710
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
Create malus_law.py #7710
Conversation
Finding the intensity of light transmitted through a polariser using Malus Law and by taking initial intensity and angle between polariser and axis as input
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.
@SparshRastogi fix the failing pre-commit (lines too long), commit my changes and then this pr will be ready for merge.
Great work!
physics/malus_law.py
Outdated
) | ||
# handling of values out of allowed range | ||
final_intensity = initial_intensity * (math.cos(math.radians(angle)) ** 2) | ||
return round(final_intensity, 2) |
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.
Why round the result?
return round(final_intensity, 2) | |
return final_intensity |
You should keep the precision and round it in the tests
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.
Yes,thank you for the suggestion,made changes to round in the testcases instead of main code
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Made some changes in the error messages and the docstring testcases
Made changes for the passing the precommit
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.
@cclauss Can we get your review?
I wasn't completely sure if I should've enforced moving the imports below the docstring, so I left it. Should we enforce docstrings from line 1 and then code/imports after?
Finding the intensity of light transmitted through a polariser using Malus Law and by taking initial intensity and angle between polariser and axis as input
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}
.