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

Read grid from PDK #733

Merged
merged 7 commits into from Sep 26, 2022
Merged

Read grid from PDK #733

merged 7 commits into from Sep 26, 2022

Conversation

bradley-w-snyder
Copy link

I added code to read the grid size from the PDK.

I also added some fixes here and there for snapping to the grid. These issues are more apparent when using grid sizes > 1 nm, For instance, when defining a rectangular grating coupler with 5 nm grid, if you have a 15 nm trench from x = 0 to x = 15, the midpoint was previously calculated as 7.5 nm, and then snapped to the grid at x = 5 or x = 10, and then the whole trench was shifted.

There are also some random defaults fixes.

I had some commits to also snap the ports, but this actually makes less sense since they are not physical on the mask. So for a waveguide of 15 nm wide with the port in the middle at 7.5, this should not be snapped since the connecting waveguide will still have mask points at 0 and 15. Therefore, I did not include these changes.

All changes are cherry-picked from my master.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Sep 25, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 9.84 🙂 9.86 🙂 0.02 👎
Method Length 90.56 🙂 90.64 🙂 0.08 👎
Working memory 12.68 😞 12.66 😞 -0.02 👍
Quality 58.03% 🙂 58.02% 🙂 -0.01% 👎
Other metrics Before After Change
Lines 6714 6745 31
Changed files Quality Before Quality After Quality Change
gdsfactory/component.py 68.58% 🙂 68.45% 🙂 -0.13% 👎
gdsfactory/cross_section.py 49.47% 😞 49.47% 😞 0.00%
gdsfactory/path.py 37.70% 😞 38.37% 😞 0.67% 👍
gdsfactory/port.py 61.65% 🙂 61.66% 🙂 0.01% 👍
gdsfactory/snap.py 84.46% ⭐ 82.81% ⭐ -1.65% 👎
gdsfactory/types.py 63.32% 🙂 63.32% 🙂 0.00%
gdsfactory/components/init.py 30.74% 😞 30.68% 😞 -0.06% 👎
gdsfactory/components/bend_circular.py 55.35% 🙂 55.35% 🙂 0.00%
gdsfactory/components/grating_coupler_elliptical.py 41.85% 😞 42.42% 😞 0.57% 👍
gdsfactory/components/grating_coupler_rectangular_arbitrary.py 40.25% 😞 40.57% 😞 0.32% 👍
gdsfactory/components/taper_cross_section.py 75.69% ⭐ 73.00% 🙂 -2.69% 👎
gdsfactory/geometry/boolean.py 40.15% 😞 39.60% 😞 -0.55% 👎
gdsfactory/geometry/functions.py 70.42% 🙂 70.42% 🙂 0.00%
gdsfactory/read/from_picwriter.py 64.89% 🙂 64.22% 🙂 -0.67% 👎
gdsfactory/routing/get_route_from_steps.py 61.32% 🙂 61.32% 🙂 0.00%

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

File Function Complexity Length Working Memory Quality Recommendation
gdsfactory/path.py extrude 89 ⛔ 1028 ⛔ 28 ⛔ 1.52% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
gdsfactory/path.py transition 28 😞 360 ⛔ 20 ⛔ 16.55% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
gdsfactory/geometry/boolean.py boolean 32 😞 354 ⛔ 16 ⛔ 18.00% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
gdsfactory/cross_section.py pn 7 ⭐ 484 ⛔ 43 ⛔ 27.12% 😞 Try splitting into smaller methods. Extract out complex expressions
gdsfactory/cross_section.py pn_ge_detector_si_contacts 7 ⭐ 463 ⛔ 45 ⛔ 27.23% 😞 Try splitting into smaller methods. 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!

@sonarcloud
Copy link

sonarcloud bot commented Sep 25, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
2.3% 2.3% Duplication

@joamatab joamatab merged commit f01ed86 into gdsfactory:master Sep 26, 2022
@joamatab
Copy link
Contributor

Looks great, thank you Brad, releasing 5.34.0 with your improvements

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