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

Noise Wave Overhaul for Scikit-rf #596

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft

Conversation

mbe9a
Copy link

@mbe9a mbe9a commented Jan 11, 2022

Hello!

I have a bit of an update for skrf that I hope you all will find valuable. I will say that my implementation is probably far from optimal, but for the initial pull-request I decided to add support for noise waves completely in parallel to the network noise already present in skrf. I still need to add test cases for the additions and comment more thoroughly, but my code has not broken anything as far as I know.

A quick summary of what I've added:

  • noise figure and noise wave correlation matrix calculation of passive networks (Bosma's Thm.)
  • calculation of noise figure and noise wave correlation matrix for active networks from given noise parameters
  • support for calculating noise parameters from noise wave correlation matrix
  • subnetwork growth for noise waves - this is a big one. As far as I know, skrf does not support calculation of noise parameters for cascaded / arbitrarily connected active and passive networks with defined noise.
  • basic noise power calculations for multiports given input noise power and correlation (a basic linear noise simulator)

I have added a notebook under doc/source/examples/noisewaves/ that goes over all of this thoroughly and benchmarks results with ADS. There is a brief explanation of noise waves if you are unfamiliar. Noise waves are very naturally represented alongside s-parameters and are amenable to signal flow graph theory and subnetwork growth algorithms.

Please give me any thoughts you have. The implementation is a bit 'clunky' as I've added a lot of parameters that were already present but added a '_w' for 'waves' :) at the end. I have not added support for noise waves to everything but the main functions like connect, innerconnect, resample, renumber, etc have been modified.

…rk, which can also be used to calculate the noise figure at each port
…ls (erroneous but allows one to keep working)
… noise parameters for any combination of ports
added example notebook for noise waves
@github-actions github-actions bot added Documentation Request/Improvement of the documentation Network labels Jan 11, 2022
@jhillairet jhillairet added the New Feature A new feature in progress label Jan 12, 2022
@jhillairet
Copy link
Member

Thank you for contributing to scikit-rf! This is a big work at once, please let us know some time to review and give comments. Currently, the tests are failing.

@FranzForstmayr
Copy link
Collaborator

@mbe9a could you create a separate PR from the first commit only? It seems this are cosmetic changes (only?), so it would be easier to review the rest.

@mbe9a
Copy link
Author

mbe9a commented Jan 12, 2022

@jhillairet sorry about that! A later commit must have broken the tests again. I will continue to work through them.

@mbe9a
Copy link
Author

mbe9a commented Jan 12, 2022

@FranzForstmayr I may know microwaves, but I am a GitHub novice. What's the best way to create a pull-request from a specific commit? I've seen examples where I could create a new branch and cherry pick commits. Would that work?

@FranzForstmayr
Copy link
Collaborator

You could checkout the commit and create a new branch from it. Then you could create a PR from this new branch.
In your case:

git checkout 31ceb6d -b cosmetics
git push -u origin cosmetics

Then create a second PR :)
Without any functional changes, the review easier :)

@jhillairet
Copy link
Member

The documentation you've made is great, thank you!

I would suggest splitting the examples if different notebooks, and eventually to make the introductory parts in the /tutorial section of the documentation and referring to the examples. But that's very debatable.

Also, the PR includes MAC-OS dir files (.DS_Store). Could you remove them? You can add the line:

.DS_Store

to the .gitignore file. To avoid adding these files in the future for you and others.

Comment on lines +6968 to +6969
"""
"""
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 complete the docstring?

Comment on lines +6928 to +6930
"""
checks if two Networks have same noise frequency
"""
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 complete the docstring with the argument section?

Comment on lines +6096 to +6097
((z01.conj() + s[:, 0, 0] * z01) * (z02.conj() + s[:, 1, 1] * z02) - s[:, 0, 1] * s[:, 1,
0] * z01 * z02) / denom,
Copy link
Member

Choose a reason for hiding this comment

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

the way you have reformatted the line is a bit messy to my opinion.

@@ -0,0 +1 @@
/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Python3
Copy link
Member

Choose a reason for hiding this comment

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

this file also should not be added

Comment on lines +1001 to +1003

if __name__ == "__main__":
unittest.main()
Copy link
Member

Choose a reason for hiding this comment

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

I think this is redundant with the line above, no?

Comment on lines +5395 to +5396
dtype: str
In order to use the subnetwork growth functions symbolically, dtype must be set to 'object'.
Copy link
Member

Choose a reason for hiding this comment

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

I wonder in which case you run into trouble to be obliged to add this parameter. Is it really necessary?

Comment on lines +1441 to +1442
def nf_w(self, Ta: float = T0, dB: bool = False) -> npy.ndarray:
"""
Copy link
Member

Choose a reason for hiding this comment

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

the parameters does not match with the docstring description

## Functions operating on Network[s]
def connect(ntwkA: Network, k: int, ntwkB: Network, l: int, num: int = 1) -> Network:
def connect(ntwkA: Network, k: int, ntwkB: Network, l: int, num: int = 1, tol: float = mf.ALMOST_ZERO) -> Network:
Copy link
Member

Choose a reason for hiding this comment

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

the new tol parameter should be add to the docstring

@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
Documentation Request/Improvement of the documentation Network New Feature A new feature in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants