Ansys Learning Forum › Forums › Discuss Simulation › Photonics › Blocking calls with Lumerical’s python lumapi? › Reply To: Blocking calls with Lumerical’s python lumapi?
July 29, 2021 at 6:33 pm
JBelleville
Subscriber
Thank you for the very thorough response! It's good to get the confirmation that python treats the GUI environment like a client. I was retrieving the results with fdtd.eval as you suspected. I've tried with fdtd.getresult instead, but I see the same behaviour (where the first function call sometimes receives the wrong output, but the second retrieves the correct value).
I'm setting the material properties by selecting the GDS and then running fdtd.set('material', materialName). I suspect that this is the call which fails to complete before my attempt to retrieve the results (that is, I think that Lumerical is still in process of setting the material when I call either fdtd.getresult or lumapi.getVar).
I previously used a time buffer, but because the time required was variable from computer to computer, I was hoping for more robust solution (for example, a way to verify that the fdtd.set command has completed). Do you know of any way to do that? My current solution is to poll the index results at time intervals until the permittivities are roughly as expected (then allowing the script to proceed). If there's no way to check the completion of a command, I might stick with that.
Thank you for the tips on fdtd.addjob and fdtd.getv , those are great to know about and I'll be sure to use them!
Best,
I'm setting the material properties by selecting the GDS and then running fdtd.set('material', materialName). I suspect that this is the call which fails to complete before my attempt to retrieve the results (that is, I think that Lumerical is still in process of setting the material when I call either fdtd.getresult or lumapi.getVar).
I previously used a time buffer, but because the time required was variable from computer to computer, I was hoping for more robust solution (for example, a way to verify that the fdtd.set command has completed). Do you know of any way to do that? My current solution is to poll the index results at time intervals until the permittivities are roughly as expected (then allowing the script to proceed). If there's no way to check the completion of a command, I might stick with that.
Thank you for the tips on fdtd.addjob and fdtd.getv , those are great to know about and I'll be sure to use them!
Best,