-
-
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
Refactor media to simplify line creation #727
Refactor media to simplify line creation #727
Conversation
9571e08
to
f9928fe
Compare
…thub.com/mhuser/scikit-rf into refactor-media-to-simplify-line-creation
…thub.com/mhuser/scikit-rf into refactor-media-to-simplify-line-creation
A deprecation warning is now emmited if |
After having reflected a bit on it, I think there is some tradeoff here. If we keep the PR to merge within 1.0, it probably will not benefits from the extensive testing by many users on Master, with the risk to miss key issues that we later have to fix in 1.0. |
Updated documentation for reviewers:
|
skrf/media/media.py
Outdated
""" | ||
Characteristic Impedance. | ||
|
||
Returns | ||
------- | ||
z0 : :class:`numpy.ndarray` | ||
""" |
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 think additional explanation should be given about what is returned here (None or something)
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.
Now that z0_override
is a property of the abstract class Media
, the switch between z0_override
and abstract method z0_characteristic
can be done here. The media classes will need to define z0_characteristic, which sounds quite clear what it is 😉
@property
@abstractmethod
def z0_characteristic(self):
"""
Characteristic Impedance.
This abstract method has to be defined in the Media Class.
Returns
-------
z0_characteristic: npy.ndarray
Characteristic Impedance in units of ohms
"""
return None
@property
def z0(self):
"""
Return Characteristic Impedance `z0_characteristic`.
If `z0_override` is not None, it is returned instead.
Returns
-------
z0 : npy.ndarray
z0_characteristic or z0_override in units of ohms
"""
if self.z0_override is None:
return self.z0_characteristic
else:
return self.z0_override
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.
Done.
@mhuser do you think it is ok for the next release now ? (or the one after the next one?) |
I think yes. Let's merge branch master inside. 😅 |
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 (and huge) work @mhuser . Let's see if anyone complain after the next release ;)
I believe this breaks the "media coaxial" example in the tutorial. |
@drsvenkuehn, which one ? |
@jhillairet |
Hello @drsvenkuehn , print(f'z0_port = {rg58.z0_port[0]}') gives and rg58.line(100, unit = 'mm', z0 = 25, name = '100 mm, 25 Ohm') Is it possible you are speaking of another version ? |
Hi @mhuser ...sorry, my bad. I didn't use the right virtual environment. I used an old version. I get the same results with 0.30.0 |
Ok, thanks for letting us know. |
This PR is the second attempt to fix #651
Ready for review.
Todo
media
forz0_port
,z0
schememedia
forz0_override
,z0
schemez0
toMedia.line())