setupEM 0.18.0__tar.gz → 0.18.2__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 (59) hide show
  1. {setupem-0.18.0/src/setupEM.egg-info → setupem-0.18.2}/PKG-INFO +30 -36
  2. {setupem-0.18.0 → setupem-0.18.2}/README.md +7 -2
  3. {setupem-0.18.0 → setupem-0.18.2}/README_pypi.md +28 -34
  4. {setupem-0.18.0 → setupem-0.18.2}/pyproject.toml +1 -1
  5. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/__init__.py +9 -2
  6. setupem-0.18.2/src/setupEM/cli_common.py +86 -0
  7. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/config_update.py +120 -2
  8. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/field_viewer.py +41 -23
  9. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/join_pieces.py +17 -6
  10. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/piece_set.py +97 -8
  11. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/result_viewer.py +10 -6
  12. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/setupEM.py +81 -40
  13. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/setupThermal.py +56 -27
  14. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/setup_common.py +168 -40
  15. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/stackupEditor.py +8 -4
  16. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/thermal_results.py +15 -8
  17. {setupem-0.18.0 → setupem-0.18.2/src/setupEM.egg-info}/PKG-INFO +30 -36
  18. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM.egg-info/SOURCES.txt +4 -0
  19. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM.egg-info/requires.txt +1 -1
  20. setupem-0.18.2/tests/test_cli_startup.py +289 -0
  21. setupem-0.18.2/tests/test_config_update.py +179 -0
  22. setupem-0.18.2/tests/test_config_update_gui.py +352 -0
  23. setupem-0.18.2/tests/test_export_no_gui.py +43 -0
  24. {setupem-0.18.0 → setupem-0.18.2}/tests/test_piece_set.py +70 -7
  25. setupem-0.18.2/tests/test_return_applies.py +89 -0
  26. {setupem-0.18.0 → setupem-0.18.2}/tests/test_thermal_results.py +7 -1
  27. setupem-0.18.0/tests/test_config_update.py +0 -83
  28. setupem-0.18.0/tests/test_config_update_gui.py +0 -185
  29. {setupem-0.18.0 → setupem-0.18.2}/LICENSE +0 -0
  30. {setupem-0.18.0 → setupem-0.18.2}/setup.cfg +0 -0
  31. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/__main__.py +0 -0
  32. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/data/SG13CMOS5L_200um.xml +0 -0
  33. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/data/SG13G2_100um.xml +0 -0
  34. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/data/SG13G2_200um.xml +0 -0
  35. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/data/SG13G2_FEM_200um.xml +0 -0
  36. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/data/SG13G2_FEM_200um_passi3D.xml +0 -0
  37. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/data/SG13G2_nosub.xml +0 -0
  38. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/gds_hierarchy_scan.py +0 -0
  39. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/layout_preview.py +0 -0
  40. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/momentum_import.py +0 -0
  41. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/palace_results.py +0 -0
  42. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/run_with_overrides.py +0 -0
  43. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/script_model.py +0 -0
  44. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/script_probe.py +0 -0
  45. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/simplify_gds.py +0 -0
  46. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM/stackup_writer.py +0 -0
  47. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM.egg-info/dependency_links.txt +0 -0
  48. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM.egg-info/entry_points.txt +0 -0
  49. {setupem-0.18.0 → setupem-0.18.2}/src/setupEM.egg-info/top_level.txt +0 -0
  50. {setupem-0.18.0 → setupem-0.18.2}/tests/test_deembedded_view.py +0 -0
  51. {setupem-0.18.0 → setupem-0.18.2}/tests/test_join_pieces.py +0 -0
  52. {setupem-0.18.0 → setupem-0.18.2}/tests/test_margin_per_side.py +0 -0
  53. {setupem-0.18.0 → setupem-0.18.2}/tests/test_port_walls.py +0 -0
  54. {setupem-0.18.0 → setupem-0.18.2}/tests/test_qt_platform_noise.py +0 -0
  55. {setupem-0.18.0 → setupem-0.18.2}/tests/test_run_with_overrides.py +0 -0
  56. {setupem-0.18.0 → setupem-0.18.2}/tests/test_script_model.py +0 -0
  57. {setupem-0.18.0 → setupem-0.18.2}/tests/test_script_probe.py +0 -0
  58. {setupem-0.18.0 → setupem-0.18.2}/tests/test_table_rows.py +0 -0
  59. {setupem-0.18.0 → setupem-0.18.2}/tests/test_thermal_powers.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: setupEM
3
- Version: 0.18.0
3
+ Version: 0.18.2
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.10.0
13
+ Requires-Dist: gds2palace>=0.10.1
14
14
  Requires-Dist: gds_prepare_for_EM>=1.6.0
15
15
  Requires-Dist: PySide6
16
16
  Requires-Dist: shiboken6
@@ -40,6 +40,33 @@ https://github.com/VolkerMuehlhaus/setupEM
40
40
 
41
41
  ## Recent changes
42
42
 
