Photonics

Photonics

Topics related to Lumerical and more.

Structure group settings in Python API

TAGGED: 

    • MansoorAS
      Subscriber

      Hello,

      I want to run some simulations from Python API and design some structures for FDTD. I checked the files of Y-branch but I found they do not have structure groups in them. Can anyone provide an example of structure group creation through python API.

      Thank you

    • Taylor Robertson
      Ansys Employee
      Hello MansoorAS,
      I the PID grating coupler uses the Python API with structure groups, and I would refer to the lsf documentation. Remember the python methods should behave the same as these documented script commands. Alternatively you can use eval to directly execute lsf code from python.
      You can add groups usingaddstructuregroup - Script commandoraddanalysisgroup - Script command. Once this is selected you can add parameters, and scripts to the perform the setup or analysis usingadduserprop - Script, command. These would likely be variables defined in model or calculated from model parameters. To find out the properties use queryanalysisprop or queryuserprop.
      For some advanced examples of how to work with the Python API
      I hope this helps. Also you may find the/courses/index.php/photonics/Lumerical Scripting - Sim Objects course helpful.
    • MansoorAS
      Subscriber
      Hello troberts,
      Thank you for response.
      I have a project that I built with python script, my structure group has planarsolid object( truncated cone) . What I am trying to do is automate the process with python and make it reads all the parameters and variable for the structure from excel or txt file. I thought about using evalScript but I found that it make it more complicated.
      I do not have support access to download the example files .
    • MansoorAS
      Subscriber
      I was able to set each part of the group by itself but I faced a problem with custom object. How I can set the equation? I set it like the following
      fdtd.set("equation 1", 1e6*r+slope *x)
      but did not work. num2str is not working with api.
    • Taylor Robertson
      Ansys Employee
      Hey Mansoor
      In the python environment you will need to use their string conversion function. I think it is.
      fdtd.set("equation 1", str(1e6*r+slope *x))
Viewing 4 reply threads
  • The topic ‘Structure group settings in Python API’ is closed to new replies.