gplugins 1.3.5__tar.gz → 1.3.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. {gplugins-1.3.5 → gplugins-1.3.7}/PKG-INFO +3 -11
  2. {gplugins-1.3.5 → gplugins-1.3.7}/README.md +1 -1
  3. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/__init__.py +1 -1
  4. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/base_models/component.py +67 -4
  5. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/utils/get_sparameters_path.py +2 -3
  6. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/get_meep_geometry.py +2 -5
  7. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/write_sparameters_meep.py +6 -6
  8. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/write_sparameters_meep_mpi.py +4 -2
  9. {gplugins-1.3.5 → gplugins-1.3.7}/pyproject.toml +8 -11
  10. gplugins-1.3.5/gplugins/sax/build_model.py +0 -344
  11. gplugins-1.3.5/gplugins/sax/integrations/femwell_waveguide_model.py +0 -232
  12. gplugins-1.3.5/gplugins/sax/integrations/meep_FDTD_model.py +0 -198
  13. gplugins-1.3.5/gplugins/sax/integrations/meow_eme_model.py +0 -133
  14. gplugins-1.3.5/gplugins/spice/tests/__init__.py +0 -0
  15. {gplugins-1.3.5 → gplugins-1.3.7}/LICENSE +0 -0
  16. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/__init__.py +0 -0
  17. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/base_models/__init__.py +0 -0
  18. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/base_models/simulation.py +0 -0
  19. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/config.py +0 -0
  20. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/types.py +0 -0
  21. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/utils/__init__.py +0 -0
  22. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/utils/add_simulation_markers.py +0 -0
  23. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/utils/async_helpers.py +0 -0
  24. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/utils/cache.py +0 -0
  25. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/utils/convert_sparameters.py +0 -0
  26. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/utils/disable_print.py +0 -0
  27. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/utils/get_capacitance.py +0 -0
  28. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/utils/get_component_with_net_layers.py +0 -0
  29. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/utils/get_effective_indices.py +0 -0
  30. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/utils/get_scattering.py +0 -0
  31. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/utils/optical_constants.py +0 -0
  32. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/utils/parse_layer_stack.py +0 -0
  33. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/utils/plot.py +0 -0
  34. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/utils/plot_csv.py +0 -0
  35. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/utils/port_symmetries.py +0 -0
  36. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/common/utils/tests/test_get_component_with_new_port_layers.py +0 -0
  37. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/devsim/__init__.py +0 -0
  38. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/devsim/doping.py +0 -0
  39. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/devsim/get_simulation.py +0 -0
  40. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/devsim/get_simulation_xsection.py +0 -0
  41. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/devsim/get_solver.py +0 -0
  42. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/devsim/test_devsim.py +0 -0
  43. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/elmer/__init__.py +0 -0
  44. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/elmer/electrostatic.sif.j2 +0 -0
  45. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/elmer/get_capacitance.py +0 -0
  46. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/elmer/tests/test_elmer.py +0 -0
  47. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/fdtdz/__init__.py +0 -0
  48. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/fdtdz/get_epsilon_fdtdz.py +0 -0
  49. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/fdtdz/get_ports_fdtdz.py +0 -0
  50. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/fdtdz/get_sparameters_fdtdz.py +0 -0
  51. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/femwell/__init__.py +0 -0
  52. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/femwell/mode_solver.py +0 -0
  53. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/femwell/solve_thermal.py +0 -0
  54. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/femwell/test_mode_solver.py +0 -0
  55. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gfviz/Makefile +0 -0
  56. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gfviz/__init__.py +0 -0
  57. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gfviz/b64.py +0 -0
  58. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gfviz/gfviz.py +0 -0
  59. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gfviz/netlist.py +0 -0
  60. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gfviz/serve.py +0 -0
  61. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gfviz/static/b64.js +0 -0
  62. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gfviz/static/schemedit.js +0 -0
  63. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gfviz/static/schemedit.wasm +0 -0
  64. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gfviz/templates/example.json +0 -0
  65. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gfviz/templates/index.html +0 -0
  66. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/__init__.py +0 -0
  67. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/get_material.py +0 -0
  68. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/get_port_eigenmode.py +0 -0
  69. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/get_simulation.py +0 -0
  70. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/get_simulation_grating_farfield.py +0 -0
  71. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/get_simulation_grating_fiber.py +0 -0
  72. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/meep_adjoint_optimization.py +0 -0
  73. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/test_eigenmode.py +0 -0
  74. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/test_materials.py +0 -0
  75. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/test_sparameterNxN/test_sparameterNxN_crossing.csv +0 -0
  76. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/test_sparameterNxN/test_sparameterNxN_straight.csv +0 -0
  77. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/test_write_sparameters_meep/test_sparameterNxN_crossing.csv +0 -0
  78. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/test_write_sparameters_meep/test_sparameterNxN_straight.csv +0 -0
  79. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/test_write_sparameters_meep/test_sparameterNxN_symmetries_straight.csv +0 -0
  80. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/test_write_sparameters_meep/test_sparameter_straight_mpi.csv +0 -0
  81. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/test_write_sparameters_meep/test_sparameter_straight_mpi_pool.csv +0 -0
  82. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/test_write_sparameters_meep/test_sparameters_crossing_symmetric.csv +0 -0
  83. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/test_write_sparameters_meep/test_sparameters_straight.csv +0 -0
  84. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/test_write_sparameters_meep/test_sparameters_straight_batch.csv +0 -0
  85. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/test_write_sparameters_meep/test_sparameters_straight_mpi.csv +0 -0
  86. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/test_write_sparameters_meep/test_sparameters_straight_mpi_pool.csv +0 -0
  87. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/test_write_sparameters_meep/test_sparameters_straight_symmetric.csv +0 -0
  88. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/test_write_sparameters_meep.py +0 -0
  89. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/write_sparameters_grating.py +0 -0
  90. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmeep/write_sparameters_meep_batch.py +0 -0
  91. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmsh/__init__.py +0 -0
  92. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmsh/define_polysurfaces.py +0 -0
  93. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmsh/get_mesh.py +0 -0
  94. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmsh/parse_component.py +0 -0
  95. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmsh/parse_gds.py +0 -0
  96. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmsh/tests/test_custom_names.py +0 -0
  97. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmsh/tests/test_meshing_2D.py +0 -0
  98. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmsh/tests/test_meshing_3D.py +0 -0
  99. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmsh/uz_xsection_mesh.py +0 -0
  100. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmsh/xy_xsection_mesh.py +0 -0
  101. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/gmsh/xyz_mesh.py +0 -0
  102. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/__init__.py +0 -0
  103. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/dataprep/__init__.py +0 -0
  104. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/dataprep/regions.py +0 -0
  105. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/drc/__init__.py +0 -0
  106. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/drc/check_duplicated_cells.py +0 -0
  107. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/drc/check_exclusion.py +0 -0
  108. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/drc/check_inclusion.py +0 -0
  109. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/drc/check_space.py +0 -0
  110. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/drc/check_width.py +0 -0
  111. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/drc/count_drc.py +0 -0
  112. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/drc/samples/drc_errors.py +0 -0
  113. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/drc/write_drc.py +0 -0
  114. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/get_density.py +0 -0
  115. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/get_netlist.py +0 -0
  116. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/netlist_graph.py +0 -0
  117. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/netlist_spice_reader.py +0 -0
  118. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/plot_nets.py +0 -0
  119. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/tests/test_dataprep_regions.py +0 -0
  120. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/tests/test_density.py +0 -0
  121. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/tests/test_drc_exclusion.py +0 -0
  122. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/tests/test_drc_inclusion.py +0 -0
  123. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/tests/test_drc_space.py +0 -0
  124. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/tests/test_drc_width.py +0 -0
  125. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/tests/test_global_density.py +0 -0
  126. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/tests/test_netlist_spice_reader.py +0 -0
  127. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/klayout/tests/test_plot_nets.py +0 -0
  128. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/lumerical/README.md +0 -0
  129. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/lumerical/__init__.py +0 -0
  130. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/lumerical/interconnect.py +0 -0
  131. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/lumerical/mapping_ubcpdk.yml +0 -0
  132. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/lumerical/read.py +0 -0
  133. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/lumerical/settings.py +0 -0
  134. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/lumerical/tests/test_lumerical_read_sparameters.py +0 -0
  135. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/lumerical/tests/test_netlist.py +0 -0
  136. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/lumerical/tests/test_netlist_get_routes.py +0 -0
  137. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/lumerical/write_sparameters_lumerical.py +0 -0
  138. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/lumerical/write_sparameters_lumerical_components.py +0 -0
  139. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/materials/__init__.py +0 -0
  140. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/materials/inorganic.py +0 -0
  141. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/materials/optical/__init__.py +0 -0
  142. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/materials/optical/optical_mat.py +0 -0
  143. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/materials/optical/refractive_index_info.py +0 -0
  144. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/materials/semiconductor/__init__.py +0 -0
  145. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/materials/semiconductor/semiconductor_mat.py +0 -0
  146. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/meow/__init__.py +0 -0
  147. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/meow/meow_eme.py +0 -0
  148. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/meow/test_meow_simulation.py +0 -0
  149. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/__init__.py +0 -0
  150. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/coupler.py +0 -0
  151. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/find_coupling_vs_gap.py +0 -0
  152. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/find_mode_dispersion.py +0 -0
  153. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/find_modes.py +0 -0
  154. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/find_modes_cross_section.py +0 -0
  155. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/find_neff_ng_dw_dh.py +0 -0
  156. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/find_neff_vs_width.py +0 -0
  157. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/get_mode_solver_coupler.py +0 -0
  158. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/get_mode_solver_cross_section.py +0 -0
  159. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/get_mode_solver_rib.py +0 -0
  160. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/modes/neff_vs_width_nitride.csv +0 -0
  161. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/modes/neff_vs_width_rib.csv +0 -0
  162. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/modes/neff_vs_width_strip.csv +0 -0
  163. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/neff_convergence_test.py +0 -0
  164. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/neff_vs_width.csv +0 -0
  165. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/overlap.py +0 -0
  166. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/tests/test_dw_dh/test_dw_dh.csv +0 -0
  167. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/tests/test_dw_dh/test_dw_dh.obtained.csv +0 -0
  168. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/tests/test_dw_dh/test_dw_dh_dispersion.csv +0 -0
  169. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/tests/test_dw_dh.py +0 -0
  170. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/tests/test_find_modes.py +0 -0
  171. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/tests/test_find_modes_dispersion.py +0 -0
  172. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/tests/test_neff_vs_width/test_neff_vs_width.csv +0 -0
  173. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/tests/test_neff_vs_width/test_neff_vs_width.obtained.csv +0 -0
  174. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/tests/test_neff_vs_width.py +0 -0
  175. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/types.py +0 -0
  176. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/modes/waveguide.py +0 -0
  177. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/palace/__init__.py +0 -0
  178. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/palace/driven.json +0 -0
  179. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/palace/electrostatic.json +0 -0
  180. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/palace/get_capacitance.py +0 -0
  181. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/palace/get_scattering.py +0 -0
  182. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/palace/tests/test_palace.py +0 -0
  183. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/path_length_analysis/__init__.py +0 -0
  184. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/path_length_analysis/path_length_analysis.py +0 -0
  185. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/path_length_analysis/path_length_analysis_from_gds.py +0 -0
  186. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/path_length_analysis/test_pathlength_extraction.py +0 -0
  187. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/photonic_circuit_models/__init__.py +0 -0
  188. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/photonic_circuit_models/coupler.py +0 -0
  189. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/photonic_circuit_models/fsr.py +0 -0
  190. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/photonic_circuit_models/heater.py +0 -0
  191. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/photonic_circuit_models/mzi.py +0 -0
  192. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/photonic_circuit_models/ring.py +0 -0
  193. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/process/__init__.py +0 -0
  194. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/process/diffusion.py +0 -0
  195. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/process/implant_tables.py +0 -0
  196. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/process/pysrim.py +0 -0
  197. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/process/silicon.py +0 -0
  198. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/process/skew/antimony_si_skew.csv +0 -0
  199. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/process/skew/arsenic_si_skew.csv +0 -0
  200. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/process/skew/boron_si_skew.csv +0 -0
  201. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/process/skew/phosphorus_si_skew.csv +0 -0
  202. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sax/__init__.py +0 -0
  203. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sax/interpolators.py +0 -0
  204. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sax/mlp.py +0 -0
  205. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sax/models.py +0 -0
  206. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sax/parameter.py +0 -0
  207. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sax/plot_model.py +0 -0
  208. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sax/read.py +0 -0
  209. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sax/tests/test_mzi.py +0 -0
  210. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sax/tests/test_mzi_lattice/test_mzi_lattice.obtained.yml +0 -0
  211. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sax/tests/test_mzi_lattice/test_mzi_lattice.yml +0 -0
  212. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sax/tests/test_mzi_lattice.py +0 -0
  213. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sax/tests/test_parameters.py +0 -0
  214. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sentaurus/mask_sde.py +0 -0
  215. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sentaurus/mask_sprocess.py +0 -0
  216. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sentaurus/sde.py +0 -0
  217. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sentaurus/sdevice.py +0 -0
  218. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sentaurus/sprocess.py +0 -0
  219. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/sentaurus/svisual.py +0 -0
  220. {gplugins-1.3.5/gplugins/sax/integrations → gplugins-1.3.7/gplugins/spice}/__init__.py +0 -0
  221. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/spice/spice_to_yaml.py +0 -0
  222. {gplugins-1.3.5/gplugins/spice → gplugins-1.3.7/gplugins/spice/tests}/__init__.py +0 -0
  223. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/spice/tests/test_interconnect.py +0 -0
  224. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/__init__.py +0 -0
  225. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/component.py +0 -0
  226. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/get_results.py +0 -0
  227. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/get_simulation_grating_coupler.py +0 -0
  228. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/materials.py +0 -0
  229. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/modes.py +0 -0
  230. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/tests/test_component_modeler.py +0 -0
  231. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/tests/test_materials.py +0 -0
  232. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/tests/test_modes/test_sweep_width.csv +0 -0
  233. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/tests/test_modes/test_sweep_width.obtained.csv +0 -0
  234. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/tests/test_modes_coupler.py +0 -0
  235. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/tests/test_modes_waveguide.py +0 -0
  236. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/tests/test_plot_simulation_grating_coupler.py +0 -0
  237. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/tests/test_write_sparameters.py +0 -0
  238. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/tests/tests_sparameters/sim_ref.yaml +0 -0
  239. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/tests/tests_sparameters/test_write_sparameters.py +0 -0
  240. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/tests/tests_sparameters/test_write_sparameters_grating_coupler.py +0 -0
  241. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/types.py +0 -0
  242. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/util.py +0 -0
  243. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/tidy3d/write_sparameters_grating_coupler.py +0 -0
  244. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/typings.py +0 -0
  245. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/vlsir/__init__.py +0 -0
  246. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/vlsir/export_netlist.py +0 -0
  247. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/vlsir/tests/resources/pads_correct.cir +0 -0
  248. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/vlsir/tests/resources/pads_correct.scs +0 -0
  249. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/vlsir/tests/resources/pads_correct.sp +0 -0
  250. {gplugins-1.3.5 → gplugins-1.3.7}/gplugins/vlsir/tests/test_vlsir.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gplugins
3
- Version: 1.3.5
3
+ Version: 1.3.7
4
4
  Summary: gdsfactory plugins
5
5
  Keywords: python
6
6
  Author-email: gdsfactory <contact@gdsfactory.com>
@@ -29,6 +29,7 @@ Requires-Dist: matplotlib ; extra == "docs"
29
29
  Requires-Dist: jupyter-book~=1.0 ; extra == "docs"
30
30
  Requires-Dist: pyvista[all]<=0.43.8 ; extra == "docs"
31
31
  Requires-Dist: bokeh ; extra == "docs"
32
+ Requires-Dist: scikit-learn ; extra == "docs"
32
33
  Requires-Dist: femwell~=0.1.11 ; extra == "femwell"
33
34
  Requires-Dist: meshwell~=1.0.7 ; extra == "femwell"
34
35
  Requires-Dist: jinja2 ; extra == "gfviz"
@@ -58,20 +59,11 @@ Requires-Dist: jaxlib>=0.4.26 ; extra == "meow"
58
59
  Requires-Dist: flax>=0.8.2 ; extra == "meow"
59
60
  Requires-Dist: meow-sim>=0.13,<0.14 ; extra == "meow"
60
61
  Requires-Dist: tidy3d>=2.8.2,<2.9 ; extra == "meow"
