chriskeraly / lumopt

Python based continuous adjoint optimization wrapper for Lumerical
Other
163 stars 77 forks source link

'NotImplementedError' object is not iterable #18

Open satadrudas opened 2 years ago

satadrudas commented 2 years ago

I am trying to implement the examples for inverse design given in the lumerical website. I keep getting this error. I am using Ubuntu 22.04 Lumerical v222

CONFIGURATION FILE {'root': '/opt/lumerical/v222/api/python', 'lumapi': '/opt/lumerical/v222/api/python'} Couldn't find the file containing 2D optimization parameters. Starting with default parameters Accurate interface detection enabled Wavelength range of source object will be superseded by the global settings. /opt/lumerical/v222/api/python/lumopt/utilities/plotter.py:62: UserWarning: Matplotlib is currently using module://matplotlib_inline.backend_inline, which is a non-GUI backend, so cannot show the figure. self.fig.show() Running scipy optimizer bounds = [(0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1)] start = [0.08333333 0.14814815 0.21296296 0.27777778 0.34259259 0.40740741 0.47222222 0.53703704 0.60185185 0.66666667] RUNNING THE L-BFGS-B CODE

       * * *

Machine precision = 2.220D-16 N = 10 M = 10

At X0 0 variables are exactly at the bounds Making forward solve Making adjoint solve Running solves Processing forward solve FOM = 0.701620026173104 Processing adjoint solve Calculating gradients Getting d eps: dx = 1e-09 .......... Saved frame

At iterate 0 f= -7.01620D-01 |proj g|= 5.27778D-01 Making forward solve Making adjoint solve Running solves Processing forward solve FOM = 0.4994039732372051 Processing adjoint solve Calculating gradients Getting d eps: dx = 1e-09 .......... Making forward solve Making adjoint solve Running solves Processing forward solve FOM = 0.8723096044475441 Processing adjoint solve Calculating gradients Getting d eps: dx = 1e-09 ..........

At iterate 1 f= -8.72310D-01 |proj g|= 4.01646D-01 Saved frame

       * * *

Tit = total number of iterations Tnf = total number of function evaluations Tnint = total number of segments explored during Cauchy searches Skip = number of BFGS updates skipped Nact = number of active bounds at final generalized Cauchy point Projg = norm of the final projected gradient F = final function value

       * * *

N Tit Tnf Tnint Skip Nact Projg F 10 1 3 4 0 3 4.016D-01 -8.723D-01 F = -0.872309604447544

STOP: TOTAL NO. of ITERATIONS REACHED LIMIT
Number of FOM evaluations: 1 FINAL FOM = [0.8723096] FINAL PARAMETERS = [3.08237291e-07 3.27586867e-07 3.07827661e-07 3.20648052e-07 3.48799264e-07 4.93115432e-07 5.70768702e-07 5.90978454e-07 5.88921615e-07 5.59012317e-07] Traceback (most recent call last): File "/home/satadrudas/lumerical_files/360042305274-inverse-design-of-y-branch/y_branch_opt_2D.py", line 127, in results = opt.run() File "/opt/lumerical/v222/api/python/lumopt/optimization.py", line 582, in run self.optimizer.run() File "/opt/lumerical/v222/python/lib/python3.9/contextlib.py", line 126, in exit next(self.gen) File "/opt/lumerical/v222/python/lib/python3.9/site-packages/matplotlib/animation.py", line 253, in saving self.finish() File "/opt/lumerical/v222/api/python/lumopt/utilities/plotter.py", line 30, in finish return super().finish() File "/opt/lumerical/v222/python/lib/python3.9/site-packages/matplotlib/animation.py", line 518, in finish self._run() File "/opt/lumerical/v222/python/lib/python3.9/site-packages/matplotlib/animation.py", line 346, in _run cbook._pformat_subprocess(command)) File "/opt/lumerical/v222/python/lib/python3.9/site-packages/matplotlib/cbook/init.py", line 2177, in _pformat_subprocess else " ".join(shlex.quote(os.fspath(arg)) for arg in command)) TypeError: 'NotImplementedError' object is not iterable

Driss-001 commented 3 weeks ago

Animation is outdated, you need to rewrite the Filemoviewriter to a compatible one, by using matplotlib earlier versions, or skip the optimisation animation.