Photonics

Photonics

Topics related to Lumerical and more.

set modes in python

TAGGED: ,

    • nina.megier
      Subscriber

      I am trying to set first two modes for the port with a code

      fdtd.addport()
      fdtd.set("name","output_port")
      fdtd.set("x",3*unit)
      fdtd.set("x span",0*unit)
      fdtd.set("y",2*unit)
      fdtd.set("y span",3*unit)
      fdtd.set("z",0*unit)
      fdtd.set("z span",2*unit)
      fdtd.set('mode selection',(1,2))
       
      which does not work. I have tried also with [1,2], without success. How can I reach this?
       
      Setting only one mode works perfectly fine, with, eg.
      fdtd.set('mode selection','fundamental TM mode')
       
    • Dev
      Ansys Employee

       

      Hello,

      you can find more details here : updateportmodes – Script command – Ansys Optics

    • nina.megier
      Subscriber

       

       

      Actually, I get with

      fdtd.updateportmodes(1,2)

      an error:

      lumapi.LumApiError: “argument list for the updateportmode is incorrect – updateportmodes arguments were converted to (‘int, ‘int)”

      fdtd.updateportmodes([1,2]) also does not work with an error:
       
      ”lumapi.LumApiError: ‘argument list for the updateportmode is incorrect – updateportmodes arguments were converted to (cell array)'”

       

    • nina.megier
      Subscriber

      I have solved the issue, one should use

      fdtd.set('mode selection','user select')
      fdtd.set("selected mode numbers",np.array([1,2]))
    • Dev
      Ansys Employee

      Hello Nina, thanks for the update.

      We cab also use:
      fdtd.updateportmodes(np.array([1,2]))

      https://optics.ansys.com/hc/en-us/articles/360034409174
      https://optics.ansys.com/hc/en-us/articles/360043683873-lumapi-getv-Python-API-method

Viewing 4 reply threads
  • The topic ‘set modes in python’ is closed to new replies.