-
-
Notifications
You must be signed in to change notification settings - Fork 264
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
Fixed __eq__ issue #915
Fixed __eq__ issue #915
Conversation
…y properties of network.
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 contribution, thank you!
Comparing all
|
I agree that comparing all properties is maybe overkill. Is the more the better? Or should we really restrict the comparisons to:
for noise parameter, eventually too. |
skrf/network.py
Outdated
if self.s_def == other.s_def: | ||
return True | ||
else: | ||
if npy.all(npy.abs(npy.real(self.z0)) - npy.abs(npy.real(other.z0)) < ZERO): |
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 abs
is at the wrong place.
Maybe use something like return npy.allclose(self.z0.real, other.z0.real, atol=ZERO)
|
||
f2 = npy.arange(11) | ||
n2 = rf.Network(s=s,f=f2) | ||
self.assertFalse(n1 == n2) |
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.
Maybe one more test with f2 = f1 * 10, as this test returns when checking the length of the vectors.
It seams to be failing because of the following test in test_media: def test_impedance_mismatch(self):
"""
Test the naming of the network. When circuit is used to connect a
topology of networks, they should have unique names.
"""
name = 'impedanceMismatch,50to25'
qucs_ntwk = Network(os.path.join(self.files_dir, name + '.s2p'))
self.dummy_media.frequency = qucs_ntwk.frequency
skrf_ntwk = self.dummy_media.thru(z0=50, name = name)**\
self.dummy_media.thru(z0=25)
self.assertEqual(qucs_ntwk, skrf_ntwk)
self.assertEqual(qucs_ntwk.name, skrf_ntwk.name) I'm not 100% sure about this, but the Networks in this test should not be equal, since they differ in |
I think the problem is, that the file stored in sNp has always the same port impedance on all ports, in this case 50. You could manually set qucs_ntwk.z0 to [50, 25] to avoid this issue. If you do, please write a small note :) |
@Hadimius don't worry about CI, this issue is from the latest numpy release from yesterday. We need to fix this ASAP :) |
Can you merge in master please? |
Looks good! |
Changed eq so it accounts for differences in frequency and all primary properties. Refers to and solves issue #914