Coder Social home page Coder Social logo

spins-b's People

Contributors

jesselu avatar joamatab avatar jskarda avatar ludi1001 avatar nvsapra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spins-b's Issues

calculated coupling efficiency spectrum

Is there any simple way to calculate and plot the coupling efficiency spectrum for the optimum configuration? From example, from 1400 to 1600 nm with a step of 10 nm? Thank you!

OSError in 3D

Hi,

I modified wdm2.py as SIM_2D=False, trying to test 3D solver of maxwell-b but it yields an OSerror message. The message is shown below.
Briefly, it looks like maxwell-b makes some scratch file, while python3 from spins-b cannot(?) open it - should read, not create.

Will there be any way to fix this? Or if you have different examples for 3D test, it would be helpful.

Thanks,

Byoungseon

PS. Error message shown below.

[2019-06-18 13:12:37,387][INFO][solver][run_plan] Setting up workspace.
[2019-06-18 13:12:37,389][INFO][solver][run_plan] Running transformation opt_cont0.
/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/scipy/sparse/data.py:71: ComplexWarning: Casting complex values to real discards the imaginary part
self._deduped_data().astype(dtype, casting=casting, copy=copy),
/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/scipy/sparse/data.py:71: ComplexWarning: Casting complex values to real discards the imaginary part
self._deduped_data().astype(dtype, casting=casting, copy=copy),
Traceback (most recent call last):
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/h5py/_hl/files.py", line 119, in make_fid
fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 78, in h5py.h5f.open
OSError: Unable to open file (file signature not found)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/h5py/_hl/files.py", line 122, in make_fid
fid = h5f.open(name, h5f.ACC_RDONLY, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 78, in h5py.h5f.open
OSError: Unable to open file (file signature not found)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "jeonb.py", line 298, in
main()
File "jeonb.py", line 61, in main
problem_graph.run_plan(plan, ".")
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/spins/invdes/problem_graph/solver.py", line 61, in run_plan
work.run(transformation_param, event_data)
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/spins/invdes/problem_graph/workspace.py", line 134, in run
transform(self.get_object(node.parametrization), event_data)
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/spins/invdes/problem_graph/creator_opt.py", line 80, in call
self._start(param)
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/spins/invdes/problem_graph/creator_opt.py", line 109, in _start
monitor_list=self.monitor_lists.start_monitors)
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/spins/invdes/problem_graph/workspace.py", line 345, in write
[self._work.get_object(mon) for mon in monitor_list], param)
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/spins/invdes/problem/graph_executor.py", line 87, in eval_fun
_eval_fun_vals(fun_vals, fun_map, graph, top_sorted_nodes, param)
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/spins/invdes/problem/graph_executor.py", line 179, in eval_fun_vals
for node
, node_val in zip(heavy_node_block, heavy_node_vals):
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/concurrent/futures/_base.py", line 586, in result_iterator
yield fs.pop().result()
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/concurrent/futures/_base.py", line 425, in result
return self.__get_result()
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/spins/invdes/problem/graph_executor.py", line 175, in
heavy_node_vals = executor.map(lambda args: _eval_fun(*args),
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/spins/invdes/problem/graph_executor.py", line 122, in _eval_fun
return fun_map[node].eval(input_vals)
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/spins/invdes/problem_graph/creator_em.py", line 230, in eval
return self._simulate(input_val[0])
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/spins/invdes/problem_graph/creator_em.py", line 293, in _simulate
bloch_vec=self._bloch_vector,
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/spins/fdfd_solvers/maxwell.py", line 373, in solve
with h5py.File(file_prefix + 'r') as f:
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/h5py/_hl/files.py", line 269, in init
fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
File "/usr/nic/apps/python_data_analytics/3.6.3/lib/python3.6/site-packages/h5py/_hl/files.py", line 124, in make_fid
fid = h5f.create(name, h5f.ACC_EXCL, fapl=fapl, fcpl=fcpl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 98, in h5py.h5f.create
OSError: Unable to create file (unable to open file: name = '/tmp/jeonb/tmpzlwjit5z/maxwell-20190618-131257-515633c0-91ec-11e9-94cd-70106fbc3864.E_xr', errno = 17, error message = 'File exists', flags = 15, o_flags = c2)

Optimization of complex value

Hello,

I am designing a 4-port photonic circuit element using spins, where the incident power is distributed evenly across all 4 ports. I have achieved decent power splitting by optimizing for either magnitude or power. However, I would like the phase at each port monitor to be 0 for ports 2-4 and ฯ€ for the input port.
I have tried simulating this by making each objective equal to optplan.abs(sqrt(1/2)-port_field)**2 but that does not seem to work. Ideally, I would like the s-parameters S21 S31 S41 all to be sqrt(1/2) + 0j and the S11 parameter to be -sqrt(1/2) + 0j. That way when I take the power I get 0.25 with 0 phase shift.

How might I go about this?

Thank you,
Anthony

Grating example - stops iterations at 100

When I use grating example code and change the number of continuous iterations to 100, then for some reasons it stops discrete iterations at 2 - please see attached screenshots of terminal and results from view command. Seems to be too far from optimum :)
Screenshot 2019-07-26 12 42 28
100 iter

Bend90.py 3D simulation broken?

I am able to run the 2D version of bend90 perfectly fine, but it results in an error when ran as a 3D sim (maxwell solver server is up and running of course). Here is the output I get:
image

Note that our cluster's installation of spins-b-maxwell was through singularity rather than docker. I've brought this up to our HPC staff to see if they had any insight, and they recommended that I open an issue here since the simulations break only when the 3Dsim boolean is set to true. Any help is appreciated, thank you!

wdm2 example: Is it correct to use effective index method with topology optimization?

Hi,

I have some doubts about using the effective index method (EIM) to simulate a structure that is not slowly varying in the x-y plane. As I understand it, to use the EIM approximation the mode profile should be slowly varying in the y-direction which I believe is not the case here?

Also, I have been trying to validate the example with Lumerical 3D FDTD and 2.5D (EIM-based) FDTD and the results are totally different from spins-b's. I have used the same configurations as in the spins-b code. Any advice would be appreciated.

Thanks in advance.

Update: I should have used Lumerical 2D FDTD not 2.5D or 3D for validation. My question is, should this output be the input to the 3D optimization?

Composite Parametrization

I am struggling to get a composite parametrization to work:
Unfortunately there is not much documentation on it, so what I tried so far was to create two dummy simspaces (actually you would only need the design space as far as I can tell, but I found no way of feeding that in directly) for the generation of the selection matices. Then I do the following:

cont_param_si = optplan.PixelParametrization(
    simulation_space=sim_spaces[1], 
    init_method=optplan.UniformInitializer(min_val=0, max_val=1))
cont_param_sin = optplan.PixelParametrization(
    simulation_space=sim_spaces[2], 
    init_method=optplan.UniformInitializer(min_val=0, max_val=1))

to create two paramtrizations and

cont_param_comp = optplan.CompositeParametrization(param_list=[cont_param_si, cont_param_sin])

which does not throw an error at first, but when I add it to the transformation list and execute the optplan I run into the following problem:

[2021-02-23 11:02:36,224][INFO][solver][run_plan] Setting up workspace.
[2021-02-23 11:02:36,226][INFO][solver][run_plan] Running transformation opt_cont.
<path-to-spins>/spins-env/lib/python3.6/site-packages/scipy/sparse/data.py:72: ComplexWarning: Casting complex values to real discards the imaginary part
  self._deduped_data().astype(dtype, casting=casting, copy=copy),
Traceback (most recent call last):
  File "spins-b/examples/invdes/grating_coupler_bilayer/grating.py", line 747, in <module>
    run_opt(args.save_folder+"({})".format(i), grating_len=grating_len, wg_width=wg_width, wlength=cfg[0], angle_theta=cfg[1])
  File "spins-b/examples/invdes/grating_coupler_bilayer/grating.py", line 88, in run_opt
    problem_graph.run_plan(plan, ".", save_folder=save_folder)
  File "<path-to-spins>/spins-env/lib/python3.6/site-packages/spins/invdes/problem_graph/solver.py", line 61, in run_plan
    work.run(transformation_param, event_data)
  File "<path-to-spins>/spins-env/lib/python3.6/site-packages/spins/invdes/problem_graph/workspace.py", line 134, in run
    transform(self.get_object(node.parametrization), event_data)
  File "<path-to-spins>/spins-env/lib/python3.6/site-packages/spins/invdes/problem_graph/workspace.py", line 198, in get_object
    self._objects[node.name] = creator(node, self)
  File "<path-to-spins>/spins-env/lib/python3.6/site-packages/spins/invdes/problem_graph/optplan/__init__.py", line 56, in not_implemented
    "Node type has no creator implemented: {}".format(node_type))
