Skip to content
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

Requested Noise Wave PR2 from commit 1 #597

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mbe9a
Copy link

@mbe9a mbe9a commented Jan 12, 2022

As requested, a second PR from my initial commit. This is probably just formatting changes from PyCharm and includes one noise figure function change.

@FranzForstmayr
Copy link
Collaborator

Great, thank you :)

Copy link
Member

@jhillairet jhillairet left a 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 ?

Comment on lines +193 to +197

# from matplotlib import cm
# import matplotlib.pyplot as plt
# import matplotlib.tri as tri
# from scipy.interpolate import interp1d
Copy link
Member

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:
Copy link
Member

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
Copy link
Member

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?

Comment on lines +2871 to +2872
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`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird formatting

Copy link
Collaborator

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?

Comment on lines +5690 to +5691
((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,
Copy link
Member

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...

Copy link
Collaborator

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

@jhillairet jhillairet marked this pull request as draft May 11, 2022 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants