Navigation Menu

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

complex indices for materials in write_sparameters_lumerical #363

Closed
jan-david-fischbach opened this issue May 6, 2022 · 6 comments
Closed

Comments

@jan-david-fischbach
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Cannot use (n,k) Materials in Lumerical in the current state

Describe the solution you'd like
Enable passing a complex index to write_sparameters_lumerical (thru material_name_to_lumerical). This could be done by adding the following snippet to handle the complex index:

elif isinstance(material, complex):
            mat = s.addmaterial("(n,k) Material")
            s.setmaterial(mat, "Refractive Index", material.real)
            s.setmaterial(mat, "Imaginary Refractive Index", material.imag)
            s.setnamed(layername, "material", mat)

Note that setting the material in lumerical depending whether a str, int or float is used is repeated twice, once for the cladding and once for the layers. It might make sense to refactor that into a function.

@joamatab
Copy link
Contributor

joamatab commented May 6, 2022

Hi @Jan-David-Black ,

yes, that's a great idea, thank you for sharing,

How does this new branch work for you?
https://github.com/gdsfactory/gdsfactory/tree/559

I made a new function set_material() as you suggested

@jan-david-fischbach
Copy link
Collaborator Author

Looks Great! I am sorry I only throw stuff in here and don't just open a pull request, with everything set up properly. At some point I will find the time configure a "build environment" so that I can contribute more efficiently!

@joamatab
Copy link
Contributor

joamatab commented May 6, 2022

Im also trying it on my side

just pushed a fix, more docs and a demo

@jan-david-fischbach
Copy link
Collaborator Author

What was the problem with using complex instead of a tuple of floats?

@joamatab
Copy link
Contributor

joamatab commented May 6, 2022

now it can do both tuples and complex refractive index

image

@joamatab joamatab mentioned this issue May 6, 2022
Merged
@joamatab joamatab closed this as completed May 7, 2022
@jan-david-fischbach
Copy link
Collaborator Author

now it can do both tuples and complex refractive index

ah understood :)

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

No branches or pull requests

2 participants