NotImplementedError: Node type has no creator implemented: parametrization.composite

AttributeError

Hello, the python 3.7 prompted a error 'AttributeError: module 'spins.invdes.problem_graph.optplan' has no attribute 'BicubicLevelSetParametrization'', when I ran your example that called bend90. Normally, this package should be complete and error-free and I want to know what caused the error. Thanks

Verification of Example wdm2.py in Lumerical FDTD

Hi,

Is there a specific way of verifying this on Lumerical or possible might be me having trouble in my setup, but when I run wdm2.py example without touching anything and importing the output gds file on Lumerical FDTD and then importing default sim_bg.gds from /spins-b/examples/invdes/wdm2, and then finally simulate it as in wdm2.py (applying a source just like the one in the code), I do not observe the same result as in the output monitors of Spins. Rather, when I apply 1300 and 1550nm I always get high power out of the upper arm of it, but simply nothing is ejected through the lower arm.

Is that possible that I may be having a wrong setup, or is that possible that we need to change stuff from wdm2.py to obtain an output just like in the Spins monitors (of the default Github clone)

Robustness optimization

Would it be possible to include robustness against process variations in the optimization?

broadband optimization - please add del (ratio) function to optplan

I am playing with broadband optimization of grating coupler, i.e., in order to get a reasonable efficiency values for selected wavelengths (1400, 1450, 1500, 1550, 1600 nm). It seems that the final result depends very much on how the objective is defined. In wdm example it defines it as simply a sum for different wavelengths:
obj = (1-P_1400)^2 + (1-P_1450)^2 + ... + (1-P_1600)^2
However, in such way it seems that some wavelengths are sacrificed in favor of others (i.e., instead of providing a flat efficiency at all wavelength, it gives configuration with very low efficiency for one/few wavelengths and high efficiency for another wavelength(s)).
In order to get more flat response (at least to avoid strong drops in efficiency), I use product for objective:
obj = (1-P_1400) * (1-P_1450) * ... * (1-P_1600)
This seems to work to some extent, but I also thought that it could be useful to define objective in a way that it changes faster for low P and slow for high P. Such behavior can be done by defining objective in a following (reciprocal or inverted) way:
obj = 1/(A+P_1400) + 1/(A+P_1450) + ... + 1/(A+P_1600),
where A is a free parameter to define threshold (for example, assume A = 0.5, corresponding to the efficiency of 50%).
However, when I type the above expression in the script code, it doesn't work, because P is a special data type 'power', and division is not defined for it. As I can see, basic operations for 'power' are defined in spins/invdes/problem_graph/optplan/schema_function.py. Could you please add divide function to it?

Error when optimizing over goos.Cuboid variable.

Hi,

First of all, thanks to all of you for making this codebase open-source. It really is awesome to not have to go about reinventing this particular wheel.

I am interested in optimizing grating efficiency over the z-position of a reflective buried layer (in addition to a standard barcode grating optimization). I attempted to do this by inserting a 3-vector goos.Variable into the goos.Cuboid that is the reflective buried layer. However, when running the simulation, I receive errors similar to ValueError: 0-th dimension must be fixed to 489 but got 487. After some digging, I determined that a 3-vector from my variable is appended to the initial_val list (as expected), whereas the grad(x) list is given a 1-vector from my variable (see spins/goos/optimize.py:run()). Hence the error, as scipy.optimize.minimize gets confused when trying to apply a N+1-long Jacobian to a N+3-long vector. At this point, I wasn't sure if goos.Cuboids hadn't been fully-implemented in goos or if I was using something incorrectly, so I would appreciate any insight. It is possible that I'm initializing the goos.Variable incorrectly or something.

