-
-
Notifications
You must be signed in to change notification settings - Fork 280
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
Add gain properties #908
Add gain properties #908
Conversation
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.
Thanks for contributing!
I've made some suggestion on the documentation, to be discussed.
Would you mind adding some associated tests eventually?
@jhillairet |
I fixed some issues with stability in #910 when S12 or S21 is zero. Can you make sure that these methods also work correctly when S12 or S21 are zero? Also I would prefer raising |
Nice catch. I need to fix zero division issues in the gain properties. @jhillairet |
OK, merged. |
I added test codes and chaged |
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.
Great, thank you. Small additionnal comments:
- could you comment your tests to explain in a few words their purpose?
- Eventually, if you could reduce the number of points of the test files (fet.s2p, maxgain_ads.csv). ~hundred of frequency points is enough for testing and it saves some space.
infs = npy.full(self.s.shape[0], npy.inf)
abs_s12 = npy.abs(self.s[:, 0, 1])
gms = npy.divide(npy.abs(self.s[:, 1, 0]), abs_s12, out=infs, where=abs_s12!=0)
return gms
|
Thank you for comment! @Ttl By the way, does |
That's true in that case. If it handles S12 = 0, S21 != 0 correctly now then it's fine. |
I understand that the default behavior of Numpy is to return The current test only detects runtime warnings, do I need to check |
Thank you @keikawa I forgot to merge this PR before merging the new version, I'll make a minor version to integrate it! |
The maximum stable gain, available gain, and Mason's unilateral gain were added to the Network object.