Python API with EME

I am using the python API to run mode sweeps. Just to test it out and implement my own structure shapes, I ran the script from inside my python file using “with lumapi.MODE() as mode”. It works up until “mode.set(“number of cell groups”, 3)” and I get back the error saying “number of cell groups” is not a valid property. However, this property is valid using an lsf script. How come this doesn’t work for the API?

Hello @ihammond,

Thank you for the question. I haven’t been able to replicate the error, the following script run from the Script File Editor for FDTD Solutions works for me:

import lumapi
mode = lumapi.MODE()

# set dimension
mode.set("x min",-8e-6)
mode.set("y span",5.5e-6)
mode.set("z span",7e-6)

# set cell properties
mode.set("number of cell groups",3)


This error may be caused by the fact that the EME solver object is not currently selected when this method is used. You can get around this by replacing it with this command:

mode.setnamed("EME", "number of cell groups",3)

Which will set the number of cell groups for the EME solver regardless of what object is currently selected.

With version 2019a or later, you can also include the object settings as arguments in the addeme command instead of setting them one by one, for example:
mode.addeme(x_min=-8e-6, y=0.0e-9, y_span=5.5e-6, z=0.5e-6, z_span=7.0e-6, number_of_cell_groups=3)

See this page for more information about this.

Try out those commands and see if they solve your issue. If they don’t, please post your script and I will take a look at it.

Thank you that works!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.