One can test out this issue easily by editing a line or two in the substrate variable from the examples/goos/grating_1d example (in this example, the z-position of the substrate isn't super critical for grating optimization, but it illustrates the issue). The different variants that I tried included:

  • Original code (works):
substrate = goos.Cuboid(
    pos=goos.Constant([
        params.coupler_len / 2, 0,
        -params.box_size - params.wg_thickness / 2 - 5000
    ]),
    extents=goos.Constant([params.coupler_len + 10000, 1000, 10000]),
    material=goos.material.Material(index=params.eps_wg))
  • Turning extents into a 3-vector goos.Variable (fails):
substrate = goos.Cuboid(
    pos=goos.Constant([
        params.coupler_len / 2, 0,
        -params.box_size - params.wg_thickness / 2 - 5000
    ]),
    extents=goos.Variable([params.coupler_len + 10000, 1000, 10000]),
    material=goos.material.Material(index=params.eps_wg))
  • Adding a 3-vector goos.Variable to extents (fails):
substrate = goos.Cuboid(
    pos=goos.Constant([
        params.coupler_len / 2, 0,
        -params.box_size - params.wg_thickness / 2 - 5000
    ]),
    extents=goos.Constant([params.coupler_len + 10000, 1000, 10000]) + goos.Variable([0, 0, 0]),
    material=goos.material.Material(index=params.eps_wg))
  • Multiplying extents by a 1-vector goos.Variable (fails):
substrate = goos.Cuboid(
    pos=goos.Constant([
        params.coupler_len / 2, 0,
        -params.box_size - params.wg_thickness / 2 - 5000
    ]),
    extents=goos.Variable(1) * goos.Constant([params.coupler_len + 10000, 1000, 10000]),
    material=goos.material.Material(index=params.eps_wg))
  • Variations of the above with upper and lower bounds included on the goos.Variable (fails).
  • Variations of the above that try to change pos rather than extents [although the code of goos.CuboidFlow seems to imply that one should make extents that goos.Variable, not pos?] (fails).

Thanks much for any help!

Non-uniform grid version

Can we run the simulation with nonuniform grid? When I read the code I found maybe the simspace.py have not be complated.

Grating example

I am trying to run your example but it is resulting in an error.
Any idea what to do?

Microsoft Windows [Version 10.0.17134.765]
(c) 2018 Microsoft Corporation. Alle Rechte vorbehalten.

C:\GitRepos\spins-b\spins_env\Scripts>activate
Parameterformat falsch - 850.

(spins_env) C:\GitRepos\spins-b\spins_env\Scripts>cd ..

(spins_env) C:\GitRepos\spins-b\spins_env>cd ..

(spins_env) C:\GitRepos\spins-b>cd examples

(spins_env) C:\GitRepos\spins-b\examples>cd grating_coupler

(spins_env) C:\GitRepos\spins-b\examples\grating_coupler>python test_grating.py
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 114, in _main
    prepare(preparation_data)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 225, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
    run_name="__mp_main__")
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 263, in run_path
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 114, in _main
    prepare(preparation_data)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 225, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
    run_name="__mp_main__")
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
    pkg_name=pkg_name, script_name=fname)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\GitRepos\spins-b\examples\grating_coupler\test_grating.py", line 4, in <module>
    import grating
  File "C:\GitRepos\spins-b\examples\grating_coupler\grating.py", line 21, in <module>
    from spins.invdes import problem_graph
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\__init__.py", line 2, in <module>
    from spins.invdes.problem_graph.creator import *
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator.py", line 2, in <module>
    from spins.invdes.problem_graph import creator_em
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator_em.py", line 21, in <module>
    local_matrix_solvers.DirectSolver())
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\fdfd_solvers\local_matrix_solvers.py", line 108, in __init__
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    exec(code, run_globals)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 105, in spawn_main
  File "C:\GitRepos\spins-b\examples\grating_coupler\test_grating.py", line 4, in <module>
    self.pool = multiprocessing.Pool(num_processes)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
    import grating
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 119, in Pool
    exitcode = _main(fd)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 114, in _main
  File "C:\GitRepos\spins-b\examples\grating_coupler\grating.py", line 21, in <module>
    from spins.invdes import problem_graph
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\__init__.py", line 2, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 114, in _main
    prepare(preparation_data)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 225, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
    from spins.invdes.problem_graph.creator import *
    prepare(preparation_data)
    context=self.get_context())
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator.py", line 2, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 225, in prepare
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 176, in __init__
    run_name="__mp_main__")
    from spins.invdes.problem_graph import creator_em
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator_em.py", line 21, in <module>
    local_matrix_solvers.DirectSolver())
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\fdfd_solvers\local_matrix_solvers.py", line 108, in __init__
    self.pool = multiprocessing.Pool(num_processes)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 119, in Pool
    context=self.get_context())
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 176, in __init__
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\GitRepos\spins-b\examples\grating_coupler\test_grating.py", line 4, in <module>
    self._repopulate_pool()
    _fixup_main_from_path(data['init_main_from_path'])
    self._repopulate_pool()
    import grating
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 241, in _repopulate_pool
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 241, in _repopulate_pool
    run_name="__mp_main__")
    w.start()
  File "C:\GitRepos\spins-b\examples\grating_coupler\grating.py", line 21, in <module>
    w.start()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 263, in run_path
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\process.py", line 112, in start
    from spins.invdes import problem_graph
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\__init__.py", line 2, in <module>
    pkg_name=pkg_name, script_name=fname)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\GitRepos\spins-b\examples\grating_coupler\test_grating.py", line 4, in <module>
    from spins.invdes.problem_graph.creator import *
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator.py", line 2, in <module>
    import grating
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\process.py", line 112, in start
    from spins.invdes.problem_graph import creator_em
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator_em.py", line 21, in <module>
  File "C:\GitRepos\spins-b\examples\grating_coupler\grating.py", line 21, in <module>
    local_matrix_solvers.DirectSolver())
    self._popen = self._Popen(self)
    self._popen = self._Popen(self)
    from spins.invdes import problem_graph
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\fdfd_solvers\local_matrix_solvers.py", line 108, in __init__
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 322, in _Popen
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 322, in _Popen
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\__init__.py", line 2, in <module>
    self.pool = multiprocessing.Pool(num_processes)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 119, in Pool
    return Popen(process_obj)
    from spins.invdes.problem_graph.creator import *
    return Popen(process_obj)
    context=self.get_context())
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\popen_spawn_win32.py", line 33, in __init__
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator.py", line 2, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\popen_spawn_win32.py", line 33, in __init__
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 176, in __init__
    self._repopulate_pool()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 241, in _repopulate_pool
    w.start()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\process.py", line 112, in start
    from spins.invdes.problem_graph import creator_em
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator_em.py", line 21, in <module>
    local_matrix_solvers.DirectSolver())
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\fdfd_solvers\local_matrix_solvers.py", line 108, in __init__
    self._popen = self._Popen(self)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 322, in _Popen
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
    return Popen(process_obj)
    prep_data = spawn.get_preparation_data(process_obj._name)
    self.pool = multiprocessing.Pool(num_processes)
    _check_not_importing_main()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\popen_spawn_win32.py", line 33, in __init__
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 119, in Pool
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
    prep_data = spawn.get_preparation_data(process_obj._name)
    _check_not_importing_main()
    context=self.get_context())
    is not going to be frozen to produce an executable.''')
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 176, in __init__
    is not going to be frozen to produce an executable.''')

  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
    self._repopulate_pool()
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 241, in _repopulate_pool
    w.start()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\process.py", line 112, in start
    self._popen = self._Popen(self)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\popen_spawn_win32.py", line 33, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
    _check_not_importing_main()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
    is not going to be frozen to produce an executable.''')
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
    _check_not_importing_main()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
    is not going to be frozen to produce an executable.''')
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 114, in _main
    prepare(preparation_data)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 225, in prepare
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 114, in _main
    prepare(preparation_data)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 225, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
    run_name="__mp_main__")
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 96, in _run_module_code
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 105, in spawn_main
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
    exitcode = _main(fd)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 114, in _main
    run_name="__mp_main__")
    exec(code, run_globals)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 263, in run_path
  File "C:\GitRepos\spins-b\examples\grating_coupler\test_grating.py", line 4, in <module>
    prepare(preparation_data)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 225, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 105, in spawn_main
    pkg_name=pkg_name, script_name=fname)
    import grating
    run_name="__mp_main__")
    exitcode = _main(fd)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 96, in _run_module_code
  File "C:\GitRepos\spins-b\examples\grating_coupler\grating.py", line 21, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 263, in run_path
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 114, in _main
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
    pkg_name=pkg_name, script_name=fname)
    prepare(preparation_data)
    from spins.invdes import problem_graph
    exec(code, run_globals)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 96, in _run_module_code
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 225, in prepare
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\__init__.py", line 2, in <module>
  File "C:\GitRepos\spins-b\examples\grating_coupler\test_grating.py", line 4, in <module>
    mod_name, mod_spec, pkg_name, script_name)
    _fixup_main_from_path(data['init_main_from_path'])
    from spins.invdes.problem_graph.creator import *
    import grating
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
    exec(code, run_globals)
    run_name="__mp_main__")
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 263, in run_path
  File "C:\GitRepos\spins-b\examples\grating_coupler\test_grating.py", line 4, in <module>
  File "C:\GitRepos\spins-b\examples\grating_coupler\grating.py", line 21, in <module>
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator.py", line 2, in <module>
    pkg_name=pkg_name, script_name=fname)
    import grating
    from spins.invdes import problem_graph
    from spins.invdes.problem_graph import creator_em
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator_em.py", line 21, in <module>
  File "C:\GitRepos\spins-b\examples\grating_coupler\grating.py", line 21, in <module>
    local_matrix_solvers.DirectSolver())
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\fdfd_solvers\local_matrix_solvers.py", line 108, in __init__
    from spins.invdes import problem_graph
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\__init__.py", line 2, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 96, in _run_module_code
    self.pool = multiprocessing.Pool(num_processes)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 119, in Pool
    from spins.invdes.problem_graph.creator import *
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator.py", line 2, in <module>
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\__init__.py", line 2, in <module>
    context=self.get_context())
    mod_name, mod_spec, pkg_name, script_name)
    from spins.invdes.problem_graph import creator_em
    from spins.invdes.problem_graph.creator import *
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 176, in __init__
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator_em.py", line 21, in <module>
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator.py", line 2, in <module>
    self._repopulate_pool()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 241, in _repopulate_pool
    local_matrix_solvers.DirectSolver())
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\fdfd_solvers\local_matrix_solvers.py", line 108, in __init__
    exec(code, run_globals)
  File "C:\GitRepos\spins-b\examples\grating_coupler\test_grating.py", line 4, in <module>
    from spins.invdes.problem_graph import creator_em
    self.pool = multiprocessing.Pool(num_processes)
    w.start()
    import grating
  File "C:\GitRepos\spins-b\examples\grating_coupler\grating.py", line 21, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 119, in Pool
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\process.py", line 112, in start
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator_em.py", line 21, in <module>
    from spins.invdes import problem_graph
    context=self.get_context())
    self._popen = self._Popen(self)
    local_matrix_solvers.DirectSolver())
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\__init__.py", line 2, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 176, in __init__
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 322, in _Popen
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\fdfd_solvers\local_matrix_solvers.py", line 108, in __init__
    self.pool = multiprocessing.Pool(num_processes)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 119, in Pool
    return Popen(process_obj)
    from spins.invdes.problem_graph.creator import *
    self._repopulate_pool()
    context=self.get_context())
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\popen_spawn_win32.py", line 33, in __init__
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator.py", line 2, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 241, in _repopulate_pool
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 176, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
    from spins.invdes.problem_graph import creator_em
    w.start()
    self._repopulate_pool()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator_em.py", line 21, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\process.py", line 112, in start
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 241, in _repopulate_pool
    _check_not_importing_main()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
    self._popen = self._Popen(self)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 322, in _Popen
    local_matrix_solvers.DirectSolver())
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\fdfd_solvers\local_matrix_solvers.py", line 108, in __init__
    w.start()
    is not going to be frozen to produce an executable.''')
    return Popen(process_obj)
    self.pool = multiprocessing.Pool(num_processes)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\process.py", line 112, in start
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\popen_spawn_win32.py", line 33, in __init__
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 119, in Pool
    self._popen = self._Popen(self)

    prep_data = spawn.get_preparation_data(process_obj._name)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
    _check_not_importing_main()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\popen_spawn_win32.py", line 33, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
    context=self.get_context())
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 176, in __init__
    self._repopulate_pool()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 241, in _repopulate_pool
    _check_not_importing_main()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
    w.start()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\process.py", line 112, in start
    is not going to be frozen to produce an executable.''')
    is not going to be frozen to produce an executable.''')
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
    self._popen = self._Popen(self)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\popen_spawn_win32.py", line 33, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
    _check_not_importing_main()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
    is not going to be frozen to produce an executable.''')
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 114, in _main
    prepare(preparation_data)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 225, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
    run_name="__mp_main__")
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\GitRepos\spins-b\examples\grating_coupler\test_grating.py", line 4, in <module>
    import grating
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 114, in _main
    prepare(preparation_data)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 225, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 114, in _main
  File "C:\GitRepos\spins-b\examples\grating_coupler\grating.py", line 21, in <module>
    from spins.invdes import problem_graph
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\__init__.py", line 2, in <module>
    prepare(preparation_data)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 225, in prepare
    run_name="__mp_main__")
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 263, in run_path
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    from spins.invdes.problem_graph.creator import *
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator.py", line 2, in <module>
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
    run_name="__mp_main__")
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 263, in run_path
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 105, in spawn_main
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
    from spins.invdes.problem_graph import creator_em
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator_em.py", line 21, in <module>
    exitcode = _main(fd)
    exec(code, run_globals)
    pkg_name=pkg_name, script_name=fname)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\GitRepos\spins-b\examples\grating_coupler\test_grating.py", line 4, in <module>
    import grating
  File "C:\GitRepos\spins-b\examples\grating_coupler\grating.py", line 21, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 114, in _main
  File "C:\GitRepos\spins-b\examples\grating_coupler\test_grating.py", line 4, in <module>
    local_matrix_solvers.DirectSolver())
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\fdfd_solvers\local_matrix_solvers.py", line 108, in __init__
    self.pool = multiprocessing.Pool(num_processes)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 119, in Pool
    context=self.get_context())
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 176, in __init__
    self._repopulate_pool()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 241, in _repopulate_pool
    prepare(preparation_data)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 225, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
    import grating
  File "C:\GitRepos\spins-b\examples\grating_coupler\grating.py", line 21, in <module>
    w.start()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\process.py", line 112, in start
    run_name="__mp_main__")
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 96, in _run_module_code
    from spins.invdes import problem_graph
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\__init__.py", line 2, in <module>
    from spins.invdes.problem_graph.creator import *
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator.py", line 2, in <module>
    from spins.invdes.problem_graph import creator_em
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator_em.py", line 21, in <module>
    local_matrix_solvers.DirectSolver())
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\fdfd_solvers\local_matrix_solvers.py", line 108, in __init__
    self._popen = self._Popen(self)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 322, in _Popen
    from spins.invdes import problem_graph
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\__init__.py", line 2, in <module>
    mod_name, mod_spec, pkg_name, script_name)
    return Popen(process_obj)
    self.pool = multiprocessing.Pool(num_processes)
    from spins.invdes.problem_graph.creator import *
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\popen_spawn_win32.py", line 33, in __init__
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 119, in Pool
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator.py", line 2, in <module>
    exec(code, run_globals)
    prep_data = spawn.get_preparation_data(process_obj._name)
    context=self.get_context())
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 176, in __init__
  File "C:\GitRepos\spins-b\examples\grating_coupler\test_grating.py", line 4, in <module>
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
    from spins.invdes.problem_graph import creator_em
    self._repopulate_pool()
    import grating
  File "C:\GitRepos\spins-b\examples\grating_coupler\grating.py", line 21, in <module>
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator_em.py", line 21, in <module>
    local_matrix_solvers.DirectSolver())
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\fdfd_solvers\local_matrix_solvers.py", line 108, in __init__
    self.pool = multiprocessing.Pool(num_processes)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 119, in Pool
    _check_not_importing_main()
    from spins.invdes import problem_graph
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\__init__.py", line 2, in <module>
    from spins.invdes.problem_graph.creator import *
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 241, in _repopulate_pool
    context=self.get_context())
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 176, in __init__
    is not going to be frozen to produce an executable.''')
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator.py", line 2, in <module>
    w.start()
    self._repopulate_pool()
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.    from spins.invdes.problem_graph import creator_em
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\process.py", line 112, in start
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 241, in _repopulate_pool

  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\invdes\problem_graph\creator_em.py", line 21, in <module>
    local_matrix_solvers.DirectSolver())
    w.start()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\process.py", line 112, in start
  File "C:\GitRepos\spins-b\spins_env\lib\site-packages\spins\fdfd_solvers\local_matrix_solvers.py", line 108, in __init__
    self.pool = multiprocessing.Pool(num_processes)
    self._popen = self._Popen(self)
    self._popen = self._Popen(self)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 119, in Pool
    context=self.get_context())
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 322, in _Popen
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\popen_spawn_win32.py", line 33, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
    _check_not_importing_main()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 176, in __init__
    self._repopulate_pool()
    is not going to be frozen to produce an executable.''')
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
    return Popen(process_obj)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\popen_spawn_win32.py", line 33, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
    _check_not_importing_main()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
    is not going to be frozen to produce an executable.''')
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\pool.py", line 241, in _repopulate_pool
    w.start()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\process.py", line 112, in start
    self._popen = self._Popen(self)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\popen_spawn_win32.py", line 33, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
    _check_not_importing_main()
  File "C:\Users\jadaf\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
    is not going to be frozen to produce an executable.''')
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

