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

Index variation in a coupler branch #1637

Closed
ghost opened this issue Jun 25, 2021 · 3 comments · Fixed by #1652
Closed

Index variation in a coupler branch #1637

ghost opened this issue Jun 25, 2021 · 3 comments · Fixed by #1652
Labels

Comments

@ghost
Copy link

ghost commented Jun 25, 2021

Hello,

I am a new user of Meep. I followed the tutorial on GDSII Import and based my script on examples/coupler.py.

I would like to create a gradual index variation within the two branches of my coupler. That is why I tried to put a function as first argument of mp.get_GDSII_prisms. However, this doesn't seem to work and I have the error "OverflowError: in method 'get_GDSII_prisms', argument 3 of type 'int'"

I thought that any function that accepts a mp.Medium instance could also take a user-defined function. How can I create such a variation of the index ?

Thank you in advance

@stevengj
Copy link
Collaborator

stevengj commented Jun 25, 2021

This should work. Possibly you defined the material function incorrectly? Try using:

def test_material_function(p):
    return mp.Medium(index=2)

for example.

(Or maybe you have some unrelated bug in how you are calling it; it's impossible to say for sure without seeing example code illustrating the problem.)

To make sure you aren't making some other unrelated error, I would recommend that you try running the script from the GDSII-import tutorial, but pass test_material_function instead of silicon to mp.get_GDSII_prisms.

@ghost
Copy link
Author

ghost commented Jun 28, 2021

Thank you for your answer. I tried to add test_material_function directly in the script from the GDSII-import tutorial, but I still have the same issue...

@stevengj
Copy link
Collaborator

stevengj commented Jul 1, 2021

Looks like there were a couple of problems with using material functions with prisms. They should be fixed by #1652.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant