setupEM 0.16.0__tar.gz → 0.17.0__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 (45) hide show
  1. {setupem-0.16.0/src/setupEM.egg-info → setupem-0.17.0}/PKG-INFO +18 -9
  2. {setupem-0.16.0 → setupem-0.17.0}/README.md +8 -0
  3. {setupem-0.16.0 → setupem-0.17.0}/README_pypi.md +16 -7
  4. {setupem-0.16.0 → setupem-0.17.0}/pyproject.toml +1 -1
  5. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/__init__.py +1 -1
  6. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/config_update.py +3 -3
  7. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/data/SG13CMOS5L_200um.xml +1 -1
  8. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/data/SG13G2_FEM_200um.xml +1 -1
  9. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/data/SG13G2_FEM_200um_passi3D.xml +1 -1
  10. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/setupEM.py +11 -128
  11. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/setupThermal.py +229 -14
  12. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/setup_common.py +192 -11
  13. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/thermal_results.py +198 -3
  14. {setupem-0.16.0 → setupem-0.17.0/src/setupEM.egg-info}/PKG-INFO +18 -9
  15. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM.egg-info/SOURCES.txt +4 -1
  16. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM.egg-info/requires.txt +1 -1
  17. {setupem-0.16.0 → setupem-0.17.0}/tests/test_config_update_gui.py +16 -0
  18. setupem-0.17.0/tests/test_table_rows.py +102 -0
  19. setupem-0.17.0/tests/test_thermal_powers.py +233 -0
  20. setupem-0.17.0/tests/test_thermal_results.py +156 -0
  21. {setupem-0.16.0 → setupem-0.17.0}/LICENSE +0 -0
  22. {setupem-0.16.0 → setupem-0.17.0}/setup.cfg +0 -0
  23. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/__main__.py +0 -0
  24. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/data/SG13G2_100um.xml +0 -0
  25. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/data/SG13G2_200um.xml +0 -0
  26. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/data/SG13G2_nosub.xml +0 -0
  27. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/field_viewer.py +0 -0
  28. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/gds_hierarchy_scan.py +0 -0
  29. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/layout_preview.py +0 -0
  30. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/momentum_import.py +0 -0
  31. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/palace_results.py +0 -0
  32. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/result_viewer.py +0 -0
  33. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/run_with_overrides.py +0 -0
  34. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/script_model.py +0 -0
  35. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/script_probe.py +0 -0
  36. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/simplify_gds.py +0 -0
  37. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/stackupEditor.py +0 -0
  38. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM/stackup_writer.py +0 -0
  39. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM.egg-info/dependency_links.txt +0 -0
  40. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM.egg-info/entry_points.txt +0 -0
  41. {setupem-0.16.0 → setupem-0.17.0}/src/setupEM.egg-info/top_level.txt +0 -0
  42. {setupem-0.16.0 → setupem-0.17.0}/tests/test_config_update.py +0 -0
  43. {setupem-0.16.0 → setupem-0.17.0}/tests/test_run_with_overrides.py +0 -0
  44. {setupem-0.16.0 → setupem-0.17.0}/tests/test_script_model.py +0 -0
  45. {setupem-0.16.0 → setupem-0.17.0}/tests/test_script_probe.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: setupEM
3
- Version: 0.16.0
3
+ Version: 0.17.0
4
4
  Summary: Python tool for configuration of gds2palace workflow with GUI.
5
5
  Author-email: Volker Muehlhaus <volker@muehlhaus.com>
6
6
  License-Expression: GPL-3.0-or-later
@@ -10,7 +10,7 @@ Project-URL: Changelog, https://github.com/VolkerMuehlhaus/setupEM/blob/main/doc
10
10
  Requires-Python: >=3.9
11
11
  Description-Content-Type: text/markdown
12
12
  License-File: LICENSE
13
- Requires-Dist: gds2palace>=0.9.3
13
+ Requires-Dist: gds2palace>=0.9.4
14
14
  Requires-Dist: gds_prepare_for_EM>=1.6.0
15
15
  Requires-Dist: PySide6
16
16
  Requires-Dist: shiboken6
@@ -40,6 +40,21 @@ https://github.com/VolkerMuehlhaus/setupEM
40
40
 