(spins_env) C:\GitRepos\spins-b\examples\grating_coupler>


GDS Generation

How do you export a gds from an optimization?
Is the "generate_polygons" parameter active anywhere or is there another method?

Grating coupler example: output gds file layer 100

Hello,

I am new to inverse design and I am still getting familiar with spins. I noticed that the output gds files layer number is 100, which in the code denotes the etched silicon layer. However, I believe that it is not etched silicon, it is silicon, shouldn't it be 101 instead?

gds layer 100

Thanks.

discretization in grating

In grating script there is a discretization parameter dx (40 nm in the provided example). But after optimization the size of elements and spacing is given with much higher precision (like 10^(-13) of nm), instead of being a multiple of dx. How can it be?
Another thing: the device Si thickness (220 nm in the example), should it be a multiple of dx?

Convert json file to gds file

Hello, I am going through the "bend90" example by colab-notebook. How can I get a gds file from the example by using the notebook? Currently I get the json file after running the codes. The picture is the code that I am trying to get the gds file but it shows an error "ValueError: Unknown node, got node type 'goos.function.constant' with metatype 'NodeMetaType.OPTPLAN_NODE' "
Capture

grating coupling - how about plasmonic structures?

I am wondering, whether it is possible to implement the script in order to optimize the grating for plasmonic waveguide? For example, for the simplest case with semi-infinite metal (gold) and air above. As it is now, there is a fixed discretization size which wouldn't work for metal (the mesh size should be much smaller inside the metal). Maybe the negative epsilon of metal will be another issue...

