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

Fix neff issue with component grating_coupler_elliptical_arbitrary #953

Merged
merged 1 commit into from Dec 2, 2022

Conversation

bhnzhang
Copy link
Contributor

@bhnzhang bhnzhang commented Dec 2, 2022

Fixing issue of grating_coupler_elliptical_arbitrary component with how the ellipses are drawn. In the previous implementation, a constant neff is assumed for each grating unit cell, which is then used to determine the ellipticity of the teeth. However, for an apodized grating coupler, neff changes depending on the unit cell geometry (e.g. on duty cycle), so an apodized grating coupler would be drawn incorrectly. In addition, neff is not needed as an input, because it can be calculated from the period, wavelength, cladding index, and coupling angle, which are already inputs to the component.

The fix:

  • Remove neff as one of the input parameters
  • Calculate neff from the period, wavelength, cladding material, and coupling angle, using the phase matching equation.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 2, 2022

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 2.79%.

Quality metrics Before After Change
Complexity 4.30 ⭐ 4.43 ⭐ 0.13 👎
Method Length 151.25 😞 211.33 ⛔ 60.08 👎
Working memory 29.83 ⛔ 29.32 ⛔ -0.51 👍
Quality 37.89% 😞 35.10% 😞 -2.79% 👎
Other metrics Before After Change
Lines 225 216 -9
Changed files Quality Before Quality After Quality Change
gdsfactory/components/grating_coupler_elliptical_arbitrary.py 37.89% 😞 35.10% 😞 -2.79% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
gdsfactory/components/grating_coupler_elliptical_arbitrary.py grating_coupler_elliptical_arbitrary 5 ⭐ 520 ⛔ 32 ⛔ 29.41% 😞 Try splitting into smaller methods. Extract out complex expressions
gdsfactory/components/grating_coupler_elliptical_arbitrary.py grating_coupler_elliptical_uniform 0 ⭐ 50 ⭐ 10 😞 76.49% ⭐ Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@joamatab
Copy link
Contributor

joamatab commented Dec 2, 2022

Thank you Bohan!

@joamatab joamatab merged commit 87b8fea into gdsfactory:master Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants