-
-
Notifications
You must be signed in to change notification settings - Fork 308
Requested Noise Wave PR2 from commit 1 #597
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
base: master
Are you sure you want to change the base?
Conversation
Great, thank you :) |
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.
@mbe9a thank you for making this slice of PR. Except the formatting, is the only addition concerns set_noise_a
?
|
||
# from matplotlib import cm | ||
# import matplotlib.pyplot as plt | ||
# import matplotlib.tri as tri | ||
# from scipy.interpolate import interp1d |
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.
you can delete these lines
raise ValueError("The network must have two or more ports.") | ||
|
||
# if n-port ntwk is passive, calculate noise figure via Bosma's Thm | ||
if passive and self.noise is None: |
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.
would self.noise is None
and not noisy
would have the same effect ? (the later maybe being more clear)
|
||
def nf(self, z: NumberLike, passive=False, Ta=290, Tp=290) -> npy.ndarray: | ||
""" | ||
the noise figure for the network if the source impedance is z |
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 few words and a reference to the theorem you use to calculate the NF if not defined in the ntwk?
if f_stop < self.frequency.f_scaled[ | ||
stop_idx]: # we don't want the stop index to be at a frequency higher than `f_stop` |
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.
weird formatting
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.
@mbe9a Did you use black for formatting?
((z01.conj() + s[:, 0, 0] * z01) * (1 - s[:, 1, 1]) + s[:, 0, 1] * s[:, 1, 0] * z01) / denom, | ||
((1 - s[:, 0, 0]) * (1 - s[:, 1, 1]) - s[:, 0, 1] * s[:, 1, 0]) / denom, |
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.
While I understand the change from s[:,m,n]
to s[:, m, n]
, I'm not sure if this helps to read in such cases...
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'd say it's fine to change, as the latter is pep8 conform. (E231)
https://www.flake8rules.com/rules/E231.html
As requested, a second PR from my initial commit. This is probably just formatting changes from PyCharm and includes one noise figure function change.