Some problems with data display

Hello,sir. I'm sorry to trouble you. I re-run the wdm2 file, but I interrupted during the optimization process. And then I used the method called Option 1: Using a monitor specification file to plot the data. At this moment, an error called Keyerror:event:stage prompted. Is this error happened because the data that has not been completely optimized overwrites the previous data in the file "monitor_spec.yml"? Is this error caused by incomplete data? For each kind of simulation, do monitor_spec.yml need to be created manually and the content corresponds to the monitors of the simulation?๏ผŸ

Phase objective in goos

Hello,

I'm trying to transition my code from invdes to goos. Goos seems very powerful, and I understand why you are moving towards this being the main engine of spins.

How do I define a complex value as the objective for an overlap? I'm trying obj = goos.abs((1+0j) - sim["Overlap"])**2 and I get "ValueError: Error encountered when validating node goos.function.constant.16."

Also, how do I define the substrate material? Or is it always assumed to be SiO2? I want to make sure I'm not simulating a waveguide floating in air.

Thank you,
Anthony

levelset_parametrization missing from repo

Hello,

I'm trying to see how a Hermite level set parametrization works on my design, but I'm met with "ImportError: cannot import name 'levelset_parametrization.'" I found there is no levelset_parametrization.py file in spins.invdes.parametrization. Could someone please add it to the repository so I can try it out?