41
41
  ## Recent changes
42
42
 
43
+ # What's New - November 5, 2026 (setupEM 0.17.0)
44
+
45
+ setupThermal works with the thermal export of the KLayout plug-in klayout_em_export (one heat source per transistor and resistor, with the schematic instance names from LVS in `<layout>_thermalmap.json`):
46
+ - **Load powers...** below the Thermal Sources + Boundaries list sets the powers from a file of your circuit simulation, by instance name. Needs gds2palace with `util_thermal_map`.
47
+ - The list names the device of each heat source (instance and pcell) and the region outline. Heat source layers above 299 count as present in the layout.
48
+ - The export's placeholder boundary (constant temperature on the region outline, no target layer) is listed as "region outline: choose the target layer"; Create Model refuses a boundary without a target layer.
49
+ - **Temperature per device**: after a run, the log lists the average and peak temperature of each heat source and their rise above the fixed temperature, and `<model>_temperatures.csv` next to the model script has the same per instance. Command line: `python -m setupEM.thermal_results <model>.tsimcfg`.
50
+
51
+ **Changes:**
52
+ - **Create Model also writes the settings file**, `<model>.simcfg` / `<model>.tsimcfg` next to the model script (as Save Config would), so that a layout tool's next export keeps your settings and the KLayout plug-in finds the layout's stackup, datatypes and thermal objects. It overwrites only a settings file of the same application. Opening a `.simcfg` that Create Model wrote with a script continues that script without asking.
53
+ - The Mesh tab's "Mesh refinement at metal edges" is now **"Mesh size at heat sources"**, which is what it sets in a thermal model (metal edges are not refined there).
54
+
55
+ **Fixes:**
56
+ - ElmerSolver no longer hangs at start on a Linux desktop where an X display does not accept connections ("Authorization required, but no authorization protocol specified"): setupThermal starts it with hwloc's OpenGL plug-in off (`HWLOC_COMPONENTS=-gl`, unless you set that variable).
57
+
43
58
  # What's New - October 31, 2026 (setupEM 0.16.0)
44
59
 
45
60
  **After a new export from the layout tool** (setupEM): a layout tool such as the KLayout plug-in klayout_em_export writes the GDSII file and a `.simcfg`, and writes both again when the layout changes. The settings you made in setupEM since are only in your model script, because Create Model writes the script, not the `.simcfg`. setupEM now takes from such a `.simcfg` only the ports, GDSII file, stackup, cell and purpose, and keeps everything else as in the script:
@@ -68,19 +83,13 @@ setupEM 0.16.0 needs gds2palace 0.9.3 or later: a layout with several shapes on
68
83
 
69
84
  Import and edit in place now read a stackup given as `utilities.get_stackup_path("SG13G2_FEM_200um.xml")`, the way the gds2palace MCP server writes it (needs gds2palace 0.9.1 or later). Before, an imported model using that syntax had no stackup file.
70
85
 
