This is a continuous adjoint opimtization wrapper for Lumerical, using Python as the main user interface. It is released under an MIT license. It is still work in progress and any contribution will be very welcome! New features to come out soon, and make it even easier to use (hopefully)!
If you use this tool in any published work, please cite https://www.osapublishing.org/oe/abstract.cfm?uri=oe-21-18-21693 and give a link to this repo. Thanks!
It is all here: https://lumopt.readthedocs.io/en/latest/
Make sure you have Python 3 and the latest version of Lumerical installed (it won't work correctly with older versions), and that lumapi (the python api) works.
cd your/install/folder/
git clone https://github.com/chriskeraly/LumOpt.git
python setup.py develop
I would strongly recommend using jupyter notebooks to run optimizations.
If you are not using jupyter notebooks:
cd your/install/folder/examples/Ysplitter
python splitter_opt_2D.py
Otherwise copy your/install/folder/examples/Ysplitter/splitter_opt_2D.py
into a notebook
对于 Windows v202 版本: 0. 安装 Python 3 并将其加入系统路径,若无则还需安装 numpy 和 scipy 包。
- 将本仓库 clone 或下载并解压到本地。
- 在本地仓库路径下安装 lumopt 包:
python setup.py install
若提示信息中显示
Finished processing dependencies for LumOpt==0.0.1
则说明安装成功。
3. 打开 lumopt 包安装路径 python_path\Lib\site-packages\LumOpt-0.0.1-py3.7.egg\lumopt
下的 __init__.py
文件, 将其中的 Python api 路径设为所安装的 Lumerical 的 Python api 路径 (如 C:\Program Files\Lumerical\v202\api\python
):
default_api_path = '/Program Files/Lumerical/v202/api/python'
- 打开所安装的 Lumerical 的 Python api 路径 (如
C:\Program Files\Lumerical\v202\api\python
) 下的lumopt
文件夹中的__init__.py
文件,将其中的 Python api 路径设为所安装的 Lumerical 的 Python api 路径:
default_api_path = '/Program Files/Lumerical/v202/api/python'
- 将所安装的 Lumerical 的 Python api 路径 (如
C:\Program Files\Lumerical\v202\api\python
) 下的lumopt
文件夹中除__init__.py
文件外的所有文件复制到 Python 的 lumopt 安装路径 (python_path\Lib\site-packages\LumOpt-0.0.1-py3.7.egg\lumopt
) 下 (覆盖). - 将所安装的 Lumerical 的 Python api 路径 (如
C:\Program Files\Lumerical\v202\api\python
) 下的lumapi.py
文件中的interopapi.dll
替换成对应的完整路径名, 即把
INTEROPLIB = "interopapi.dll"
替换为
INTEROPLIB = INTEROPLIBDIR + "/interopapi.dll"
- Python 测试
import sys
sys.path.append("C:\\Program Files\\Lumerical\\v202\\api\\python\\") #Default windows lumapi path
import lumopt
import lumapi
若仅有提示信息而无报错, 则说明安装成功.