61
- Requires-Dist: jax>=0.4.26 ; extra == "sax"
62
- Requires-Dist: jaxlib>=0.4.26 ; extra == "sax"
63
- Requires-Dist: flax>=0.8.2 ; extra == "sax"
64
62
  Requires-Dist: sax>=0.13.1,<0.15.0 ; extra == "sax"
65
- Requires-Dist: scikit-learn ; extra == "sax"
66
- Requires-Dist: pyvis<=0.3.1 ; extra == "sax"
67
- Requires-Dist: ray ; extra == "sax"
68
63
  Requires-Dist: bokeh ; extra == "schematic"
69
64
  Requires-Dist: ipywidgets ; extra == "schematic"
70
65
  Requires-Dist: natsort ; extra == "schematic"
71
66
  Requires-Dist: tidy3d>=2.8.2,<2.9 ; extra == "tidy3d"
72
- Requires-Dist: meshio ; extra == "tidy3d"
73
- Requires-Dist: numpy ; extra == "tidy3d"
74
- Requires-Dist: meshwell~=1.0.7 ; extra == "tidy3d"
75
67
  Requires-Dist: gdstk ; extra == "tidy3d"
76
68
  Requires-Dist: vlsir ; extra == "vlsir"
77
69
  Requires-Dist: vlsirtools ; extra == "vlsir"
