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 polygons at gdstk level before shapely meshing preprocessing #1396

Merged
merged 8 commits into from Mar 7, 2023

Conversation

simbilod
Copy link
Collaborator

@simbilod simbilod commented Mar 6, 2023

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 6, 2023

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 9.67 🙂 9.61 🙂 -0.06 👍
Method Length 97.40 🙂 98.92 🙂 1.52 👎
Working memory 12.47 😞 12.88 😞 0.41 👎
Quality 54.74% 🙂 54.49% 🙂 -0.25% 👎
Other metrics Before After Change
Lines 1296 1317 21
Changed files Quality Before Quality After Quality Change
gdsfactory/simulation/gmsh/mesh.py 70.54% 🙂 69.32% 🙂 -1.22% 👎
gdsfactory/simulation/gmsh/meshtracker.py 73.08% 🙂 73.08% 🙂 0.00%
gdsfactory/simulation/gmsh/parse_gds.py 73.07% 🙂 71.43% 🙂 -1.64% 👎
gdsfactory/simulation/gmsh/uz_xsection_mesh.py 48.01% 😞 47.83% 😞 -0.18% 👎
gdsfactory/simulation/gmsh/xy_xsection_mesh.py 44.43% 😞 43.63% 😞 -0.80% 👎
gdsfactory/simulation/gmsh/xyz_mesh.py 37.46% 😞 37.46% 😞 0.00%

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

File Function Complexity Length Working Memory Quality Recommendation
gdsfactory/simulation/gmsh/xyz_mesh.py xyz_mesh 30 😞 669 ⛔ 18 ⛔ 15.09% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
gdsfactory/simulation/gmsh/uz_xsection_mesh.py uz_xsection_mesh 14 🙂 362 ⛔ 32 ⛔ 22.66% ⛔ Try splitting into smaller methods. Extract out complex expressions
gdsfactory/simulation/gmsh/xy_xsection_mesh.py xy_xsection_mesh 9 🙂 249 ⛔ 28 ⛔ 31.34% 😞 Try splitting into smaller methods. Extract out complex expressions
gdsfactory/simulation/gmsh/xyz_mesh.py add_volume 10 🙂 325 ⛔ 15 😞 34.89% 😞 Try splitting into smaller methods. Extract out complex expressions
gdsfactory/simulation/gmsh/mesh.py mesh_from_polygons 4 ⭐ 143 😞 18 ⛔ 48.84% 😞 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!

@simbilod simbilod closed this Mar 6, 2023
@simbilod simbilod reopened this Mar 6, 2023
@codecov
Copy link

codecov bot commented Mar 6, 2023

Codecov Report

Merging #1396 (189b838) into main (594121f) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #1396   +/-   ##
=======================================
  Coverage   69.50%   69.50%           
=======================================
  Files         366      366           
  Lines       22002    22002           
  Branches     3156     3156           
=======================================
  Hits        15292    15292           
  Misses       5806     5806           
  Partials      904      904           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@HelgeGehring
Copy link
Collaborator

Amazing! I'm just wondering, do you think growing and shrinking it by np.finfo(float).eps would be sufficient? With shapely that was once exactly what was needed 🤔

@tvt173
Copy link
Collaborator

tvt173 commented Mar 7, 2023

Amazing! I'm just wondering, do you think growing and shrinking it by np.finfo(float).eps would be sufficient? With shapely that was once exactly what was needed 🤔

you should be able to even grow/shrink by the grid size, since anything smaller than that is physically irrelevant. that would be a good default for atol also... i.e. default=None, and if None, use active_pdk.grid_size

@HelgeGehring HelgeGehring mentioned this pull request Mar 7, 2023
@simbilod
Copy link
Collaborator Author

simbilod commented Mar 7, 2023

Implemented, thank you for the suggestion @tvt173 @HelgeGehring

@joamatab
Copy link
Contributor

joamatab commented Mar 7, 2023

Thank you Simon!

@joamatab joamatab merged commit 4b06dfe into gdsfactory:main Mar 7, 2023
@simbilod simbilod deleted the fix_polygons_gdstk branch April 5, 2023 16:27
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

4 participants