Thank you!

extract grating widths after optimization

I run an optimization for a 220nm height (70nm etch), and I get a result

10*np.log10(0.61) = -2.14 dB

which makes sense (on Lumerical I get slightly better result)

How can i extract the widths of the different grating widths after optimization?

with open("./save-folder/step255.pkl", "rb") as fp:
data = pickle.load(fp)
print(data['parametrization'])

what does this parametrization mean? It should be an array of interleaved withs, gaps

{'vector': array([ 5. , 8.98772728, 12.97674666, 15.47738019,
20.20773896, 24.99917227, 27.99609812, 30.50119184,
33.00119184, 42.19753236, 44.99641153, 55.91701248,
59.12187749, 68.86095872, 73.17755064, 82.70590249,
86.96690846, 95.97138631, 102.63545175, 109.62749898,
116.47864432, 123.99428874, 131.28258405, 138.13824982,
145.8695731 , 152.43608324, 160.00187742, 166.88243873,
174.27293068, 181.25168036, 188.99850018, 195.08167309,
203.00287036, 209.50210436, 217.99906239, 222.00578535,
224.50578535, 227.00578535, 232.00122492, 236.9989287 ,
239.4989287 , 241.9989287 , 246.00969753, 251.00078296,
253.50078296, 256.00078296, 261.00022745, 265.49581954,
267.99581954, 270.49581954, 275.00007453, 279.38741164,
281.99991055, 285.00023287, 288.5 , 291. ,
293.5 , 296. ])}

3D GDS Usage

Hi,

At my first 3D inverse design wdm2 trial, I obtain the following with sim_fg and bg integrated as other layers on it.
gds_output

At this stage, I am using my laptop to run 3D simulation, so I wanted to ask a few questions beforehand:

First question (which I am about to check from the code, but just wanted make sure): I just changed SIM_2D as False for 3D computation and as I have not changed inside of simulation area, I guess I am having this inconsistency with input GDS, am I right?

and

Second question is, is that possible to easily produce these GDS files for your example of TE-TM splitter (if so, would you give a clue, where to focus on)? Plus, is that possible to obtain 3D view graphics as you do in your articles? I am posting the example you posted on your website below:

te-tm

Thank you in advance,

Bera

unable to import compat

When importing the different folders to start creating my own model i get the following error message;

" Node with name {} already registered.".format(node_name))

ValueError: Node with name goos.log_print already registered.

This message already arises before defining any functions just at the start where you import the required folders and packages. Does anyone has the same issue, or know how to solve this?

Error in 3D (maxwell_solver)

Hi, I was trying to run the simulation in 3D using maxwell solver.

I believe I installed everything I needed using docker

If I use the command ./run_docker

Sending build context to Docker daemon 8.21MB
Step 1/11 : FROM nvidia/cuda:10.0-devel
---> 4f27098b903a
Step 2/11 : RUN apt-get update && apt-get install -y python3-pip python3-setuptools libhdf5-serial-dev mpich
---> Using cache
---> 6f8d988da953
Step 3/11 : RUN pip3 install virtualenv
---> Using cache
---> b1ed52d61ffa
Step 4/11 : RUN virtualenv -p python3 pyenv
---> Using cache
---> f0c5053f5b44
Step 5/11 : RUN /pyenv/bin/pip3 install numpy
---> Using cache
---> 29c83a9b2799
Step 6/11 : RUN /pyenv/bin/pip3 install pycuda jinja2 h5py mpi4py
---> Using cache
---> e15e5fd823dd
Step 7/11 : RUN /pyenv/bin/pip3 install scipy
---> Using cache
---> 7363996a21b1
Step 8/11 : WORKDIR /app
---> Using cache
---> 9459b0f00248
Step 9/11 : COPY . /app
---> Using cache
---> 49bdc42b7524
Step 10/11 : EXPOSE 9041
---> Using cache
---> 5ba51435ff0e
Step 11/11 : CMD ["./start_maxwell_docker"]
---> Using cache
---> c6f37026bb95
Successfully built c6f37026bb95
Successfully tagged maxwell:latest
a1cf37e56d37fc962e17c40c7c40b2e5e4fba49a0d29b71e256e67e062ae41a5

It finishes without showing me an error.
However, It seems the solver is still not active when I actually run the code.
Could I have any suggestions on this?

the shell code below is the error I got (there are a bunch of them but they are all Errno 111)

[2020-10-21 19:24:56,781][INFO][optplan][run] Running action 1 (opt_cont4).
/home/sc/.pyenv/versions/spins/lib/python3.7/site-packages/numpy/core/fromnumeric.py:87: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
/home/sc/.pyenv/versions/spins/lib/python3.7/site-packages/scipy/sparse/data.py:72: ComplexWarning: Casting complex values to real discards the imaginary part
self._deduped_data().astype(dtype, casting=casting, copy=copy),
[2020-10-21 19:25:08,810][ERROR][maxwell][upload_files] ConnectionError during upload: maxwell-20201021-192508-a8796646-13f4-11eb-9287-0cc47a57b1c7.e_xi
Traceback (most recent call last):
File "/home/sc/.pyenv/versions/spins/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/home/sc/.pyenv/versions/spins/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/home/sc/.pyenv/versions/spins/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

Thank you in advance!
Mark

Overlap Phase Monitor

Having a blast over here using spins! I've looked through the optplan and schema docs trying to find a function that looks like it would yield phase information for a given port (like arg() or angle()). I imagine it's one of the 'scalar' or 'constant' functions but I'm not certain. Could someone please advise on how to obtain magnitude and phase at a given overlap monitor, rather than just power?