43
+ # What's New - November 13, 2026 (setupEM 0.18.2)
44
+
45
+ **Ports and thermal objects:** Return in a text field of the form (source layer, Z0, voltage; in setupThermal layer, power, temperature) applies the settings to the selected row, like the Apply button. With no row selected, the status bar says so.
46
+
47
+ **Command line fixes** (from issue #52):
48
+ - A script from File > Export runs without a display: gds2palace 0.10.4 and newer builds the model without the gmsh window on Linux with no display (ssh, container, batch job). Before, the script stopped with "Can't open display". The exported script also has the switch as a comment, `# settings['no_gui'] = True`, for unattended runs where a display exists.
49
+ - `combine_extend_snp.py` (`combine_snp`, in `scripts/`) has `--help` and `--version`, and takes the folder to search as an optional argument. Before, any option was ignored and the conversion ran. Same file as in gds2palace 0.10.4.
50
+
51
+ **Scripts used on two machines** (e.g. Windows and Linux):
52
+ - A model script edited in place whose GDS file was taken from its folder on opening (the script had the other machine's path, e.g. `/mnt/pub/...` for `P:/...`) now gets that path when it is saved or the model is created; the Code tab shows it. Before, the GUI showed the new path and the script kept the old one, and the model was made from the old one.
53
+ - On Linux, a path with a drive letter from Windows (`D:/...`) in a script or settings file is no longer taken as relative to the script's folder (`/mnt/.../D:/...`, "Load a GDSII file and XML stackup first"). A stackup that is not found, also not next to the script, is taken from the stackups that ship with gds2palace if one has that name; the log says so.
54
+
55
+ # What's New - November 11, 2026 (setupEM 0.18.1)
56
+
57
+ **Command line fixes** (from issue #52, use without a display):
58
+ - `--help`, `--version` and a wrong argument of `setupEM`, `setupThermal`, `stackupEditor`, `resultViewer` and `fieldViewer` no longer need a display: the arguments are read before Qt starts. All five have `--version` now.
59
+ - `setupEM -simcfg <file>` opens a settings file of an Elmer model in Elmer mode. It opened in Palace mode unless `--elmer` was given, also when started from the KLayout plug-in.
60
+ - A `-simcfg`, `-gdsfile` or `-xmlfile` that does not exist, or a settings file of the other application, ends `setupEM` / `setupThermal` with a message on stderr and exit code 2 instead of an empty window. In the GUI, a settings file that is gone is reported as "File not found", not as "Unknown data format".
61
+ - Loading a settings file no longer shows a "Loaded" box: the log says "Config loaded from ...", with a GDS or stackup file that was not found at its saved path and was taken from the settings file's folder instead.
62
+ - Opening a `.simcfg` continues with the model script only when the file is linked to it, and asks only when the two have other settings (the question lists them). Create Model links: besides `<model>.simcfg` it writes the script's name (`"model_script"`) into the `.simcfg` the model was opened from, e.g. the KLayout plug-in's export, which keeps it on the next export. A script that only reads the same GDSII file is no longer taken for the model; the log names it. New options `--continue-with-script` and `--start-from-config` answer the question on the command line.
63
+ - `fieldViewer --screenshot` needs no display and no `QT_QPA_PLATFORM=offscreen`.
64
+ - `python -m setupEM.join_pieces` and `python -m setupEM.thermal_results` have `--help` and `--version`, write their errors to stderr, and a missing file is a message, not a traceback.
65
+ - The modules without a GUI (`join_pieces`, `thermal_results`, `script_model`, ...) can be imported without loading Qt.
66
+ - User guide: Model Fit starts snp2le with the result file loaded (the text said it has to be loaded by hand).
67
+
68
+ **Split regions, fix:**a side of the region made a port wall in setupEM after the export (e.g. with via ports of the layout on the region's edge) was a plain PEC wall in every piece and in the full check model: the wall shorted those ports, and the joined result and the full model were both wrong, in the same way. The pieces' port walls on the region's edge are now found from the ports on the edge of each piece's layout; the full model has all of the region's port walls. Where the region has a port wall but a piece none of its ports, that stretch stays PEC and now moves outward with the region's port wall extension (a length; written as `settings['wall_extension']`, needs gds2palace 0.10.1), so that all pieces and the full model have the same box.
69
+
43
70
  # What's New - November 10, 2026 (setupEM 0.18.0)
44
71
 
45
72
  **De-embedded results shown**: View S-Parameters lists the `_deembedded` files from the start and opens with the raw result and its `_deembedded` result together. Model Fit fits the calibrated result (`_dc_deembedded`, else `_deembedded`) of a model with port walls or a moved reference plane; the raw result still holds the uncalibrated gap ports.
@@ -56,46 +83,13 @@ The dielectric oversize can be set per side (xmin, xmax, ymin, ymax): in setupEM
56
83
 
57
84
  Bundled IHP stackups (from gds2palace 0.10.0): heat source target layers `HEAT_TRANSISTOR` and `HEAT_RESISTOR`, for thermal models. Nothing is drawn on them, so EM models are unchanged.
58
85
 
59
- # What's New - November 5, 2026 (setupEM 0.17.0)
60
-
61
- 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`):
62
- - **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`.
63
- - 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.
64
- - 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.
65
- - **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`.
66
-
67
- **Changes:**
68
- - **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.
69
- - 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).
70
-
71
- **Fixes:**
72
- - 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).
73
-
74
- # What's New - October 31, 2026 (setupEM 0.16.0)
75
-
76
- **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:
77
- - Opening a `.simcfg` when a model script for the same GDSII file exists next to it asks whether to **Continue with the script** (edit it in place, ports and layout settings from the `.simcfg`) or **Start from the config**.
78
- - Loading a `.simcfg` while editing a script in place lists the ports and layout settings that differ and asks whether to **Update the script from it** or **Open it as a new model**. Before, loading it ended editing in place and replaced all settings.
79
- - While editing a script in place, the bar below the menu points out a newer `.simcfg` of the same GDSII file with other ports or layout settings, with **Update from it**.
80
-
81
- **Load Config, Import from \*.py model and Edit \*.py model in place** start in the folder of the model you are working on (the config or script loaded last, else the GDSII file). Before, they started in the folder setupEM was launched from, e.g. KLayout's when the KLayout plug-in opened setupEM.
82
-
83
- setupEM 0.16.0 needs gds2palace 0.9.3 or later: a layout with several shapes on one port layer (e.g. a transistor terminal on several fingers, from the KLayout plug-in) makes one port with several elements there; older gds2palace versions used only the last shape.
84
-
85
- **Fixes:**
86
- - `scripts/combine_extend_snp.py` is the same as gds2palace's again. It had missed three fixes made there in September: the port impedance lookup for AMR iterations, the missing `.sNp` extension for a model name that contains a dot, and Touchstone output after an interrupted Palace run.
87
- - On Linux with GNOME (Wayland), the mouse cursor no longer keeps spinning for about 10 seconds after setupEM starts. setupEM briefly opened three invisible windows while building the Input Files tab, and GNOME waited for them to finish starting.
88
- - Via ports with direction `-Z` keep their from and to layers. Before, loading a `.simcfg` dropped them, and Create Model wrote such a port as an in-plane port.
89
- - An incomplete port (direction and layers that don't fit, e.g. from a `.simcfg` written by another tool) gives a warning in the Ports tab. Before, gds2palace exited and setupEM closed. A lowercase `z` counts as a via port too.
90
- - `combine_extend_snp` (Touchstone output after a Palace run) handles ports with several elements (several shapes on one port layer, gds2palace 0.9.3): one Z0 per port in the option line, and the elements' port inductances combined in parallel for de-embedding. Before, the last element overwrote the others.
91
-
92
86
  Full history: [CHANGES.md](https://github.com/VolkerMuehlhaus/setupEM/blob/main/doc/CHANGES.md)
93
87
 
94
88
  ---
95
89
 
96
90
  **Note:** the `setupEM` PyPI package itself requires:
97
91
 
98
- - gds2palace>=0.10.0
92
+ - gds2palace>=0.10.1
99
93
  - gds_prepare_for_EM>=1.6.0
100
94
  - PySide6
101
95
  - shiboken6
@@ -4,7 +4,12 @@
4
4
 
5
5
  ## What's New
6
6
 
7
- Reserved PEC/AIR stackup materials, Layout Preview, Results viewer, Model Fit, built-in 3D field viewer, GDSII Layout Simplification, XML Stackup Editor, setupThermal for Elmer thermal simulation.
7
+ - **Port walls**: calibrated ports at the layout edge, de-embedded results
8
+ - **Split regions** from the [KLayout plug-in](https://github.com/VolkerMuehlhaus/klayout_em_export): pieces simulated and joined
9
+ - **Edit \*.py model in place**, also with parameter sweeps
10
+ - **Conductor model** with skin layers, **boundary conditions per side**
11
+ - **setupThermal**: powers and temperatures per device
12
+ - Layout Preview, Results viewer, Model Fit, 3D field viewer, GDSII simplification
8
13
 
9
14
  See [CHANGES.md](doc/CHANGES.md) for details.
10
15
 
@@ -245,7 +250,7 @@ If snp2le isn't installed, setupEM offers to install it for you via pip:
245
250
 
246
251
  Choosing **Install** runs `pip install snp2le` in the Log panel and, once it succeeds, continues automatically - no need to click Model Fit a second time. Choosing **Cancel** logs the manual install command and the project link instead.
247
252
 
248
- Once snp2le is available, Model Fit locates the raw (not `_dc`, not `_deembedded`) Touchstone result file for the current run and launches the snp2le GUI in that file's directory. snp2le's GUI has no command-line option to preload a file, so the exact path is printed to the Log panel - load it via snp2le's own file picker:
253
+ Once snp2le is available, Model Fit locates the raw (not `_dc`, not `_deembedded`) Touchstone result file for the current run and starts the snp2le GUI with that file loaded, in that file's directory. The Log panel names the file:
249
254
 
250
255
  <img src="./doc/png/modelfit2.png" alt="snp2le starting" width="700">
251
256
 
@@ -11,6 +11,33 @@ https://github.com/VolkerMuehlhaus/setupEM
11
11
 
12
12
  ## Recent changes
13
13
 
14
+ # What's New - November 13, 2026 (setupEM 0.18.2)
15
+
16
+ **Ports and thermal objects:** Return in a text field of the form (source layer, Z0, voltage; in setupThermal layer, power, temperature) applies the settings to the selected row, like the Apply button. With no row selected, the status bar says so.
17
+
18
+ **Command line fixes** (from issue #52):
19
+ - A script from File > Export runs without a display: gds2palace 0.10.4 and newer builds the model without the gmsh window on Linux with no display (ssh, container, batch job). Before, the script stopped with "Can't open display". The exported script also has the switch as a comment, `# settings['no_gui'] = True`, for unattended runs where a display exists.
20
+ - `combine_extend_snp.py` (`combine_snp`, in `scripts/`) has `--help` and `--version`, and takes the folder to search as an optional argument. Before, any option was ignored and the conversion ran. Same file as in gds2palace 0.10.4.
21
+
22
+ **Scripts used on two machines** (e.g. Windows and Linux):
23
+ - A model script edited in place whose GDS file was taken from its folder on opening (the script had the other machine's path, e.g. `/mnt/pub/...` for `P:/...`) now gets that path when it is saved or the model is created; the Code tab shows it. Before, the GUI showed the new path and the script kept the old one, and the model was made from the old one.
24
+ - On Linux, a path with a drive letter from Windows (`D:/...`) in a script or settings file is no longer taken as relative to the script's folder (`/mnt/.../D:/...`, "Load a GDSII file and XML stackup first"). A stackup that is not found, also not next to the script, is taken from the stackups that ship with gds2palace if one has that name; the log says so.
25
+
26
+ # What's New - November 11, 2026 (setupEM 0.18.1)
27
+
28
+ **Command line fixes** (from issue #52, use without a display):
29
+ - `--help`, `--version` and a wrong argument of `setupEM`, `setupThermal`, `stackupEditor`, `resultViewer` and `fieldViewer` no longer need a display: the arguments are read before Qt starts. All five have `--version` now.
30
+ - `setupEM -simcfg <file>` opens a settings file of an Elmer model in Elmer mode. It opened in Palace mode unless `--elmer` was given, also when started from the KLayout plug-in.
31
+ - A `-simcfg`, `-gdsfile` or `-xmlfile` that does not exist, or a settings file of the other application, ends `setupEM` / `setupThermal` with a message on stderr and exit code 2 instead of an empty window. In the GUI, a settings file that is gone is reported as "File not found", not as "Unknown data format".
32
+ - Loading a settings file no longer shows a "Loaded" box: the log says "Config loaded from ...", with a GDS or stackup file that was not found at its saved path and was taken from the settings file's folder instead.
33
+ - Opening a `.simcfg` continues with the model script only when the file is linked to it, and asks only when the two have other settings (the question lists them). Create Model links: besides `<model>.simcfg` it writes the script's name (`"model_script"`) into the `.simcfg` the model was opened from, e.g. the KLayout plug-in's export, which keeps it on the next export. A script that only reads the same GDSII file is no longer taken for the model; the log names it. New options `--continue-with-script` and `--start-from-config` answer the question on the command line.
34
+ - `fieldViewer --screenshot` needs no display and no `QT_QPA_PLATFORM=offscreen`.
35
+ - `python -m setupEM.join_pieces` and `python -m setupEM.thermal_results` have `--help` and `--version`, write their errors to stderr, and a missing file is a message, not a traceback.
36
+ - The modules without a GUI (`join_pieces`, `thermal_results`, `script_model`, ...) can be imported without loading Qt.
37
+ - User guide: Model Fit starts snp2le with the result file loaded (the text said it has to be loaded by hand).
38
+
39
+ **Split regions, fix:**a side of the region made a port wall in setupEM after the export (e.g. with via ports of the layout on the region's edge) was a plain PEC wall in every piece and in the full check model: the wall shorted those ports, and the joined result and the full model were both wrong, in the same way. The pieces' port walls on the region's edge are now found from the ports on the edge of each piece's layout; the full model has all of the region's port walls. Where the region has a port wall but a piece none of its ports, that stretch stays PEC and now moves outward with the region's port wall extension (a length; written as `settings['wall_extension']`, needs gds2palace 0.10.1), so that all pieces and the full model have the same box.
40
+
14
41
  # What's New - November 10, 2026 (setupEM 0.18.0)
15
42
 
16
43
  **De-embedded results shown**: View S-Parameters lists the `_deembedded` files from the start and opens with the raw result and its `_deembedded` result together. Model Fit fits the calibrated result (`_dc_deembedded`, else `_deembedded`) of a model with port walls or a moved reference plane; the raw result still holds the uncalibrated gap ports.
@@ -27,46 +54,13 @@ The dielectric oversize can be set per side (xmin, xmax, ymin, ymax): in setupEM
27
54
 
28
55
  Bundled IHP stackups (from gds2palace 0.10.0): heat source target layers `HEAT_TRANSISTOR` and `HEAT_RESISTOR`, for thermal models. Nothing is drawn on them, so EM models are unchanged.
29
56
 
30
- # What's New - November 5, 2026 (setupEM 0.17.0)
31
-
32
- 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`):
33
- - **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`.
34
- - 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.
35
- - 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.
36
- - **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`.
37
-
38
- **Changes:**
39
- - **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.
40
- - 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).
41
-
42
- **Fixes:**
43
- - 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).
44
-
45
- # What's New - October 31, 2026 (setupEM 0.16.0)
46
-
47
- **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:
48
- - Opening a `.simcfg` when a model script for the same GDSII file exists next to it asks whether to **Continue with the script** (edit it in place, ports and layout settings from the `.simcfg`) or **Start from the config**.
49
- - Loading a `.simcfg` while editing a script in place lists the ports and layout settings that differ and asks whether to **Update the script from it** or **Open it as a new model**. Before, loading it ended editing in place and replaced all settings.
50
- - While editing a script in place, the bar below the menu points out a newer `.simcfg` of the same GDSII file with other ports or layout settings, with **Update from it**.
51
-
52
- **Load Config, Import from \*.py model and Edit \*.py model in place** start in the folder of the model you are working on (the config or script loaded last, else the GDSII file). Before, they started in the folder setupEM was launched from, e.g. KLayout's when the KLayout plug-in opened setupEM.
53
-
54
- setupEM 0.16.0 needs gds2palace 0.9.3 or later: a layout with several shapes on one port layer (e.g. a transistor terminal on several fingers, from the KLayout plug-in) makes one port with several elements there; older gds2palace versions used only the last shape.
55
-
56
- **Fixes:**
57
- - `scripts/combine_extend_snp.py` is the same as gds2palace's again. It had missed three fixes made there in September: the port impedance lookup for AMR iterations, the missing `.sNp` extension for a model name that contains a dot, and Touchstone output after an interrupted Palace run.
58
- - On Linux with GNOME (Wayland), the mouse cursor no longer keeps spinning for about 10 seconds after setupEM starts. setupEM briefly opened three invisible windows while building the Input Files tab, and GNOME waited for them to finish starting.
59
- - Via ports with direction `-Z` keep their from and to layers. Before, loading a `.simcfg` dropped them, and Create Model wrote such a port as an in-plane port.
60
- - An incomplete port (direction and layers that don't fit, e.g. from a `.simcfg` written by another tool) gives a warning in the Ports tab. Before, gds2palace exited and setupEM closed. A lowercase `z` counts as a via port too.
61
- - `combine_extend_snp` (Touchstone output after a Palace run) handles ports with several elements (several shapes on one port layer, gds2palace 0.9.3): one Z0 per port in the option line, and the elements' port inductances combined in parallel for de-embedding. Before, the last element overwrote the others.
62
-
63
57
  Full history: [CHANGES.md](https://github.com/VolkerMuehlhaus/setupEM/blob/main/doc/CHANGES.md)
64
58
 
65
59
  ---
66
60
 
67
61
  **Note:** the `setupEM` PyPI package itself requires:
68
62
 
69
- - gds2palace>=0.10.0
63
+ - gds2palace>=0.10.1
70
64
  - gds_prepare_for_EM>=1.6.0
71
65
  - PySide6
72
66
  - shiboken6
@@ -12,7 +12,7 @@ authors = [
12
12
  { name = "Volker Muehlhaus", email = "volker@muehlhaus.com" }
13
13
  ]
14
14
  dependencies = [
15
- "gds2palace>=0.10.0",
15
+ "gds2palace>=0.10.1",
16
16
  "gds_prepare_for_EM>=1.6.0",
17
17
  "PySide6",
18
18
  "shiboken6",
@@ -21,7 +21,14 @@ setupEM package
21
21
  A Python tool for EM setup using gds2palace.
22
22
  """
23
23
 
24
- from .setupEM import main
24
+
25
+
26
+ def main():
27
+ """Start the setupEM GUI. Imported here only when called, so that the modules without Qt (join_pieces,
28
+ thermal_results, script_model, ...) can be imported without loading it."""
29
+ from .setupEM import main as _main
30
+ return _main()
31
+
25
32
 
26
33
  __all__ = ["main"]
27
- __version__ = "0.18.0"
34
+ __version__ = "0.18.2"
@@ -0,0 +1,86 @@
1
+ ########################################################################
2
+ #
3
+ # Copyright 2025 Volker Muehlhaus and IHP PDK Authors
4
+ #
5
+ # Licensed under the GNU General Public License, Version 3.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.gnu.org/licenses/gpl-3.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+ ########################################################################
18
+
19
+ """
20
+ Command line helpers shared by setupEM, setupThermal, stackupEditor, resultViewer and fieldViewer.
21
+
22
+ No Qt in here: the commands read their arguments with these before they create the QApplication, so that
23
+ --help, --version and a wrong argument need no display.
24
+ """
25
+
26
+ import json
27
+ import os
28
+ import re
29
+
30
+ # file suffix of a settings file -> the application it belongs to
31
+ CONFIG_APPS = {"simcfg": "setupEM", "tsimcfg": "setupThermal"}
32
+
33
+
34
+ def package_version():
35
+ """__version__ of the setupEM package, also when a module is run as a plain script."""
36
+ try:
37
+ from . import __version__
38
+ return __version__
39
+ except ImportError:
40
+ init = os.path.join(os.path.dirname(os.path.abspath(__file__)), "__init__.py")
41
+ with open(init, encoding="utf-8") as f:
42
+ m = re.search(r'^__version__\s*=\s*"([^"]+)"', f.read(), re.M)
43
+ return m.group(1) if m else "unknown"
44
+
45
+
46
+ def add_version_argument(parser):
47
+ parser.add_argument("--version", action="version", version=f"%(prog)s {package_version()}")
48
+
49
+
50
+ def config_file_error(path, app_name):
51
+ """Why the settings file or model script given at start cannot be opened by app_name; None if it can."""
52
+ if not os.path.isfile(path):
53
+ return f"file not found: {path}"
54
+ suffix = os.path.splitext(path)[1].lower().lstrip(".")
55
+ if suffix == "py":
56
+ return None
57
+ own_suffix = next(s for s, app in CONFIG_APPS.items() if app == app_name)
58
+ owner = CONFIG_APPS.get(suffix)
59
+ if owner is not None and owner != app_name:
60
+ return f"{path} is a {owner} settings file, open it with {owner}"
61
+ if suffix != own_suffix:
62
+ return f"{path} is not a {app_name} settings file (*.{own_suffix}) or a model script (*.py)"
63
+ try:
64
+ with open(path, "r") as f:
65
+ data = json.load(f)
66
+ except (OSError, ValueError) as e:
67
+ return f"{path} cannot be read: {e}"
68
+ application = data.get("application", "") if isinstance(data, dict) else ""
69
+ if application == app_name:
70
+ return None
71
+ if application in CONFIG_APPS.values():
72
+ return f"{path} is a {application} settings file, open it with {application}"
73
+ return f"{path} is not a {app_name} settings file (no \"application\": \"{app_name}\" in it)"
74
+
75
+
76
+ def start_file_errors(app_name, simcfg="", gdsfile="", xmlfile=""):
77
+ """The messages for the files given at start that cannot be opened ('' = not given)."""
78
+ errors = []
79
+ if simcfg:
80
+ error = config_file_error(simcfg, app_name)
81
+ if error:
82
+ errors.append(error)
83
+ for path in (gdsfile, xmlfile):
84
+ if path and not os.path.isfile(path):
85
+ errors.append(f"file not found: {path}")
86
+ return errors
@@ -30,9 +30,27 @@ No Qt in here, so the module can be tested on its own.
30
30
  import ast
31
31
  import glob
32
32
  import json
33
+ import math
33
34
  import os
35
+ import pathlib
36
+
37
+ __all__ = ["LAYOUT_KEYS", "port_differences", "layout_differences", "newer_configs", "model_scripts",
38
+ "same_path", "linked_scripts", "model_settings_snapshot", "settings_differences", "is_absolute_path",
39
+ "join_path"]
40
+
41
+
42
+ def is_absolute_path(path):
43
+ """True for an absolute path of this or the other OS: a script or settings file written on Windows names
44
+ D:/... or a UNC path, which os.path.isabs() on Linux takes as relative (and a join with the file's folder
45
+ gives /mnt/.../D:/...)."""
46
+ path = str(path)
47
+ return os.path.isabs(path) or bool(pathlib.PureWindowsPath(path).drive) or path.startswith(("/", "\\"))
48
+
49
+
50
+ def join_path(base_dir, path):
51
+ """path taken from base_dir if it is relative (of either OS, see is_absolute_path), else path itself."""
52
+ return path if is_absolute_path(path) else os.path.join(base_dir, path)
34
53
 
35
- __all__ = ["LAYOUT_KEYS", "port_differences", "layout_differences", "newer_configs", "model_scripts"]
36
54
 
37
55
  # saved_values that belong to the layout export, besides the ports
38
56
  LAYOUT_KEYS = ("GdsFile", "SubstrateFile", "cellname", "purpose")
@@ -82,10 +100,15 @@ def port_differences(old_ports, new_ports):
82
100
  return out
83
101
 
84
102
 
103
+ def same_path(a, b, base_dir=""):
104
+ """True if the paths a and b name the same file; relative paths are taken from base_dir."""
105
+ return _same_path(a, b, base_dir)
106
+
107
+
85
108
  def _same_path(a, b, base_dir=""):
86
109
  if not a or not b:
87
110
  return a == b
88
- norm = lambda p: os.path.normcase(os.path.abspath(os.path.join(base_dir, p)))
111
+ norm = lambda p: os.path.normcase(os.path.abspath(join_path(base_dir, p)))
89
112
  return norm(a) == norm(b)
90
113
 
91
114
 
@@ -177,3 +200,98 @@ def model_scripts(gds_path, folders):
177
200
  out.append(path)
178
201
  out.sort(key=os.path.getmtime, reverse=True)
179
202
  return out
203
+
204
+
205
+ # ---------- Which model script a settings file belongs to ----------
206
+ #
207
+ # A layout tool's export (e.g. <layout>.simcfg of the KLayout plug-in) and the model script made from it in setupEM
208
+ # are linked in the settings file:
209
+ # "written_with": "<model>.py" Create Model wrote this settings file together with the script (same folder)
210
+ # "model_script": "<path>.py" Create Model wrote the script for a model opened from this settings file under
211
+ # another name; the path is relative to the settings file's folder
212
+ # The layout tool keeps both keys when it writes the file again. A script that only reads the same GDS file is not
213
+ # linked: it can be any script (an older copy, a hand-written one).
214
+
215
+ # settings that are not part of the model's setup, or that the GUI takes from the preferences either way
216
+ SETTINGS_NOT_COMPARED = ("unit", "model_basename", "sim_path", "preview_only", "no_preview",
217
+ "solver_maxits", "solver_tol", "fdump_enabled")
218
+
219
+
220
+ def linked_scripts(config_path, data):
221
+ """[(script path, written_with)] of the existing model scripts the settings file names, written_with first."""
222
+ folder = os.path.dirname(os.path.abspath(config_path))
223
+ out = []
224
+ for key in ("written_with", "model_script"):
225
+ name = data.get(key) if isinstance(data, dict) else None
226
+ if not isinstance(name, str) or not name.lower().endswith(".py"):
227
+ continue
228
+ if key == "written_with" and os.path.basename(name) != name:
229
+ continue # written_with is a file name in the same folder
230
+ path = os.path.normpath(os.path.join(folder, name))
231
+ if os.path.isfile(path) and not any(_same_path(path, p) for p, _ in out):
232
+ out.append((path, key == "written_with"))
233
+ return out
234
+
235
+
236
+ def model_settings_snapshot(script_path, suffix=".simcfg", application="setupEM"):
237
+ """The settings Create Model wrote with the script (<model>.simcfg, "written_with" the script), if the script was
238
+ not changed after it; else None (then they say nothing about the script)."""
239
+ path = os.path.splitext(script_path)[0] + suffix
240
+ try:
241
+ if os.path.getmtime(path) < os.path.getmtime(script_path):
242
+ return None
243
+ with open(path, encoding="utf-8") as f:
244
+ data = json.load(f)
245
+ except (OSError, ValueError):
246
+ return None
247
+ if not isinstance(data, dict) or data.get("application") != application or \
248
+ data.get("written_with") != os.path.basename(script_path):
249
+ return None
250
+ return data
251
+
252
+
253
+ def _is_number(value):
254
+ return isinstance(value, (int, float)) and not isinstance(value, bool)
255
+
256
+
257
+ def _same_setting(a, b):
258
+ """Two values of a setting as saved in settings files: numbers to rounding, a list and a scalar alike if every
259
+ element is the scalar (the oversize, one value or one per side), lists and dicts element by element."""
260
+ if _is_number(a) and _is_number(b):
261
+ return math.isclose(a, b, rel_tol=1e-9, abs_tol=1e-15)
262
+ if isinstance(a, (list, tuple)) and isinstance(b, (list, tuple)):
263
+ return len(a) == len(b) and all(_same_setting(x, y) for x, y in zip(a, b))
264
+ if isinstance(a, (list, tuple)) and _is_number(b):
265
+ return len(a) > 0 and all(_same_setting(x, b) for x in a)
266
+ if _is_number(a) and isinstance(b, (list, tuple)):
267
+ return _same_setting(b, a)
268
+ if isinstance(a, dict) and isinstance(b, dict):
269
+ return a.keys() == b.keys() and all(_same_setting(a[k], b[k]) for k in a)
270
+ return a == b
271
+
272
+
273
+ def _show(value):
274
+ if isinstance(value, float) and value.is_integer():
275
+ return str(int(value)) if abs(value) < 1e15 else str(value)
276
+ return str(value)
277
+
278
+
279
+ def settings_differences(script_data, config_data):
280
+ """Readable differences between the settings of a model script (script_data: the settings file Create Model
281
+ wrote with it) and a settings file of the same layout (config_data), [] if none. Compared: the settings both
282
+ files have, except the layout settings and ports (they come from the settings file either way) and
283
+ SETTINGS_NOT_COMPARED; and the solver (Palace or Elmer)."""
284
+ script_values = script_data.get("saved_values") or {}
285
+ config_values = config_data.get("saved_values") or {}
286
+ out = []
287
+ if "elmer_mode" in config_data and \
288
+ bool(script_data.get("elmer_mode", False)) != bool(config_data.get("elmer_mode", False)):
289
+ solver = lambda data: "Elmer" if data.get("elmer_mode") else "Palace"
290
+ out.append(f"solver: {solver(script_data)} in the script, {solver(config_data)} in the config")
291
+ for key in sorted(config_values):
292
+ if key in LAYOUT_KEYS or key in SETTINGS_NOT_COMPARED or key not in script_values:
293
+ continue
294
+ if not _same_setting(script_values[key], config_values[key]):
295
+ out.append(f"{key}: {_show(script_values[key])} in the script, {_show(config_values[key])} in the config")
296
+ return out
297
+
@@ -96,9 +96,11 @@ from pyvistaqt import QtInteractor
96
96
  if __package__ in (None, ""):
97
97
  from palace_results import find_paraview_files, is_amr_iteration_path
98
98
  from thermal_results import find_thermal_paraview_file
99
+ from cli_common import add_version_argument
99
100
  else:
100
101
  from .palace_results import find_paraview_files, is_amr_iteration_path
101
102
  from .thermal_results import find_thermal_paraview_file
103
+ from .cli_common import add_version_argument
102
104
 
103
105
 
104
106
  # Axis name -> unit normal vector, for both the clip plane and the slider's bounds lookup.
@@ -2635,24 +2637,8 @@ class _StandaloneMainWindow:
2635
2637
 
2636
2638
 
2637
2639
  def main():
2638
- app = QApplication(sys.argv)
2639
-
2640
- # Pin a light color scheme so the explicit light backgrounds set on
2641
- # QLineEdit/QComboBox fields elsewhere aren't fighting an inherited dark
2642
- # auto-palette on accounts where Windows' per-user dark-mode setting is
2643
- # on (PySide6 6.5+ only; older versions just skip this and rely on the
2644
- # explicit "color:" rules already set on those field stylesheets).
2645
- try:
2646
- app.styleHints().setColorScheme(Qt.ColorScheme.Light)
2647
- except AttributeError:
2648
- pass
2649
-
2650
- if sys.platform.startswith("win"):
2651
- # matches setupEM.py's/setupThermal.py's/result_viewer.py's main() - without
2652
- # this, Qt's default style on Windows looks visibly different from the full app
2653
- app.setStyle(QStyleFactory.create("Windows"))
2654
-
2655
- parser = argparse.ArgumentParser(description="Standalone 3D field result viewer")
2640
+ # arguments first: --help, --version and a wrong argument need no display
2641
+ parser = argparse.ArgumentParser(prog="fieldViewer", description="Standalone 3D field result viewer")
2656
2642
  parser.add_argument("file_path", nargs="?",
2657
2643
  help="path to a .pvd/.pvtu/.vtu field-result file. If omitted, "
2658
2644
  "use --run-path with --source to resolve one automatically.")
@@ -2718,6 +2704,7 @@ def main():
2718
2704
  parser.add_argument("--screenshot",
2719
2705
  help="render off-screen and save a PNG here instead of opening an "
2720
2706
  "interactive window, then exit - works with no display")
2707
+ add_version_argument(parser)
2721
2708
  args = parser.parse_args()
2722
2709
 
2723
2710
  if (args.clip_position is not None or args.clip_max) and not args.clip_axis:
@@ -2758,12 +2745,44 @@ def main():
2758
2745
  if not file_paths:
2759
2746
  parser.error("no file_path given, and none could be resolved from --run-path")
2760
2747
 
2761
- def die(message):
2762
- print(f"Error: {message}", file=sys.stderr)
2763
- sys.exit(1)
2748
+ if args.screenshot:
2749
+ # rendered off-screen (see FieldViewerWindow's off_screen): no display needed, so don't let Qt look for one
2750
+ os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
2751
+
2752
+ app = QApplication(sys.argv)
2753
+
2754
+ # Pin a light color scheme so the explicit light backgrounds set on
2755
+ # QLineEdit/QComboBox fields elsewhere aren't fighting an inherited dark
2756
+ # auto-palette on accounts where Windows' per-user dark-mode setting is
2757
+ # on (PySide6 6.5+ only; older versions just skip this and rely on the
2758
+ # explicit "color:" rules already set on those field stylesheets).
2759
+ try:
2760
+ app.styleHints().setColorScheme(Qt.ColorScheme.Light)
2761
+ except AttributeError:
2762
+ pass
2763
+
2764
+ if sys.platform.startswith("win"):
2765
+ # matches setupEM.py's/setupThermal.py's/result_viewer.py's main() - without
2766
+ # this, Qt's default style on Windows looks visibly different from the full app
2767
+ app.setStyle(QStyleFactory.create("Windows"))
2764
2768
 
2765
2769
  window = FieldViewerWindow(_StandaloneMainWindow(), file_paths, args.source,
2766
2770
  off_screen=bool(args.screenshot))
2771
+
2772
+ def close_and_exit(code):
2773
+ # The window is deleted here, before the application: left to Qt's own cleanup at exit, a finished
2774
+ # --screenshot run crashed there with no display (Linux, PySide6 6.12: PNG written, then exit code 139).
2775
+ nonlocal window
2776
+ window.close()
2777
+ window.deleteLater()
2778
+ window = None
2779
+ app.processEvents()
2780
+ sys.exit(code)
2781
+
2782
+ def die(message):
2783
+ print(f"Error: {message}", file=sys.stderr)
2784
+ close_and_exit(1)
2785
+
2767
2786
  if window._full_mesh is None:
2768
2787
  die(window._load_error or "failed to load the field-result file")
2769
2788
 
@@ -2873,8 +2892,7 @@ def main():
2873
2892
  break
2874
2893
  window.plotter.screenshot(args.screenshot)
2875
2894
  print(f"Saved screenshot to {args.screenshot}")
2876
- window.close()
2877
- sys.exit(0)
2895
+ close_and_exit(0)
2878
2896
 
2879
2897
  window.show()
2880
2898
  sys.exit(app.exec())
@@ -180,15 +180,26 @@ def join_all(set_path):
180
180
 
181
181
 
182
182
  def main(argv=None):
183
- argv = sys.argv[1:] if argv is None else argv
184
- if len(argv) != 1:
185
- print(__doc__)
186
- return 2
183
+ """python -m setupEM.join_pieces <export>.simcfg: 0 joined, 1 not joined (the reason on stderr), 2 wrong
184
+ arguments."""
185
+ import argparse
186
+ if __package__ in (None, ""):
187
+ from cli_common import add_version_argument
188
+ else:
189
+ from .cli_common import add_version_argument
190
+ parser = argparse.ArgumentParser(prog="python -m setupEM.join_pieces", description=__doc__,
191
+ formatter_class=argparse.RawDescriptionHelpFormatter)
192
+ parser.add_argument("simcfg", help="<export>.simcfg of a split region (with a pieces section)")
193
+ add_version_argument(parser)
194
+ args = parser.parse_args(argv)
187
195
  try:
188
- for message in join_all(argv[0]):
196
+ for message in join_all(args.simcfg):
189
197
  print(message)
190
198
  except JoinError as e:
191
- print(f"not joined: {e}")
199
+ print(f"not joined: {e}", file=sys.stderr)
200
+ return 1
201
+ except (OSError, json.JSONDecodeError) as e:
202
+ print(f"not joined: {args.simcfg} cannot be read: {e}", file=sys.stderr)
192
203
  return 1
193
204
  return 0
194
205