Photonics

Photonics

Topics related to Lumerical and more.

Ansys automation using GDSFactory

TAGGED: 

    • rakesh_krishna
      Subscriber

      I am trying to implement atuomated layout simulation using lumapi module with the layouts designe din GDSFactory. This is similar to constructing an FDTD model using Python within Spyder or Jupter notebook. When I run the script, the FDTD starts to open but them no layout opens eventually and it ends up giving an error in the console. I have raised the ossue on Github and was told to contact ansys support but could not reach out to them on git. It would be great if someone could review my case so I can send detailed information. Here are some images associated with the error. I have soecified the api path in my code.

      The erro seems to originate from the lumapi.py file in the Lumerical's directory.

    • Taylor Robertson
      Ansys Employee

      Hello Rakesh,

      Couyld you try a simpler case where you simply open a session via python?

      https://optics.ansys.com/hc/en-us/articles/360041873053-Session-management-Python-API

      Are you able to open a session through the launcher?

       

    • rakesh_krishna
      Subscriber

      Hi Taylor

      I have the issue even there. It seems that the error/except is due to the environment path. Ihave anaconda installed in my system and Spyder comes with it. As you can see, I wrote few lines of the code to just start an FDTD session. But an exception is raised pointing to the line #242 in the lumapi.py script in the Lumerical's api directory.

    • Taylor Robertson
      Ansys Employee

      It seems like it may be an issue with your license or environment. I have used Anaconda in the past so there shouldn't be any fundamental issue.

      Actually comparing my code you may want to delete the last part of the sys.append?

      sys.path.append("C:\\Program Files\\Lumerical\\v231\\api\\python")
       
      If that doesn't work try and eliminate the first issue by lanching the simple python script using the python interpreter we ship with, or launch it from the Lumerical software. Maybe confirm that both work?

    • rakesh_krishna
      Subscriber

       

      Hi Taylor,

      I tried changing the sys.append path. It didnt help. I still get the error.

      I tried to set the interpreter in the Spyder IDE to the Lumerical’s Python interpreter (provided with the package). Then I ran the script which gave the same raise exception error

      Alternately, I tried opening the interpreter directly from the Lumerical by right clicking it. Then I wrote the two lines “import lumapi”, and “fdtd=lumapi.FDTD()”. I still get the same error.

      Not sure what’s going on here

       

      • Lito
        Ansys Employee

        @rakesh_krishna, 

        Have you tried running the script from the Lumerical CAD > Script file editor window with the Python integration shown as "Active"? 

         

    • rakesh_krishna
      Subscriber


      Thanks Lito, I think we are getting somewhere close to solving this. I have two questions.

      a) Firstly, I have not enabled "Use python provided by lumerical option". So the Python exectuable path is located in my usual python folder installed in my machine. When I enabled this option, the executable path is located in a folder named "python-3.6.8-embed-amd64" in my D drive. This is not like your path which is in Programfiles directory of C-drive. Not sure, how I got this folder into my system though?

      Now, when I run the simple pytest script, it works fine. I get a new FDTD opened up with a ring in it. This is as expected.

      b) The goal is to use an external IDE (like Spyder/Visual code) to interface with FDTD. It still does not work. Do you think it has to do the interpreter path? The IDE like Spyder/VScode were installed in a bundle with Anaconda. So the python interpreter used is the default python.exe from conda. Anyway, I tried three different inerpreter paths:
      D:\python-3.6.8-embed-amd64\python.exe
      C:\Program Files\Lumerical\v222\python-3.9.9-embed-amd64\python.exe
      C:\ProgramData\Anaconda3\python.exe
      I still end up getting the error.

    • Lito
      Ansys Employee

      @rakesh_krishna, 

      Where did you install Lumerical on your computer? Did you set this to install on a different location during the installation process -- not the default install location? If this is the case, then our installation files it will be on a different location.

      We recommend to install using the default process/install path as shown in the KB:

      >>> Windows installation guide – Ansys Optics

      To run outside the CAD/GUI, you will have to add the API and Lumerical install path into your environment (PATH / PYTHONPATH). Your "Anaconda" should already be in your environment. Similar to the screenshot/image, my Python3 installation is already in my environment. I simply added the Lumerical install and API path into my environment. Ensure that the required modules to run our API is installed on your Anaconda/Python installation.  

      >>> Create or modify environment variables in Windows – Ansys Optics 

    • rakesh_krishna
      Subscriber

      Hi lito,

      So I found out that there are two versions of lumerical installed in my system. I removed the older version and re-installed everything to the latest 2023 version. This no longer gives me the problem. I can create a fsp file and save it.

       

      Also the python and api are not added to my PATH on windows, I checked it too. It works finally.

       

      Thanks,

      -Rakesh.

      • Lito
        Ansys Employee

        @rakesh_krishna,

        Glad to hear this. Please mark this post as resolved/answered.  ?

Viewing 7 reply threads
  • The topic ‘Ansys automation using GDSFactory’ is closed to new replies.