71
- # What's New - October 21, 2026
72
-
73
- **Tools > Simplify GDS:** the simplification code moved to gds_prepare_for_EM (module `gds_simplify_for_em`), where the gds2palace MCP server uses it too. setupEM now requires gds_prepare_for_EM 1.6.0 or later; `pip install --upgrade setupEM` updates it.
74
-
75
- Fix: with **Merge via arrays** (and no fill removal or merging per layer), the simplified file still contained the original subcells as extra top-level cells. Without a cell name, gds2palace reads the first top-level cell, which could be one of them, e.g. a pad cell instead of the design. These left-over cells are now removed.
76
-
77
86
  Full history: [CHANGES.md](https://github.com/VolkerMuehlhaus/setupEM/blob/main/doc/CHANGES.md)
78
87
 
79
88
  ---
80
89
 
81
90
  **Note:** the `setupEM` PyPI package itself requires:
82
91
 
83
- - gds2palace>=0.9.3
92
+ - gds2palace>=0.9.4
84
93
  - gds_prepare_for_EM>=1.6.0
85
94
  - PySide6
86
95
  - shiboken6
@@ -106,6 +106,12 @@ The package now includes setupThermal also, which is the equivalent of setupEM f
106
106
 
107
107
  AWS Palace is not used/required in thermal workflow, although we use the same gds2palace package.
108
108
 
109
+ **Powers from a circuit simulation.** The thermal export of the KLayout EM Export plug-in makes one heat source per transistor and resistor and writes `<layout>_thermalmap.json` next to the GDSII file, which says which device each heat source layer belongs to and, from LVS, its schematic instance name. The Thermal Sources + Boundaries list then shows that name next to each heat source, and **Load powers...** below the list sets the powers from a file of your circuit simulation: one line per device with the instance name (as in the LVS netlist, e.g. `Q1` or `Xcore.Q1`) and the power in W, separated by a comma, semicolon, tab or spaces (`Xcore.Q1, 2.5m`). Heat sources without a power keep theirs; names that match no heat source, or several, are listed and not used. Without setupThermal: `python -m gds2palace.util_thermal_map <layout>_thermalmap.json powers.csv <layout>.tsimcfg`. Needs a gds2palace with `util_thermal_map`.
110
+
111
+ **Boundary of a thermal export.** The export also writes the outline of the exported region on a layer of its own (201) and, as long as the model has no boundary yet, a constant-temperature row on it without a target layer. The list shows it as "region outline: choose the target layer"; pick the stackup layer where the temperature is fixed (e.g. the substrate backside) and Apply. Create Model refuses a boundary without a target layer.
112
+
113
+ **Temperature per device.** After each run, setupThermal lists the temperature of every heat source below the results summary and writes it to `<model>_temperatures.csv` next to the model script: instance name (from the thermal map), device, layer, power, the average temperature over the heat source and its hottest point, and both as rise above the fixed temperature of the model (for a circuit simulator's temperature rise per instance, e.g. `trise` / `dtemp`). Without setupThermal: `python -m setupEM.thermal_results <model>.tsimcfg`.
114
+
109
115
 
110
116
  ## User Interface
111
117
 
@@ -152,6 +158,8 @@ As explained in the [gds2palace documentation](https://github.com/VolkerMuehlhau
152
158
 
153
159
  In the upper part of the tab, you make your settings and then need to apply to the port list below.
154
160
 
161
+ The port list grows with the ports: it always keeps a few empty rows below the last port, so there is no fixed maximum number of ports. Versions up to 0.16.0 had a fixed list of 32 rows and silently dropped port 33 and higher when loading a config or model script; load such a model again with this version to get all its ports back. The same applies to the Thermal Sources + Boundaries list in setupThermal.
162
+
155
163
  <img src="./doc/png/ports1.png" alt="ports" width="700">
156
164
 
157
165
  Palace does not evaluate the port voltage parameter, but we use it internally to specify if ports are "active" during S-parameter simulation. To get the full S-parameters, all ports must be simulated with non-zero voltage, which means that all ports are excited one after another. If you want to simulate only selected excitations, for faster total simulation time, you can set ports to zero voltage. In that case, you will **not** get full S-parameters data and the missing paths are set to 0 in the output file.
@@ -11,6 +11,21 @@ https://github.com/VolkerMuehlhaus/setupEM
11
11
 
12
12
  ## Recent changes
13
13
 
14
+ # What's New - November 5, 2026 (setupEM 0.17.0)
15
+
16
+ setupThermal works with the thermal export of the KLayout plug-in klayout_em_export (one heat source per transistor and resistor, with the schematic instance names from LVS in `<layout>_thermalmap.json`):
17
+ - **Load powers...** below the Thermal Sources + Boundaries list sets the powers from a file of your circuit simulation, by instance name. Needs gds2palace with `util_thermal_map`.
18
+ - The list names the device of each heat source (instance and pcell) and the region outline. Heat source layers above 299 count as present in the layout.
19
+ - The export's placeholder boundary (constant temperature on the region outline, no target layer) is listed as "region outline: choose the target layer"; Create Model refuses a boundary without a target layer.
20
+ - **Temperature per device**: after a run, the log lists the average and peak temperature of each heat source and their rise above the fixed temperature, and `<model>_temperatures.csv` next to the model script has the same per instance. Command line: `python -m setupEM.thermal_results <model>.tsimcfg`.
21
+
22
+ **Changes:**
23
+ - **Create Model also writes the settings file**, `<model>.simcfg` / `<model>.tsimcfg` next to the model script (as Save Config would), so that a layout tool's next export keeps your settings and the KLayout plug-in finds the layout's stackup, datatypes and thermal objects. It overwrites only a settings file of the same application. Opening a `.simcfg` that Create Model wrote with a script continues that script without asking.
24
+ - The Mesh tab's "Mesh refinement at metal edges" is now **"Mesh size at heat sources"**, which is what it sets in a thermal model (metal edges are not refined there).
25
+
26
+ **Fixes:**
27
+ - ElmerSolver no longer hangs at start on a Linux desktop where an X display does not accept connections ("Authorization required, but no authorization protocol specified"): setupThermal starts it with hwloc's OpenGL plug-in off (`HWLOC_COMPONENTS=-gl`, unless you set that variable).
28
+
14
29
  # What's New - October 31, 2026 (setupEM 0.16.0)
15
30
 
16
31
  **After a new export from the layout tool** (setupEM): a layout tool such as the KLayout plug-in klayout_em_export writes the GDSII file and a `.simcfg`, and writes both again when the layout changes. The settings you made in setupEM since are only in your model script, because Create Model writes the script, not the `.simcfg`. setupEM now takes from such a `.simcfg` only the ports, GDSII file, stackup, cell and purpose, and keeps everything else as in the script:
@@ -39,19 +54,13 @@ setupEM 0.16.0 needs gds2palace 0.9.3 or later: a layout with several shapes on
39
54
 
40
55
  Import and edit in place now read a stackup given as `utilities.get_stackup_path("SG13G2_FEM_200um.xml")`, the way the gds2palace MCP server writes it (needs gds2palace 0.9.1 or later). Before, an imported model using that syntax had no stackup file.
41
56
 
42
- # What's New - October 21, 2026
43
-
44
- **Tools > Simplify GDS:** the simplification code moved to gds_prepare_for_EM (module `gds_simplify_for_em`), where the gds2palace MCP server uses it too. setupEM now requires gds_prepare_for_EM 1.6.0 or later; `pip install --upgrade setupEM` updates it.
45
-
46
- Fix: with **Merge via arrays** (and no fill removal or merging per layer), the simplified file still contained the original subcells as extra top-level cells. Without a cell name, gds2palace reads the first top-level cell, which could be one of them, e.g. a pad cell instead of the design. These left-over cells are now removed.
47
-
48
57
  Full history: [CHANGES.md](https://github.com/VolkerMuehlhaus/setupEM/blob/main/doc/CHANGES.md)
49
58
 
50
59
  ---
51
60
 
52
61
  **Note:** the `setupEM` PyPI package itself requires:
53
62
 
54
- - gds2palace>=0.9.3
63
+ - gds2palace>=0.9.4
55
64
  - gds_prepare_for_EM>=1.6.0
56
65
  - PySide6
57
66
  - shiboken6
@@ -12,7 +12,7 @@ authors = [
12
12
  { name = "Volker Muehlhaus", email = "volker@muehlhaus.com" }
13
13
  ]
14
14
  dependencies = [
15
- "gds2palace>=0.9.3",
15
+ "gds2palace>=0.9.4",
16
16
  "gds_prepare_for_EM>=1.6.0",
17
17
  "PySide6",
18
18
  "shiboken6",
@@ -24,4 +24,4 @@ A Python tool for EM setup using gds2palace.
24
24
  from .setupEM import main
25
25
 
26
26
  __all__ = ["main"]
27
- __version__ = "0.16.0"
27
+ __version__ = "0.17.0"
@@ -161,9 +161,9 @@ def _reads_gds(script_path, gds_path):
161
161
 
162
162
  def model_scripts(gds_path, folders):
163
163
  """Model scripts (*.py) in folders that read gds_path, newest first. Their age says nothing against a settings
164
- file of the same layout: a layout tool writes that file again on every export, also after the script was made,
165
- while the settings made in setupEM since are only in the script (Create Model writes the script, not the
166
- settings file)."""
164
+ file of the same layout: a layout tool writes that file again on every export, also after the script was made.
165
+ The script is the model; Create Model also writes the settings to <model>.simcfg, but another settings file of
166
+ the layout (or one saved before) does not have the settings made in setupEM since."""
167
167
  seen, out = set(), []
168
168
  for folder in folders:
169
169
  if not folder or not os.path.isdir(folder):
@@ -11,7 +11,7 @@
11
11
  <Variable Name="bulk_thickness" Value="=total_thickness-13.05" />
12
12
  </Variables>
13
13
  <Materials>
14
- <Material Name="Activ" Type="Conductor" Conductivity="357141.0" ThermalConductivity="50" Color="00ff00" />
14
+ <Material Name="Activ" Type="Conductor" Conductivity="357141.0" ThermalConductivityTable="Si_vs_T_IHP" Color="00ff00" />
15
15
  <Material Name="Metal1" Type="Conductor" Conductivity="21640000.0" ThermalConductivity="237" Color="39bfff" />
16
16
  <Material Name="Metal2" Type="Conductor" Conductivity="23190000.0" ThermalConductivity="237" Color="ccccd9" />
17
17
  <Material Name="Metal3" Type="Conductor" Conductivity="23190000.0" ThermalConductivity="237" Color="d80000" />
@@ -12,7 +12,7 @@
12
12
  <!-- selects which <Table> below Substrate's ThermalConductivityTable resolves to -->
13
13
  </Variables>
14
14
  <Materials>
15
- <Material Name="Activ" Type="Conductor" Conductivity="357141.0" ThermalConductivity="50" Color="00ff00" />
15
+ <Material Name="Activ" Type="Conductor" Conductivity="357141.0" ThermalConductivityTable="Si_vs_T_IHP" Color="00ff00" />
16
16
  <Material Name="Metal1" Type="Conductor" Conductivity="21640000.0" ThermalConductivity="237" Color="39bfff" />
17
17
  <Material Name="Metal2" Type="Conductor" Conductivity="23190000.0" ThermalConductivity="237" Color="ccccd9" />
18
18
  <Material Name="Metal3" Type="Conductor" Conductivity="23190000.0" ThermalConductivity="237" Color="d80000" />
@@ -11,7 +11,7 @@
11
11
  <Variable Name="bulk_thickness" Value="=total_thickness-19.88" />
12
12
  </Variables>
13
13
  <Materials>
14
- <Material Name="Activ" Type="Conductor" Conductivity="357141.0" ThermalConductivity="50" Color="00ff00" />
14
+ <Material Name="Activ" Type="Conductor" Conductivity="357141.0" ThermalConductivityTable="Si_vs_T_IHP" Color="00ff00" />
15
15
  <Material Name="Metal1" Type="Conductor" Conductivity="21640000.0" ThermalConductivity="237" Color="39bfff" />
16
16
  <Material Name="Metal2" Type="Conductor" Conductivity="23190000.0" ThermalConductivity="237" Color="ccccd9" />
17
17
  <Material Name="Metal3" Type="Conductor" Conductivity="23190000.0" ThermalConductivity="237" Color="d80000" />
@@ -54,9 +54,9 @@ if __package__ in (None, ""):
54
54
  EDIT_STYLE_OPTIONAL, EDIT_STYLE_REQUIRED, COMBO_STYLE_REQUIRED, COMBO_STYLE_OPTIONAL,
55
55
  SECONDARY_BUTTON_WIDTH,
56
56
  FileDropLineEdit, FileInputTab, PythonHighlighter, CodeEditor,
57
- VectorWidget, PopUpWindow, CreateModelTabBase, MainWindowBase,
57
+ VectorWidget, PopUpWindow, CreateModelTabBase, MainWindowBase, RefinedCellsizeOverrideDialog,
58
58
  epsilon_to_color, default_stackup_dielectric_label, default_stackup_metal_label,
59
- next_available_source_layer, update_missing_layer_column,
59
+ next_available_source_layer, update_missing_layer_column, ensure_table_rows,
60
60
  get_preference, get_preference_bool, set_preference, clear_preferences,
61
61
  eval_simple_python_expression, collect_module_level_constants,
62
62
  find_paraview_exe, FILL_FACTOR_CORRECTION_SOLVERS, PALACE_LINEAR_SOLVER_SETTINGS,
@@ -71,9 +71,9 @@ else:
71
71
  EDIT_STYLE_OPTIONAL, EDIT_STYLE_REQUIRED, COMBO_STYLE_REQUIRED, COMBO_STYLE_OPTIONAL,
72
72
  SECONDARY_BUTTON_WIDTH,
73
73
  FileDropLineEdit, FileInputTab, PythonHighlighter, CodeEditor,
74
- VectorWidget, PopUpWindow, CreateModelTabBase, MainWindowBase,
74
+ VectorWidget, PopUpWindow, CreateModelTabBase, MainWindowBase, RefinedCellsizeOverrideDialog,
75
75
  epsilon_to_color, default_stackup_dielectric_label, default_stackup_metal_label,
76
- next_available_source_layer, update_missing_layer_column,
76
+ next_available_source_layer, update_missing_layer_column, ensure_table_rows,
77
77
  get_preference, get_preference_bool, set_preference, clear_preferences,
78
78
  eval_simple_python_expression, collect_module_level_constants,
79
79
  find_paraview_exe, FILL_FACTOR_CORRECTION_SOLVERS, PALACE_LINEAR_SOLVER_SETTINGS,
@@ -635,6 +635,7 @@ class PortsTab(QWidget):
635
635
 
636
636
  for col, value in enumerate(data):
637
637
  self.portslist.setItem(selected_row, col, QTableWidgetItem(str(value)))
638
+ ensure_table_rows(self.portslist, selected_row + 1) # empty rows below for the next ports
638
639
 
639
640
  self.refresh_missing_layer_annotations()
640
641
 
@@ -844,6 +845,8 @@ class PortsTab(QWidget):
844
845
  # update ports from imported model code in our native JSON format
845
846
 
846
847
  self.portslist.clearContents()
848
+ numbers = [int(p["portnumber"]) for p in ports if p.get("portnumber") is not None]
849
+ ensure_table_rows(self.portslist, max(numbers, default=0)) # port n in row n-1
847
850
  for port in ports:
848
851
  # each port is a dictionary
849
852
  portnum = port.get("portnumber", None)
@@ -871,130 +874,6 @@ class PortsTab(QWidget):
871
874
 
872
875
 
873
876
 
874
- class RefinedCellsizeOverrideDialog(QDialog):
875
- """Popup editor for settings['refined_cellsize_override'], opened from
876
- MeshTab's "Advanced..." button. Lets the user set a different mesh
877
- refinement cell size for specific metal/sheet layers, instead of the
878
- single global "Mesh refinement at metal edges" value. The Layer column
879
- is restricted to metals_list.getallplanarmetals() (conductor/sheet
880
- layers) - vias and dielectrics never produce boundary curves in
881
- gds2palace's meshing code, so a name outside that list would silently
882
- have no effect if it were allowed to be typed in.
883
- """
884
-
885
- def __init__(self, parent, layer_choices, current_overrides):
886
- super().__init__(parent)
887
- self.setAttribute(Qt.WA_DeleteOnClose)
888
- self.setWindowTitle("Mesh Refinement Overrides")
889
- self.resize(420, 400)
890
- self.setModal(True)
891
-
892
- self._layer_choices = layer_choices
893
- self._result = []
894
-
895
- layout = QVBoxLayout()
896
-
897
- info = QLabel("Override the mesh refinement cell size for specific layers\n"
898
- "(all other layers keep using the default set above).")
899
- layout.addWidget(info)
900
-
901
- self.table = QTableWidget()
902
- self.table.setColumnCount(3)
903
- self.table.setHorizontalHeaderLabels(["Layer", "Cell size (µm)", ""])
904
- self.table.verticalHeader().setVisible(False)
905
- self.table.setSelectionMode(QAbstractItemView.SelectionMode.NoSelection)
906
- header = self.table.horizontalHeader()
907
- header.setSectionResizeMode(0, QHeaderView.ResizeMode.Stretch)
908
- header.setSectionResizeMode(1, QHeaderView.ResizeMode.ResizeToContents)
909
- header.setSectionResizeMode(2, QHeaderView.ResizeMode.ResizeToContents)
910
- layout.addWidget(self.table)
911
-
912
- for name, value in current_overrides:
913
- self._add_row(name, value)
914
-
915
- add_row_layout = QHBoxLayout()
916
- add_btn = QPushButton("+ Add Row")
917
- add_btn.clicked.connect(lambda: self._add_row())
918
- add_row_layout.addWidget(add_btn)
919
- add_row_layout.addStretch()
920
- layout.addLayout(add_row_layout)
921
-
922
- button_layout = QHBoxLayout()
923
- button_layout.addStretch()
924
- ok_btn = QPushButton("OK")
925
- ok_btn.clicked.connect(self._on_ok)
926
- button_layout.addWidget(ok_btn)
927
- cancel_btn = QPushButton("Cancel")
928
- cancel_btn.clicked.connect(self.reject)
929
- button_layout.addWidget(cancel_btn)
930
- layout.addLayout(button_layout)
931
-
932
- self.setLayout(layout)
933
-
934
- def _add_row(self, name="", value=""):
935
- row = self.table.rowCount()
936
- self.table.insertRow(row)
937
-
938
- combo = QComboBox()
939
- combo.setStyleSheet(COMBO_STYLE_OPTIONAL)
940
- combo.addItem("")
941
- combo.addItems(self._layer_choices)
942
- if name and name not in self._layer_choices:
943
- # tolerate a saved override for a layer no longer in the current
944
- # stackup, same tolerant style as the Cellname combo box
945
- combo.addItem(name)
946
- if name:
947
- combo.setCurrentText(name)
948
- self.table.setCellWidget(row, 0, combo)
949
-
950
- value_text = "" if value == "" else str(value)
951
- self.table.setItem(row, 1, QTableWidgetItem(value_text))
952
-
953
- remove_btn = QPushButton("✕")
954
- remove_btn.setFixedWidth(28)
955
- remove_btn.clicked.connect(lambda: self._remove_row_containing(remove_btn))
956
- self.table.setCellWidget(row, 2, remove_btn)
957
-
958
- def _remove_row_containing(self, button):
959
- # look up the row by identity rather than a captured index, since
960
- # row indices shift whenever an earlier row is removed
961
- for row in range(self.table.rowCount()):
962
- if self.table.cellWidget(row, 2) is button:
963
- self.table.removeRow(row)
964
- return
965
-
966
- def _on_ok(self):
967
- overrides = []
968
- seen_layers = set()
969
- for row in range(self.table.rowCount()):
970
- combo = self.table.cellWidget(row, 0)
971
- layer = combo.currentText().strip() if combo else ""
972
- if not layer:
973
- continue # blank row - not yet configured, skip silently
974
-
975
- value_item = self.table.item(row, 1)
976
- value_text = value_item.text().strip() if value_item else ""
977
- try:
978
- value = float(value_text)
979
- if value <= 0:
980
- raise ValueError
981
- except ValueError:
982
- QMessageBox.warning(self, "Error", f"Not a valid cell size for layer '{layer}'")
983
- return
984
-
985
- if layer in seen_layers:
986
- QMessageBox.warning(self, "Error", f"Layer '{layer}' is selected more than once")
987
- return
988
- seen_layers.add(layer)
989
- overrides.append([layer, value])
990
-
991
- self._result = overrides
992
- self.accept()
993
-
994
- def get_overrides(self):
995
- return self._result
996
-
997
-
998
877
  # the 6 sides of the simulation box, in the order of gds2palace's 6-value
999
878
  # settings['boundary'] and settings['air_around'] lists, with their dialog labels
1000
879
  BOX_SIDES = [("xmin", "xmin"), ("xmax", "xmax"), ("ymin", "ymin"), ("ymax", "ymax"),
@@ -2608,6 +2487,10 @@ class CreateModelTab(CreateModelTabBase):
2608
2487
 
2609
2488
  self.write_model_code(pymodel_filename, code)
2610
2489
  confirmed_paths.add(normalized_path)
2490
+ # the settings also as <model>.simcfg / .tsimcfg next to it (write_model_config)
2491
+ config_path = self.MainWindow.write_model_config(pymodel_filename)
2492
+ if config_path:
2493
+ self.log_area.appendPlainText(f"Settings saved with it: {config_path}")
2611
2494
 
2612
2495
  # Run Python interpreter on that file
2613
2496
  python_exe = sys.executable # Use the same Python interpreter