Thanks!

Can't run bend90 .ipynb on Google driver

Hi,

I followed the recommended Spin package process to upload the folder to the Google driver.But while running the code block, there was an error with no Spin package and other errors.

image

image

I'm a beginner. Thank you for your help

3D optimization

Hello, this is a great program, and I want to test, but there are some problems.
Can this be designed in 3D? If this can be done, what should I do?
I tried to change the variable SIM_2D to False, but something went wrong with the program.
Thanks.

Polarization Conversion and Non-Squared Design Area

Hi, I have two short questions,

1-) I am trying a simple polarization conversion from Mode 0 to Mode 1 out of the example wdm2.py (also tried vice-versa) and SPINS directly puts 6 iterations, extracting a design.gds, which has not design at all (although it terminal says Spins finished, no bending in the final output).

Why would that happen? Isn't that possible to do such a thing out of SPINS?

2-) I am changing the design area of foreground.gds and trying to make the design area different than a square. When I start the simulation, it comes nearly to the end and gives an error something like "the x dimension (101) does not match z dimension (102)"

It never happens when I make the area square, so I am suspicious that the design area has to be square at all times. Would you agree with me? If not, is there a way I may workaround this problem?

Thank you so much in advance

confusement in description

in the description it says:
Requirements: Python 3.5+
and then:
Installation: $ pip install ./spins-b

Shouldn't it be pip3 instead? I know it is obvious for usual Linux users, but for noobs like me who installed Linux on virtual mashine just to run spins it took a while to realize that there are two pythons and I need to properly write it as pip3

grating example - why first gap is fixed?

I am wondering, why in all my optimizations the first gap (i.e., between waveguide and first grating element) is fixed and equals 2*minimum feature size (i.e., 200 nm for default feature size of 100 nm)? It might be first guess for the gap, but it never happens to be changed, even after 300 iterations...

h5py problem

Hi,

I am trying to solve 3D within spins-b/invdes example of wdm2.py on Ubuntu.

However it gives H5PY error, which I tried many things to overcome, but couldn't and finally writing here in need of an answer. I started Maxwell servers with the ./start_maxwell example and their logs are just fine as till I give "python3 wdm2.py" command from another terminal:

simserver.log:
[2020-05-13 03:54:42,057][INFO][simserver][main] Solver directory set to /home/iclibera/Downloads/maxwell-b-master/maxwell-server/maxwell-solver/
[2020-05-13 03:54:42,091][INFO][simserver][main] Number of GPUs detected on system: 1
[2020-05-13 03:54:42,091][INFO][simserver][main] Number of GPUs used per solve: 1
[2020-05-13 03:54:42,091][INFO][simserver][main] Ready to accept simulations.
[2020-05-13 03:55:21,642][INFO][simserver][main] Solving 127.0.0.1:maxwell-20200513-035519-6ad799e8-94b4-11ea-9d77-1831bf1f80db as simulation 0
[2020-05-13 03:55:24,678][INFO][simserver][main] Simulation 0 ended with code 1
[2020-05-13 03:55:25,195][INFO][simserver][main] Solving 127.0.0.1:maxwell-20200513-035519-6ad9366e-94b4-11ea-8cf1-ab50cbd49ffb as simulation 0
[2020-05-13 03:55:28,230][INFO][simserver][main] Simulation 0 ended with code 1

webserver.py:
Serving at ('', 9041)

