-
-
Notifications
You must be signed in to change notification settings - Fork 47.1k
Resonant Frequency & Electrical Impedance #6983
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
Conversation
for more information, see https://pre-commit.ci
from math import sqrt | ||
|
||
|
||
def resonant_frequency(inductance: float, capacitance: float) -> tuple: |
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.
A tuple
of what?
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.
The tuple contains the values of inductance and capacitance that are required for calculating the resonant frequency of the LC Circuit.
electronics/resonant_frequency.py
Outdated
|
||
else: | ||
return ( | ||
"resonant_frequency", |
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 are you returning the function name?
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.
It is also the name of the value that the function is returning.
Co-authored-by: Caeden <caedenperelliharris@gmail.com>
Co-authored-by: Caeden <caedenperelliharris@gmail.com>
Co-authored-by: Caeden <caedenperelliharris@gmail.com>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Co-authored-by: Paul <56065602+ZeroDayOwl@users.noreply.github.com>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
electronics/electrical_impedance.py
Outdated
@@ -0,0 +1,41 @@ | |||
# https://en.wikipedia.org/wiki/Electrical_impedance |
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.
Could you add a brief description here about the impedance?
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.
I have added the description for electrical impedance.
@@ -0,0 +1,41 @@ | |||
# https://en.wikipedia.org/wiki/LC_circuit |
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.
Same as before, perhaps add a brief explanation of LC circuits.
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.
I have added the description for LC Circuit.
electronics/resonant_frequency.py
Outdated
>>> resonant_frequency(inductance=0, capacitance=5) | ||
Traceback (most recent call last): | ||
... | ||
ValueError: Inductance cannot be 0 or negative | ||
>>> resonant_frequency(inductance=10, capacitance=0) | ||
Traceback (most recent call last): | ||
... | ||
ValueError: Capacitance cannot be 0 or negative | ||
>>> resonant_frequency(inductance=10, capacitance=5) | ||
('Resonant frequency', 0.022507907903927652) |
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.
These doctests are good, however following general conventions, maybe you can move the successful case/s before the failed ones.
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.
I have updated the doctests according to the general conventions.
for more information, see https://pre-commit.ci
Co-authored-by: Paul <56065602+ZeroDayOwl@users.noreply.github.com>
Co-authored-by: Paul <56065602+ZeroDayOwl@users.noreply.github.com>
Co-authored-by: Paul <56065602+ZeroDayOwl@users.noreply.github.com>
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 you review?
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}
.