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

Meow plugin #1015

Merged
merged 18 commits into from Dec 19, 2022
Merged

Meow plugin #1015

merged 18 commits into from Dec 19, 2022

Conversation

simbilod
Copy link
Collaborator

Can call MEOW directly on component + layerstack to get single-wavelength Sparameters from EME

  • Converts gdsfactory LayerStack to MEOW extrusion rules
  • Converts gdsfactory materials to MEOW material
  • Converts MEOW output S-parameter format to gdsfactory S-parameter format
  • Validates component, currently can only simulate 2-ports components with west and east-facing ports
  • Documentation notebook showing simple calls

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 19, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 3.66 ⭐ 3.64 ⭐ -0.02 👍
Method Length 116.67 🙂 117.08 🙂 0.41 👎
Working memory 10.41 😞 10.41 😞 0.00
Quality 58.39% 🙂 58.33% 🙂 -0.06% 👎
Other metrics Before After Change
Lines 506 508 2
Changed files Quality Before Quality After Quality Change
gdsfactory/tech.py 58.39% 🙂 58.33% 🙂 -0.06% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
gdsfactory/tech.py LayerStack.get_klayout_3d_script 19 😞 203 😞 22 ⛔ 27.65% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
gdsfactory/tech.py get_layer_stack_generic 0 ⭐ 481 ⛔ 31 ⛔ 34.68% 😞 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!

@codecov
Copy link

codecov bot commented Dec 19, 2022

Codecov Report

Merging #1015 (2f82ea4) into main (9c77835) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1015   +/-   ##
=======================================
  Coverage   74.37%   74.38%           
=======================================
  Files         436      436           
  Lines       22521    22522    +1     
  Branches     2987     2987           
=======================================
+ Hits        16751    16752    +1     
  Misses       4878     4878           
  Partials      892      892           
Impacted Files Coverage Δ
gdsfactory/tech.py 87.58% <100.00%> (+0.08%) ⬆️

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

@simbilod simbilod mentioned this pull request Dec 19, 2022
@simbilod
Copy link
Collaborator Author

I added a new meow requirement tag to pip install meow, this should be added to docs too

@joamatab joamatab merged commit dc4548d into gdsfactory:main Dec 19, 2022
@joamatab
Copy link
Contributor

Thank you Simon!

@joamatab
Copy link
Contributor

fixes #747

@tvt173
Copy link
Collaborator

tvt173 commented Dec 19, 2022

nice!
@flaport

@flaport
Copy link
Collaborator

flaport commented Dec 20, 2022

yay, nice work @simbilod .

One comment: in the future we could probably skip meow extrusion conversion and directly define eme cells (following the meow eme cell interface) within GDSFactory. Maybe I'll make an ABC for the Cell interface within meow where people can inherit from.

This would allow for way more general extrusion rules based on the GDSFactory layerstack and possibly tcad cross-section index calculations independent of the meow extrusion rules (which basically are a minimal implementation).

@simbilod
Copy link
Collaborator Author

We could use the existing gmsh plugin to read profiles from arbitrary component cross-sections and LayerStack (see notebooks).

We then could take the mesh (or shapes before meshing) and project them back onto a finite-difference materials grid to use tidy3d to get the EME cells.

Alternatively @HelgeGehring and I made some progress on integrating a FEM mode solver with your EME, but there were some kinks to work out. FEM mode solving is interesting due to adaptive meshing capabilities.

self.cells = self.get_eme_cells()
self.env = mw.Environment(wl=self.wavelength, T=self.temperature)
self.css = [mw.CrossSection(cell=cell, env=self.env) for cell in self.cells]
self.modes = [None] * num_cells
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here we should use self.modes = [None] * num_modes

@simbilod
Copy link
Collaborator Author

simbilod commented Dec 21, 2022 via email

@joamatab
Copy link
Contributor

How about self.modes_per_cell?

@simbilod
Copy link
Collaborator Author

Sure, I made it a list so we could only compute cross-section modes as we needed them (for instance, to inspect one before simulating all of them)

simbilod pushed a commit to simbilod/gdsfactory that referenced this pull request Mar 2, 2023
Meow plugin

Former-commit-id: 873cf4f [formerly dc4548d]
Former-commit-id: 665a3ab44b66cf43290e9a08accdd81439e7799a
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