@@ -90,7 +82,7 @@ Provides-Extra: schematic
90
82
  Provides-Extra: tidy3d
91
83
  Provides-Extra: vlsir
92
84
 
93
- # gplugins 1.3.5
85
+ # gplugins 1.3.7
94
86
 
95
87
  [![docs](https://github.com/gdsfactory/gplugins/actions/workflows/pages.yml/badge.svg)](https://gdsfactory.github.io/gplugins/)
96
88
  [![PyPI](https://img.shields.io/pypi/v/gplugins)](https://pypi.org/project/gplugins/)
@@ -1,4 +1,4 @@
1
- # gplugins 1.3.5
1
+ # gplugins 1.3.7
2
2
 
3
3
  [![docs](https://github.com/gdsfactory/gplugins/actions/workflows/pages.yml/badge.svg)](https://gdsfactory.github.io/gplugins/)
4
4
  [![PyPI](https://img.shields.io/pypi/v/gplugins)](https://pypi.org/project/gplugins/)
@@ -1,6 +1,6 @@
1
1
  """gplugins - gdsfactory plugins."""
2
2
 
3
- __version__ = "1.3.5"
3
+ __version__ = "1.3.7"
4
4
 
5
5
  import pathlib
6
6
 
@@ -2,6 +2,7 @@ from functools import cached_property
2
2
  from hashlib import md5
3
3
  from typing import TypeAlias
4
4
 
5
+ import shapely
5
6
  import gdsfactory as gf
6
7
  import numpy as np
7
8
  from gdsfactory.component import Component
@@ -15,7 +16,6 @@ from pydantic import (
15
16
  )
16
17
  from shapely import MultiPolygon, Polygon
17
18
 
18
- from gplugins.gmsh.parse_gds import cleanup_component
19
19
 
20
20
  from ..types import AnyShapelyPolygon, GFComponent
21
21
 
@@ -24,6 +24,69 @@ from gdsfactory.pdk import get_layer_stack, get_layer, get_layer_name
24
24
  Coordinate: TypeAlias = tuple[float, float]
25
25
 
26
26
 
27
+ def round_coordinates(geom, ndigits=4):
28
+ """Round coordinates to n_digits to eliminate floating point errors."""
29
+
30
+ def _round_coords(x, y, z=None):
31
+ x = round(x, ndigits)
32
+ y = round(y, ndigits)
33
+
34
+ if z is not None:
35
+ z = round(x, ndigits)
36
+
37
+ return [c for c in (x, y, z) if c is not None]
38
+
39
+ return shapely.ops.transform(_round_coords, geom)
40
+
41
+
42
+ def fuse_polygons(component, layer, round_tol=4, simplify_tol=1e-4, offset_tol=None):
43
+ """Take all polygons from a layer, and returns a single (Multi)Polygon shapely object."""
44
+ layer_region = layer.get_shapes(component)
45
+
46
+ # Convert polygons to shapely
47
+ # TODO: do all polygon processing in KLayout at the gplugins level for speed
48
+ shapely_polygons = []
49
+ for klayout_polygon in layer_region.each_merged():
50
+ exterior_points = [
51
+ (point.x / 1000, point.y / 1000)
52
+ for point in klayout_polygon.each_point_hull()
53
+ ]
54
+ interior_points = []
55
+ for hole_index in range(klayout_polygon.holes()):
56
+ holes_points = [
57
+ (point.x / 1000, point.y / 1000)
58
+ for point in klayout_polygon.each_point_hole(hole_index)
59
+ ]
60
+ interior_points.append(holes_points)
61
+
62
+ shapely_polygons.append(
63
+ round_coordinates(
64
+ shapely.geometry.Polygon(shell=exterior_points, holes=interior_points),
65
+ round_tol,
66
+ )
67
+ )
68
+
69
+ return shapely.ops.unary_union(shapely_polygons).simplify(
70
+ simplify_tol, preserve_topology=False
71
+ )
72
+
73
+
74
+ def cleanup_component(component, layer_stack, round_tol=2, simplify_tol=1e-2):
75
+ """Process component polygons before meshing."""
76
+ layer_stack_dict = layer_stack.to_dict()
77
+
78
+ return {
79
+ layername: fuse_polygons(
80
+ component,
81
+ layer["layer"],
82
+ round_tol=round_tol,
83
+ simplify_tol=simplify_tol,
84
+ )
85
+ for layername, layer in layer_stack_dict.items()
86
+ if layer["layer"] is not None
87
+ }
88
+
89
+
27
90
  def move_polar_rad_copy(
28
91
  pos: Coordinate, angle: float, length: float
29
92
  ) -> NDArray[np.float64]:
@@ -227,6 +290,9 @@ class LayeredComponentBase(BaseModel):
227
290
  def get_port_layers(self, port: gf.Port) -> tuple[str, ...]:
228
291
  layer_name = get_layer_name(port.layer)
229
292
 
293
+ if "_intent" in layer_name:
294
+ layer_name = layer_name.replace("_intent", "")
295
+
230
296
  derived_layers = []
231
297
  for l_name, level in self.layer_stack.layers.items():
232
298
  if layer_name in str(level.layer):
@@ -234,9 +300,6 @@ class LayeredComponentBase(BaseModel):
234
300
 
235
301
  return derived_layers
236
302
 
237
-
238
-
239
-
240
303
  # return ("core",)
241
304
  # return tuple(
242
305
  # k for k, v in self.layer_stack.layers.items() if port.layer in v.layer
@@ -31,8 +31,7 @@ def _get_sparameters_path(
31
31
  dirpath: PathType | None = PATH.sparameters,
32
32
  **kwargs,
33
33
  ) -> Path:
34
- """Return Sparameters npz filepath hashing simulation settings for \
35
- a consistent unique name.
34
+ """Return Sparameters npz filepath hashing simulation settings for a consistent unique name.
36
35
 
37
36
  Args:
38
37
  component: component or component factory.
@@ -47,7 +46,7 @@ def _get_sparameters_path(
47
46
 
48
47
  dirpath = pathlib.Path(dirpath)
49
48
  dirpath = (
50
- dirpath / component.function_name
49
+ dirpath / component.name
51
50
  if hasattr(component, "function_name")
52
51
  else dirpath
53
52
  )
@@ -58,12 +58,9 @@ def get_meep_geometry_from_component(
58
58
  layer = level.layer
59
59
 
60
60
  if isinstance(layer, LogicalLayer):
61
- assert isinstance(layer.layer, tuple | LayerEnum)
62
- layer_tuple = cast(tuple[int, int], tuple(layer.layer))
61
+ layer_tuple = gf.get_layer_tuple(layer.layer)
63
62
  elif isinstance(layer, DerivedLayer):
64
- assert level.derived_layer is not None
65
- assert isinstance(level.derived_layer.layer, tuple | LayerEnum)
66
- layer_tuple = cast(tuple[int, int], tuple(level.derived_layer.layer))
63
+ layer_tuple = gf.get_layer_tuple(level.derived_layer.layer)
67
64
  else:
68
65
  raise ValueError(f"Layer {layer!r} is not a DerivedLayer or LogicalLayer")
69
66
 
@@ -54,8 +54,7 @@ def remove_simulation_kwargs(d: dict[str, Any]) -> dict[str, Any]:
54
54
  def parse_port_eigenmode_coeff(
55
55
  port_name: str, ports: dict[str, Port], sim_dict: dict, port_mode: int = 0
56
56
  ):
57
- """Returns the coefficients relative to whether the wavevector is entering or \
58
- exiting simulation.
57
+ """Returns the coefficients relative to whether the wavevector is entering or exiting simulation.
59
58
 
60
59
  Args:
61
60
  port_index: index of port.
@@ -320,7 +319,7 @@ def write_sparameters_meep(
320
319
  filepath = filepath or get_sparameters_path(
321
320
  component=component,
322
321
  dirpath=dirpath,
323
- layer_stack=layer_stack,
322
+ layer_stack=layer_stack.to_dict(),
324
323
  **sim_settings,
325
324
  )
326
325
 
@@ -605,8 +604,8 @@ settings_write_sparameters_meep = set(sig.parameters.keys()).union(
605
604
  )
606
605
 
607
606
  if __name__ == "__main__":
608
- wavelength_start = 1.26
609
- wavelength_stop = 1.36
607
+ wavelength_start = 1.5
608
+ wavelength_stop = 1.6
610
609
  sim_settings = dict(
611
610
  wavelength_start=wavelength_start, wavelength_stop=wavelength_stop
612
611
  )
@@ -621,8 +620,9 @@ if __name__ == "__main__":
621
620
  sp = write_sparameters_meep(
622
621
  c,
623
622
  run=True,
624
- animate=True,
623
+ #animate=True,
625
624
  is_3d=False,
625
+ ymargin=3,
626
626
  plot_args={
627
627
  "eps_parameters": {"contour": True},
628
628
  "field_parameters": {
@@ -45,7 +45,7 @@ def write_sparameters_meep_mpi(
45
45
  cores: int = core_materials,
46
46
  filepath: PathType | None = None,
47
47
  dirpath: PathType | None = None,
48
- temp_dir: Path = temp_dir_default,
48
+ temp_dir: Path|str = temp_dir_default,
49
49
  temp_file_str: str = "write_sparameters_meep_mpi",
50
50
  live_output: bool = False,
51
51
  overwrite: bool = False,
@@ -152,6 +152,7 @@ def write_sparameters_meep_mpi(
152
152
  filepath.unlink()
153
153
 
154
154
  # Save all the simulation arguments for later retrieval
155
+ temp_dir = Path(temp_dir)
155
156
  temp_dir.mkdir(exist_ok=True, parents=True)
156
157
  tempfile = temp_dir / temp_file_str
157
158
  filepath_json = tempfile.with_suffix(".json")
@@ -178,7 +179,7 @@ def write_sparameters_meep_mpi(
178
179
  "if __name__ == '__main__':\n",
179
180
  f"\twith open(\"{parameters_file}\", 'rb') as inp:\n",
180
181
  "\t\tparameters_dict = pickle.load(inp)\n\n",
181
- f"\tcomponent = import_gds({str(component_file)!r}, read_metadata=True)\n",
182
+ f"\tcomponent = import_gds({str(component_file)!r})\n",
182
183
  f"\tfilepath_json = pathlib.Path({str(filepath_json)!r})\n",
183
184
  "\tlayer_stack = LayerStack.parse_raw(filepath_json.read_text())\n",
184
185
  f"\twrite_sparameters_meep(component=component, overwrite={overwrite}, "
@@ -254,6 +255,7 @@ if __name__ == "__main__":
254
255
  temp_dir="./test/",
255
256
  filepath="instance_dict.csv",
256
257
  resolution=20,
258
+ is_3d=False,
257
259
  )
258
260
  sp = np.load(filepath)
259
261
  print(list(sp.keys()))
@@ -25,7 +25,7 @@ license = {file = "LICENSE"}
25
25
  name = "gplugins"
26
26
  readme = "README.md"
27
27
  requires-python = ">=3.11"
28
- version = "1.3.5"
28
+ version = "1.3.7"
29
29
 
30
30
  [project.optional-dependencies]
31
31
  dev = [
@@ -36,7 +36,7 @@ dev = [
36
36
  "pyswarms"
37
37
  ]
38
38
  devsim = ["devsim", "pyvista<=0.43.8", "tidy3d>=2.8.2,<2.9"]
39
- docs = ["jupytext", "matplotlib", "jupyter-book~=1.0", "pyvista[all]<=0.43.8", "bokeh"]
39
+ docs = ["jupytext", "matplotlib", "jupyter-book~=1.0", "pyvista[all]<=0.43.8", "bokeh", "scikit-learn"]
40
40
  femwell = ["femwell~=0.1.11", "meshwell~=1.0.7"]
41
41
  gfviz = ["jinja2", "fastapi", "shapely", "natsort"]
42
42
  gmsh = [
@@ -61,16 +61,13 @@ meow = [
61
61
  "tidy3d>=2.8.2,<2.9"
62
62
  ]
63
63
  sax = [
64
- "jax>=0.4.26",
65
- "jaxlib>=0.4.26",
66
- "flax>=0.8.2",
67
- "sax>=0.13.1,<0.15.0",
68
- "scikit-learn",
69
- "pyvis<=0.3.1",
70
- "ray"
64
+ "sax>=0.13.1,<0.15.0"
71
65
  ]
72
66
  schematic = ["bokeh", "ipywidgets", "natsort"]
73
- tidy3d = ["tidy3d>=2.8.2,<2.9", "meshio", "numpy", "meshwell~=1.0.7", "gdstk"]
67
+ tidy3d = [
68
+ "tidy3d>=2.8.2,<2.9",
69
+ "gdstk"
70
+ ]
74
71
  vlsir = ["vlsir", "vlsirtools"]
75
72
 
76
73
  [tool.codespell]
@@ -192,7 +189,7 @@ message_template = "Bump to {new_version}"
192
189
  tag_template = "v{new_version}"
193
190
 
194
191
  [tool.tbump.version]
195
- current = "1.3.5"
192
+ current = "1.3.7"
196
193
  regex = '''
197
194
  (?P<major>\d+)
198
195
  \.
@@ -1,344 +0,0 @@
1
- import copy
2
- from pathlib import Path
3
-
4
- import jax.numpy as jnp
5
- import ray
6
- from gdsfactory.technology import LayerStack
7
- from gdsfactory.typings import PortSymmetries
8
- from tqdm.contrib.itertools import product
9
-
10
- from gplugins.sax.interpolators import nd_nd_interpolation
11
- from gplugins.sax.mlp import mlp_regression
12
- from gplugins.sax.parameter import (
13
- LayerStackThickness,
14
- LithoParameter,
15
- NamedParameter,
16
- )
17
-
18
-
19
- class Model:
20
- def __init__(
21
- self,
22
- trainable_component: callable,
23
- layer_stack: LayerStack,
24
- trainable_parameters: None
25
- | (dict[str, LayerStackThickness | NamedParameter]) = None,
26
- non_trainable_parameters: None
27
- | (dict[str, LayerStackThickness | NamedParameter]) = None,
28
- simulation_settings: dict[str, float | str | int | Path] | None = None,
29
- num_modes: int = 2,
30
- port_symmetries: PortSymmetries | None = None,
31
- address: str | None = None,
32
- dashboard_port: int = 8265,
33
- num_cpus: int | None = None,
34
- num_cpus_per_task: int = 1,
35
- # num_gpus_per_task: int = 0,
36
- restart_cluster: bool = False,
37
- *args,
38
- **kwargs,
39
- ) -> None:
40
- """Utility class which simplifies the execution of simulations to build compact models for circuit simulations.
41
-
42
- Aims to be agnostic to the specific simulator being used.
43
-
44
- It contains shared utilities for the different types of Models:
45
- - Optional simulation hyperparameter tuning routine (TODO)
46
- - Looping over training variables to generate training examples.
47
- - Consistent formatting of training examples for model building.
48
- - Interface with Ray clusters for distributed processing (even locally, this is beneficial)
49
-
50
- Other functionality such as
51
- - Simulation setup, execution, caching/loading
52
- - Assembly of simulation results into S-parameters
53
- is solver-dependent, and hence resides in child classes.
54
-
55
- Todo:
56
- - more consistent ordering of input/output data
57
- - more JAX, less pure Python
58
- - reuse Ray cluster across different model instances for simultaneous training
59
-
60
- Attributes:
61
- trainable_component: callable wrapping component associated with model
62
- layer_stack: complete layer_stack associated with model
63
- trainable parameters: parameters that are model features that need to be learned (e.g. width, layer thicknesses, wavelength, materials properties)
64
- non_trainable_parameters: parameters for input_dict whose effect on S-parameters is known and does not need to be trained (e.g. length for a waveguide)
65
- simulation_settings: simulation parameters that can impact model quality (e.g. resolution, domain size). Set their converged property to True to skip convergence tuning.
66
- sim_settings: other simulation settings the solver can use
67
- num_modes: number of modes to consider for each port in S-parameter calculation.
68
- port_symmetries: as defined in FDTD solvers. Dict establishing equivalency between S-parameters.
69
- e.g. {"o1@0,o1@0": ["o2@0,o2@0", "o3@0,o3@0", "o4@0,o4@0"]} means that S22 = S33 = S44 are the same as S11,
70
- and hence the output vector for model training will only contain the key S11 to reduce the number of variables to fit.
71
- address: of the Ray cluster to connect to. Defaults to finding a local running instance.
72
- dashboard_port: IP address of the dashboard to monitor the cluster
73
- num_cpus: available to the cluster (if not autoscaling)
74
- num_cpus_per_task: number of CPUs to assign to each task
75
- num_gpus_per_task: number of GPUs to assign to each task
76
- restart_cluster: if instantiating multiple models in the same Python session, whether to restart the cluster.
77
- """
78
- self.trainable_component = trainable_component
79
- self.layer_stack = layer_stack
80
- self.trainable_parameters = trainable_parameters or {}
81
- self.non_trainable_parameters = non_trainable_parameters or {}
82
- self.simulation_settings = simulation_settings or {}
83
- self.num_modes = num_modes
84
-
85
- # Extract inputs and outputs vector size data
86
- self.size_inputs = len(self.trainable_parameters)
87
- self.num_ports = len(
88
- trainable_component(self.get_nominal_dict()).ports.filter(
89
- port_type="optical"
90
- )
91
- )
92
-
93
- # Extract input and output vector label data
94
- self.input_vector_labels = list(self.trainable_parameters) + list(
95
- self.non_trainable_parameters.keys()
96
- )
97
-
98
- # self.size_outputs = self.num_ports * self.num_modes
99
- self.port_symmetries = port_symmetries
100
-
101
- # Cluster resources
102
- self.num_cpus_per_task = num_cpus_per_task
103
- # self.num_gpus_per_task = num_gpus_per_task
104
- if restart_cluster and ray.is_initialized():
105
- ray.shutdown()
106
- if not ray.is_initialized():
107
- ray.init(dashboard_port=dashboard_port, num_cpus=num_cpus)
108
-
109
- """
110
- PARAMETERS
111
- """
112
-
113
- def get_nominal_dict(self):
114
- """Return input_dict of nominal parameter values."""
115
- return {
116
- name: parameter.nominal_value
117
- for name, parameter in self.trainable_parameters.items()
118
- }
119
-
120
- def get_random_dict(self):
121
- """Return input_dict of randomly sampled parameter values."""
122
- return {
123
- name: parameter.sample()
124
- for name, parameter in self.trainable_parameters.items()
125
- }
126
-
127
- def parse_input_dict(self, input_dict):
128
- """Separates between LayerStackThickness, NamedParameter, and LithoParameter inputs.
129
-
130
- Args:
131
- input_dict: key needs to match the keys in self.trainable_parameters
132
- values are the new values to assign to these parameters.
133
- """
134
- param_dict = {}
135
- layer_stack_param_dict = {}
136
- litho_param_dict = {}
137
- for key, value in input_dict.items():
138
- if type(self.trainable_parameters[key]) is NamedParameter:
139
- param_dict[key] = value
140
- elif type(self.trainable_parameters[key]) is LayerStackThickness:
141
- layer_stack_param_dict[key] = value
142
- elif type(self.trainable_parameters[key]) is LithoParameter:
143
- litho_param_dict[key] = value
144
- return param_dict, layer_stack_param_dict, litho_param_dict
145
-
146
- def perturb_layer_stack(self, layer_stack_param_dict):
147
- """Returns a temporary LayerStack with a new thickness value for the (current) LayerStackThickness objects in layer_stack_param_dict.
148
-
149
- Args:
150
- layer_stack_param_dict: key needs to match a key in self.trainable_parameters having for value a LayerStackThickness object
151
- value is the thickness to assign to this parameter
152
- """
153
- perturbed_layer_stack = copy.deepcopy(self.layer_stack)
154
- for key, thickness in layer_stack_param_dict.items():
155
- LayerStackThickness_obj = self.trainable_parameters[key]
156
- perturbed_layer_stack.layers[
157
- LayerStackThickness_obj.layername
158
- ].thickness = thickness
159
- return perturbed_layer_stack
160
-
161
- def perturb_geometry(self, current_component, litho_param_dict):
162
- """Returns a temporary Component on which all the morphological operations contained in the current litho_param_dict have been applied.
163
-
164
- Args:
165
- current_component: the current component, with params_dict already applied
166
- litho_param_dict: key needs to match a key in self.trainable_parameters having for value a LithoParameter object
167
- value is the input to the LithoParameter transformation attribute
168
- """
169
- for key, value in litho_param_dict.items():
170
- lithoParameter_obj = self.trainable_parameters[key]
171
- current_component = lithoParameter_obj.get_transformation(
172
- current_component, value
173
- )
174
- return current_component
175
-
176
- """
177
- QUEUING
178
- """
179
-
180
- def define_output_vector_labels(self):
181
- """Uses number of component ports, number of modes solved for, and port_symmetries to define smallest output vector."""
182
- output_vector_labels_iter = product(
183
- range(1, self.num_ports + 1),
184
- range(self.num_modes),
185
- range(1, self.num_ports + 1),
186
- range(self.num_modes),
187
- )
188
- output_vector_labels = []
189
- for output_label in output_vector_labels_iter:
190
- output_key1 = f"o{output_label[0]}@{output_label[1]}"
191
- output_key2 = f"o{output_label[2]}@{output_label[3]}"
192
- if output_key1 != output_key2:
193
- output_key = f"{output_key1},{output_key2}"
194
- output_vector_labels.append(output_key)
195
-
196
- if self.port_symmetries:
197
- for value_list in self.port_symmetries.values():
198
- for value in value_list:
199
- output_vector_labels.remove(value)
200
-
201
- return output_vector_labels
202
-
203
- def arange_inputs(self, type="arange"):
204
- """Prepares input vectors for spanning simulation space.
205
-
206
- Arguments:
207
- type: str, arange or corners. Defines the iterator function to use with parameter objects.
208
-
209
- Returns:
210
- ranges_dict: dict, with keys parameter names and values arrays of containing all unique parameter values.
211
- """
212
- if type == "arange":
213
- ranges_dict = {
214
- name: parameter.arange()
215
- for name, parameter in self.trainable_parameters.items()
216
- }
217
- elif type == "corners":
218
- ranges_dict = {
219
- name: parameter.corners()
220
- for name, parameter in self.trainable_parameters.items()
221
- }
222
- else:
223
- raise ValueError("Type should be arange or corners.")
224
-
225
- return ranges_dict
226
-
227
- def get_output_from_inputs(self, labels, values, remote_function):
228
- """Get one output vector from a set of inputs.
229
-
230
- How to map parameters to simulation inputs depends on the target simulator.
231
-
232
- Arguments:
233
- labels: keys of the parameters
234
- values: values of the parameters
235
- remote_function: ray remote function object to use for the simulation
236
-
237
- Returns:
238
- remote function ID for delayed execution
239
- the remote function returns new_inputs, output_vectors
240
- new_inputs is an array containing derived inputs (e.g. wavelength in FDTD broadband simulation)
241
- output_vectors is a vector of reals representing the output to model (neff, s-params, etc.)
242
- """
243
- return NotImplementedError
244
-
245
- def get_all_inputs_outputs(self, type="arange"):
246
- """Get all outputs given all sets of inputs.
247
-
248
- get_output_from_inputs and remote_function are defined in the child class.
249
- """
250
- # Define possible parameter values
251
- ranges_dict = self.arange_inputs(type=type)
252
- # For all combinations of parameter values
253
- input_ids = list(product(*ranges_dict.values()))
254
- output_ids = [
255
- self.get_output_from_inputs(
256
- ranges_dict.keys(), values, self.remote_function
257
- )
258
- for values in product(*ranges_dict.values())
259
- ]
260
- # Execute the jobs
261
- results = ray.get(output_ids)
262
-
263
- # Parse the outputs into input and output vectors
264
- input_vectors = []
265
- output_vectors = []
266
- for input_example, output_example in zip(
267
- input_ids, results
268
- ): # TODO no for loops!
269
- input_vector = list(input_example)
270
- input_vector.extend(output_example[0])
271
- input_vectors.append(input_vector)
272
- output_vectors.append(output_example[1])
273
-
274
- return (
275
- jnp.array(input_vectors),
276
- jnp.array(output_vectors),
277
- )
278
-
279
- """
280
- MODELS
281
- """
282
-
283
- def set_nd_nd_interp(self) -> None:
284
- """Returns ND-ND interpolator.
285
-
286
- Returns:
287
- self.inference: [callable giving an output_vector given an input_vector]
288
- list is of length 2*output_vector length, first output_vector entries are real, second imaginary
289
- """
290
- input_vectors, output_vectors = self.get_all_inputs_outputs()
291
- self.inference = nd_nd_interpolation(input_vectors, output_vectors)
292
-
293
- def set_mlp_interp(self) -> None:
294
- """Returns multilayer perceptron interpolator.
295
-
296
- Returns:
297
- self.inference: [callable giving an output_vector given an input_vector]
298
- list is of length 2*output_vector length, first output_vector entries are real, second imaginary
299
- """
300
- input_vectors, output_vectors = self.get_all_inputs_outputs()
301
- self.inference = mlp_regression(input_vectors, output_vectors)
302
-
303
- def input_dict_to_input_vector(self, input_dict):
304
- """Convert an input_dict with trainable and non-trainable parameters to an input vector on which inference can be performed.
305
-
306
- Find faster way!
307
- """
308
- return_array = [
309
- value
310
- for key, value in input_dict.items()
311
- if key in self.trainable_parameters.keys()
312
- ]
313
- return jnp.array(return_array)
314
-
315
- def validate(self, num_samples=1):
316
- """Validates the model by calculating random points within the interpolation range, and comparing to predictions."""
317
- calculated_outputs_ids = []
318
- inferred_outputs = []
319
- validation_inputs = []
320
- for _index in range(num_samples):
321
- validation_inputs_local = self.get_random_dict()
322
- validation_inputs.append(validation_inputs_local)
323
- calculated_outputs_ids.append(
324
- self.get_output_from_inputs(
325
- validation_inputs_local.keys(),
326
- validation_inputs_local.values(),
327
- self.remote_function,
328
- )
329
- )
330
- inferred_outputs_local = [
331
- self.inference[mode](validation_inputs_local.values())
332
- for mode in range(self.num_modes)
333
- ]
334
- inferred_outputs.append(inferred_outputs_local)
335
-
336
- # Execute the jobs
337
- calculated_outputs_results = ray.get(calculated_outputs_ids)
338
-
339
- # Parse the outputs into input and output vectors
340
- calculated_outputs = [
341
- calculated_output_vector[1]
342
- for calculated_output_vector in calculated_outputs_results
343
- ]
344
- return validation_inputs, calculated_outputs, inferred_outputs