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

layer priority operation #1413

Merged
merged 2 commits into from Mar 12, 2023
Merged

Conversation

simbilod
Copy link
Collaborator

@mdecea

sometimes you bring two large cross sections together and they overlap

the simplest fix is to do some booleans (sorry Joaquin!) to reprioritize the layers where they touch

Example:

    funky_cross_section = gf.cross_section.cross_section(
        width=0.5,
        layer="WG",
        sections=[
            gf.cross_section.Section(width=2, layer="N"),
            gf.cross_section.Section(width=2, layer="SLAB150"),
        ],
    )

    c = gf.components.coupler(cross_section=funky_cross_section)

Original all layers:
image

The SLAB from the neighbour overlaps with the WG of the other:

image

Process the component, saying which layer needs to be cut out of which:

    c_processed = layer_priority(
        component=c,
        layer_high_order="WG",
        layer_low_order="SLAB150",
        remove_high_order=False,
    )
    c_processed.show(show_ports=True)

image

WG (high order layer)

image

SLAB (low order layer)

image

It leaves the rest of the layers alone (here, N):

image

@codecov
Copy link

codecov bot commented Mar 11, 2023

Codecov Report

Merging #1413 (cb13e2a) into main (22fc24c) will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1413      +/-   ##
==========================================
+ Coverage   69.59%   69.63%   +0.04%     
==========================================
  Files         367      368       +1     
  Lines       22175    22206      +31     
  Branches     3189     3190       +1     
==========================================
+ Hits        15432    15463      +31     
  Misses       5818     5818              
  Partials      925      925              
Impacted Files Coverage Δ
gdsfactory/geometry/__init__.py 100.00% <100.00%> (ø)
gdsfactory/geometry/layer_priority.py 100.00% <100.00%> (ø)

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

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 11, 2023

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 0.00 ⭐ 0.00 ⭐ 0.00
Method Length 148.00 😞 158.00 😞 10.00 👎
Working memory 3.00 ⭐ 3.00 ⭐ 0.00
Quality 80.07% 79.03% -1.04% 👎
Other metrics Before After Change
Lines 35 37 2
Changed files Quality Before Quality After Quality Change
gdsfactory/geometry/__init__.py 80.07% ⭐ 79.03% ⭐ -1.04% 👎

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

File Function Complexity Length Working Memory Quality Recommendation

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 joamatab merged commit 5c87647 into gdsfactory:main Mar 12, 2023
@mdecea
Copy link
Collaborator

mdecea commented Mar 13, 2023

This is awesome! Thanks @simbilod

@simbilod simbilod deleted the reprioritize_layers branch March 30, 2023 17:49
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

3 participants