the output of the other terminal is as follows:
user@user:~/Downloads/spins-b/examples/invdes/wdm2$ python3 wdm2.py
[2020-05-13 03:55:04,036][INFO][solver][run_plan] Setting up workspace.
[2020-05-13 03:55:04,036][INFO][solver][run_plan] Running transformation opt_cont0.
/home/linuxbrew/.linuxbrew/Cellar/python/3.7.7_1/lib/python3.7/site-packages/scipy/sparse/data.py:74: ComplexWarning: Casting complex values to real discards the imaginary part
self._deduped_data().astype(dtype, casting=casting, copy=copy),
/home/linuxbrew/.linuxbrew/Cellar/python/3.7.7_1/lib/python3.7/site-packages/scipy/sparse/data.py:74: ComplexWarning: Casting complex values to real discards the imaginary part
self._deduped_data().astype(dtype, casting=casting, copy=copy),
/home/linuxbrew/.linuxbrew/Cellar/python/3.7.7_1/lib/python3.7/site-packages/scipy/sparse/data.py:74: ComplexWarning: Casting complex values to real discards the imaginary part
self._deduped_data().astype(dtype, casting=casting, copy=copy),
../../../spins/fdfd_solvers/maxwell.py:378: H5pyDeprecationWarning: The default file mode will change to 'r' (read-only) in h5py 3.0. To suppress this warning, pass the mode you need to h5py.File(), or set the global default h5.get_config().default_file_mode, or set the environment variable H5PY_DEFAULT_READONLY=1. Available modes are: 'r', 'r+', 'w', 'w-'/'x', 'a'. See the docs for details.
with h5py.File(file_prefix + 'r') as f:
Traceback (most recent call last):
File "/home/linuxbrew/.linuxbrew/Cellar/python/3.7.7_1/lib/python3.7/site-packages/h5py/_hl/files.py", line 199, in make_fid
fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 88, in h5py.h5f.open
OSError: Unable to open file (file signature not found)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/linuxbrew/.linuxbrew/Cellar/python/3.7.7_1/lib/python3.7/site-packages/h5py/_hl/files.py", line 202, in make_fid
fid = h5f.open(name, h5f.ACC_RDONLY, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 88, in h5py.h5f.open
OSError: Unable to open file (file signature not found)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "wdm2.py", line 300, in
main()
File "wdm2.py", line 63, in main
problem_graph.run_plan(plan, ".")
File "../../../spins/invdes/problem_graph/solver.py", line 61, in run_plan
work.run(transformation_param, event_data)
File "../../../spins/invdes/problem_graph/workspace.py", line 134, in run
transform(self.get_object(node.parametrization), event_data)
File "../../../spins/invdes/problem_graph/creator_opt.py", line 80, in call
self._start(param)
File "../../../spins/invdes/problem_graph/creator_opt.py", line 109, in _start
monitor_list=self.monitor_lists.start_monitors)
File "../../../spins/invdes/problem_graph/workspace.py", line 345, in write
[self._work.get_object(mon) for mon in monitor_list], param)
File "../../../spins/invdes/problem/graph_executor.py", line 87, in eval_fun
_eval_fun_vals(fun_vals, fun_map, graph, top_sorted_nodes, param)
File "../../../spins/invdes/problem/graph_executor.py", line 179, in eval_fun_vals
for node
, node_val in zip(heavy_node_block, heavy_node_vals):
File "/home/linuxbrew/.linuxbrew/Cellar/python/3.7.7_1/lib/python3.7/concurrent/futures/_base.py", line 598, in result_iterator
yield fs.pop().result()
File "/home/linuxbrew/.linuxbrew/Cellar/python/3.7.7_1/lib/python3.7/concurrent/futures/_base.py", line 428, in result
return self.__get_result()
File "/home/linuxbrew/.linuxbrew/Cellar/python/3.7.7_1/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/home/linuxbrew/.linuxbrew/Cellar/python/3.7.7_1/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "../../../spins/invdes/problem/graph_executor.py", line 175, in
heavy_node_vals = executor.map(lambda args: _eval_fun(*args),
File "../../../spins/invdes/problem/graph_executor.py", line 122, in _eval_fun
return fun_map[node].eval(input_vals)
File "../../../spins/invdes/problem_graph/creator_em.py", line 309, in eval
return self._simulate(input_val[0])
File "../../../spins/invdes/problem_graph/creator_em.py", line 372, in _simulate
bloch_vec=self._bloch_vector,
File "../../../spins/fdfd_solvers/maxwell.py", line 378, in solve
with h5py.File(file_prefix + 'r') as f:
File "/home/linuxbrew/.linuxbrew/Cellar/python/3.7.7_1/lib/python3.7/site-packages/h5py/_hl/files.py", line 408, in init
swmr=swmr)
File "/home/linuxbrew/.linuxbrew/Cellar/python/3.7.7_1/lib/python3.7/site-packages/h5py/_hl/files.py", line 204, in make_fid
fid = h5f.create(name, h5f.ACC_EXCL, fapl=fapl, fcpl=fcpl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 108, in h5py.h5f.create
OSError: Unable to create file (unable to open file: name = '/tmp/tmp6i1f0xqj/maxwell-20200513-035519-6ad9366e-94b4-11ea-8cf1-ab50cbd49ffb.E_xr', errno = 17, error message = 'File exists', flags = 15, o_flags = c2)

Is there anyone can make a suggestion or at least an assumption on what may be causing this?

Thank you in advance,

Bera

Suggestion for grating coupling - invert it

Just a suggestion for the grating coupling problem: invert the excitation and detection (I am not an expert in this code, so I would rather wait for such example). Excite from the waveguide mode, and use overlap with Gaussian beam to find coupling efficiency. Due to the reciprocity principle the value will be the same as for direct coupling from Gaussian to waveguide mode. But benefits are following:

  1. One can additionally calculate back-reflection into waveguide. It is useful when designing out-coupling gratings, where back-reflection should be minimum. This parameter can be also added as optimization objective.
  2. One can put several Gaussian ports (from each side or with different sizes) and for the same simulation calculate coupling efficiencies (= overlaps) of Gaussian beams of different sizes, or of different incidence (from substrate side or from the top, or at different angles).

Random Perfection SPINS Output Verification

Hi,

I am working on the initial SPINS example of wdm2.py and am having randomly perfected power outputs. These outputs, however, cannot be verified through Lumerical FDTD. Normally, I could verify any results from SPINS, but these are perfect results which always achieve power = 1.0. Instead, I get nearly the half of these results, power ~= 0.5.

Sometimes, I run a code and one another time I run it again, it gives completely different results than the other one, especially one is extremely perfect (output powers are all up to 1.0) no matter the two simulation runs are exactly the same.

Moreover, for the example above, the iteration count is adjusted to be 100 at the beginning, while SPINS is quite fast to reach objective. It finishes the simulation at 84th iteration.

To make sure it is not a problem of a specific SPINS folder, I downloaded another SPINS and installed it via another virtual environment, still getting the same perfect results. Also, I was normally working on Mac and then installed another SPINS on Ubuntu, still getting the same perfect results (the same run code). But none of the outputs can be verified on Lumerical, as suggested perfect outputs by SPINS.

An example of SPINS output power vs. iteration graph is attached.

Is there anyone can tell what could make SPINS persistently giving these perfect results, which seem not verifiable through FDTD? I can give more details, if needed.

Thank you.

Screen Shot 2020-07-03 at 10 07 25 PM

grating example: how to optimize shorter grating?

I am wondering, how can I limit the length of the rating? Currently the simulation domain is 16 microns long, and grating starts 2 microns from left end (i.e., solid waveguide is always 2 microns long). And the grating is roughly 12 microns long (with 2 microns of empty space on the right). But for my tightly focused Gaussian beam half of the grating is nearly useless. Is it possible to shorten the length of the optimized grating? And how? Thank you in advance!

grating example - view command

After optimization, when I use 'view' command, sometimes it says something like not enough memory. It looks like it is trying to load all files from each optimization step at once, and for many steps (like 500) it becomes huge amount of memory. But for 'view' it needs only to plot like power vs. step and field at last point. Can it instead load optimization steps one-by-one, take power, and close file? Another option: why not combine run with view commands, so that those figures will be produces automatically after the optimization script stops?

grating coupling - cannot verify with COMSOL

I play with the grating coupling, and produced grating I then check in COMSOL with FEM (Boundary Mode Analysis + Frequency domain). I optimize grating for single wavelength, and the script says the optimized efficiency (mon_power) is 0.32, but in COMSOL it calculates it as only 8% or lower. The field plots from COMSOL and script looks very much the same. However, I found that if I increase the refractive index of silicon by 0.0125, then the coupling efficiency calculated in COMSOL is nearly the same as predicted by the script. Even if in the script I directly write the refractive index of Si as 3.48, the optimum in COMSOL is still for n = 3.605. Strange :)

Custom Parametrization

Is it possible to create custom shape nodes which also have a custom parametrization? As mentioned in the documentation, it is possible to add custom nodes, so they can be used to add custom shapes. But can some of the variables defining the geometry of the custom shapes also be parameters in the optimization? So essentially, is it possible to have custom parametrizations besides the pixelated continuous shape?
Thanks!

Phase monitoring in spins

Hello,

How might I go about monitoring the phase at a port throughout optimization? I am able to optimize over phase and extract the final value, but I haven't figured out a way to append a phase monitor that uses the optplan.overlap object. I'm sure I'm missing something simple here.

Thank you,
Anthony

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.