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 femwell and try to fix meow plugin #1038

Merged
merged 6 commits into from Dec 21, 2022
Merged

fix femwell and try to fix meow plugin #1038

merged 6 commits into from Dec 21, 2022

Conversation

joamatab
Copy link
Contributor

  • fix femwell installation
  • eme plugin still has some issues to simulate a taper

image

@codecov
Copy link

codecov bot commented Dec 21, 2022

Codecov Report

Merging #1038 (9102d1a) into main (b2a4ee7) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #1038   +/-   ##
=======================================
  Coverage   72.57%   72.57%           
=======================================
  Files         436      436           
  Lines       22543    22543           
  Branches     2988     2988           
=======================================
  Hits        16361    16361           
  Misses       5305     5305           
  Partials      877      877           

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

@joamatab
Copy link
Contributor Author

#1015

@joamatab joamatab merged commit 28ebd43 into main Dec 21, 2022
@joamatab joamatab deleted the 615e branch December 21, 2022 17:55
@simbilod
Copy link
Collaborator

I've noticed that results have a very strong dependence on the simulation parameters (num_modes, resolution, cell_length)

It helps to use negative spacing_y to make the cross_section a bit smaller, and hence require coarser grid, than what the LayerStack would give you by default.

AFAIK basic EME like this needs a lot of slices to avoid spurious reflections due to "staircasing". Commercial EME software usually employ some sort of first-order interpolation scheme to avoid this and converge the results better.

@simbilod
Copy link
Collaborator

See e.g.

` c = gf.components.taper(length=10, width2=2)
c.show()

from gdsfactory.tech import get_layer_stack_generic

filtered_layerstack = LayerStack(
    layers={
        k: get_layer_stack_generic().layers[k]
        for k in (
            "slab90",
            "core",
            "box",
            "clad",
        )
    }
)

trans = []
cells_lengths = [0.1,0.25,0.5,0.75,1]
for cell_length in cells_lengths:

    m = MEOW(component=c, 
                layerstack=filtered_layerstack, 
                wavelength=1.55,
                resolution_x=100,
                resolution_y=100,
                spacing_x=1,
                spacing_y=-3,
                num_modes=4,
                cell_length=cell_length,
                )
    import matplotlib.pyplot as plt
    # m.plot_mode(xs_num = -1, mode_num = 0)
    # m.plot_cross_section(xs_num = -1)
    sp = m.compute_sparameters()
    te0_trans = np.abs(sp["o1@0,o2@0"])**2
    trans.append(te0_trans)
    # print(len(m.cells))

plt.plot(cells_lengths, trans)
plt.title("10um taper, resx = resy = 100, num_modes = 4")
plt.xlabel("Cell length (um)")
plt.xlabel("TE0 transmission")
plt.show()`

image

@simbilod
Copy link
Collaborator

x-axis should be cell_size from 100 nm to 1 um, and y axis transmission **

@joamatab
Copy link
Contributor Author

This is great 😊

I see, how about reduce the default cell length to 0.5?

@simbilod
Copy link
Collaborator

Sure!

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 23, 2022

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 1.49%.

Quality metrics Before After Change
Complexity 2.44 ⭐ 2.19 ⭐ -0.25 👍
Method Length 76.58 🙂 79.30 🙂 2.72 👎
Working memory 11.04 😞 10.44 😞 -0.60 👍
Quality 65.51% 🙂 67.00% 🙂 1.49% 👍
Other metrics Before After Change
Lines 305 372 67
Changed files Quality Before Quality After Quality Change
gdsfactory/simulation/eme/meow_eme.py 66.56% 🙂 67.22% 🙂 0.66% 👍
gdsfactory/simulation/eme/test_meow_simulation.py 58.44% 🙂 66.03% 🙂 7.59% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
gdsfactory/simulation/eme/meow_eme.py MEOW.__init__ 0 ⭐ 250 ⛔ 22 ⛔ 41.92% 😞 Try splitting into smaller methods. Extract out complex expressions
gdsfactory/simulation/eme/test_meow_simulation.py test_meow_defaults 8 ⭐ 139 😞 12 😞 52.64% 🙂 Try splitting into smaller methods. Extract out complex expressions
gdsfactory/simulation/eme/meow_eme.py MEOW.compute_sparameters 3 ⭐ 157 😞 12 😞 55.57% 🙂 Try splitting into smaller methods. Extract out complex expressions
gdsfactory/simulation/eme/meow_eme.py MEOW.gf_material_to_meow_material 4 ⭐ 109 🙂 10 😞 63.81% 🙂 Extract out complex expressions
gdsfactory/simulation/eme/meow_eme.py MEOW.add_global_layers 3 ⭐ 112 🙂 10 😞 64.41% 🙂 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 pushed a commit to simbilod/gdsfactory that referenced this pull request Mar 2, 2023
fix femwell and try to fix meow plugin

Former-commit-id: 5bd7860 [formerly 28ebd43]
Former-commit-id: 9796e1b4fbc6e5dda8910198183342a5e8f1e7a8
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