-
-
October 21, 2022 at 1:16 am
Wenyi Zhang
SubscriberHi all,ÂOur research group wants to use the inverse design function of Lumerical and we started with the example - 2D Ysplitter problem in the Lumerical example gallery. We are referring to this tutorial: the https://lumopt.readthedocs.io/en/latest/tutorial.htmlÂWe keep encountering issues when running the splitter_opt_2D.py file. Here is what I did to install LumOpt and run the file.ÂI typed all of these commands in a VSCode terminal on a windows10 desktop and I am using python3 and the latest version of Lumerical.Â1. First, I entered the directory where lumapi locates with the command:cd "C:\Program Files\Lumerical|v222\api\python"Â2. then I cloned the github repo mentioned in the tutorial by:git clone https://github.com/chriskeraly/LumOpt.gitAfter this operation, I could see I have LumOpt under "C:\Program Files\Lumerical|v222\api\python"Â3.Then I enter the LumOpt folder with:cd "C:\Program Files\Lumerical\v222\api\python\LumOpt"and run the setup file with:python setup.py develop --install-dir 'C:\Program Files\Lumerical\v222\api\python\LumOpt'From the output information, I can see all of the package requirements are satisfied.Â4.To make sure the splitter_opt_2D.py can import the packages from lumopt successfully, I add two lines in the splitter_opt_2D.py, which are:sys.path.append("C:\\Program Files\\Lumerical\\v222\\api\\python\\")sys.path.append("C:\\Program Files\\Lumerical\\v222\\api\\python\\LumOpt\\")and I tried to run splitter_opt_2D.py with the command:python 'C:\Program Files\Lumerical\v222\api\python\LumOpt\examples\Ysplitter\splitter_opt_2D.py'Â5. I can see the Lumerical window opens but after some quick initialization, an error was reported:AttributeError: 'SnapShots' object has no attribute '_tmpdir'and the Lumerical window quited quickly.ÂAny help will be highly appreciated! -
October 21, 2022 at 9:41 pm
Taylor Robertson
Ansys EmployeeÂ
Hello Wenyi,
This sounds to me like it may be an issue with your Python environment. It should be easy to check using the python version we ship with. Simply run the splitter python code from the script editor in Lumerical.
This is a more upt to date example, I would suggest you use. Just open the python file and click run.
https://optics.ansys.com/hc/en-us/articles/360042305274
Â
Also ther is no need to clone that git library you mentioned, we ship a version of lumapi, lumopt and python. This directory in windows should have a newer slightly different version of LumOpt then that found on Git. That version is witten for 3.6 I believe, but Lumerical version 2022 has updated to 3.9. You may need to reinstall Lumerical to return to the version of lumopt that we ship with, as doubt these variations will work together.
Â
Let us know how it works out and if you have any further issues.
-
October 24, 2022 at 4:23 pm
Wenyi Zhang
SubscriberHi Taylor,
Thank you so much for the info and what you said is really the key. After I deleted all the files I cloned from the github and reinstalled Lumerical, I can run the python code in Lumerical without any problems. Results look good for me! :)
Thanks again!
-
- The topic ‘Inverse design package with Lumapi and LumOpt’ is closed to new replies.
-
5864
-
1906
-
1420
-
1305
-
1021
© 2026 Copyright ANSYS, Inc. All rights reserved.
