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

improve performance of Coaxial.from_attenuation #871

Merged
merged 1 commit into from
Apr 2, 2023

Conversation

eendebakpt
Copy link
Contributor

The Coaxial.from_attenuation check on input sizes converted the Frequency argument to an array with a very slow loop including a call to __getattr__ on each element. We replace the conversion with a lookup of Frequency.f

Benchmark:

freq = skrf.F(.15,1.7,801, unit='GHz') # fails   
att_db_per_meter = 3.0
medium=Coaxial.from_attenuation_VF(freq, att=att_db_per_meter, VF=.69)

Master: 3.5 seconds, this PR: < 0.1 seconds.

@FranzForstmayr

@github-actions github-actions bot added the Media label Apr 1, 2023
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.

Nice catch!

@jhillairet jhillairet merged commit d0d7e40 into scikit-rf:master Apr 2, 2023
@jhillairet jhillairet mentioned this pull request Apr 2, 2023
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

2 participants