setupEM 0.15.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.
- setupem-0.17.0/PKG-INFO +106 -0
- {setupem-0.15.0 → setupem-0.17.0}/README.md +8 -0
- setupem-0.17.0/README_pypi.md +77 -0
- {setupem-0.15.0 → setupem-0.17.0}/pyproject.toml +1 -1
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/__init__.py +1 -1
- setupem-0.17.0/src/setupEM/config_update.py +179 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/data/SG13CMOS5L_200um.xml +1 -1
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/data/SG13G2_FEM_200um.xml +1 -1
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/data/SG13G2_FEM_200um_passi3D.xml +1 -1
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/script_model.py +1 -1
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/setupEM.py +48 -132
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/setupThermal.py +229 -14
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/setup_common.py +353 -10
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/thermal_results.py +198 -3
- setupem-0.17.0/src/setupEM.egg-info/PKG-INFO +106 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM.egg-info/SOURCES.txt +7 -1
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM.egg-info/requires.txt +1 -1
- setupem-0.17.0/tests/test_config_update.py +83 -0
- setupem-0.17.0/tests/test_config_update_gui.py +185 -0
- setupem-0.17.0/tests/test_table_rows.py +102 -0
- setupem-0.17.0/tests/test_thermal_powers.py +233 -0
- setupem-0.17.0/tests/test_thermal_results.py +156 -0
- setupem-0.15.0/PKG-INFO +0 -83
- setupem-0.15.0/README_pypi.md +0 -54
- setupem-0.15.0/src/setupEM.egg-info/PKG-INFO +0 -83
- {setupem-0.15.0 → setupem-0.17.0}/LICENSE +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/setup.cfg +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/__main__.py +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/data/SG13G2_100um.xml +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/data/SG13G2_200um.xml +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/data/SG13G2_nosub.xml +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/field_viewer.py +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/gds_hierarchy_scan.py +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/layout_preview.py +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/momentum_import.py +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/palace_results.py +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/result_viewer.py +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/run_with_overrides.py +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/script_probe.py +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/simplify_gds.py +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/stackupEditor.py +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM/stackup_writer.py +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM.egg-info/dependency_links.txt +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM.egg-info/entry_points.txt +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/src/setupEM.egg-info/top_level.txt +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/tests/test_run_with_overrides.py +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/tests/test_script_model.py +0 -0
- {setupem-0.15.0 → setupem-0.17.0}/tests/test_script_probe.py +0 -0
setupem-0.17.0/PKG-INFO
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: setupEM
|
|
3
|
+
Version: 0.17.0
|
|
4
|
+
Summary: Python tool for configuration of gds2palace workflow with GUI.
|
|
5
|
+
Author-email: Volker Muehlhaus <volker@muehlhaus.com>
|
|
6
|
+
License-Expression: GPL-3.0-or-later
|
|
7
|
+
Project-URL: Homepage, https://github.com/VolkerMuehlhaus/setupEM
|
|
8
|
+
Project-URL: Repository, https://github.com/VolkerMuehlhaus/setupEM
|
|
9
|
+
Project-URL: Changelog, https://github.com/VolkerMuehlhaus/setupEM/blob/main/doc/CHANGES.md
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: gds2palace>=0.9.4
|
|
14
|
+
Requires-Dist: gds_prepare_for_EM>=1.6.0
|
|
15
|
+
Requires-Dist: PySide6
|
|
16
|
+
Requires-Dist: shiboken6
|
|
17
|
+
Requires-Dist: scipy
|
|
18
|
+
Requires-Dist: requests
|
|
19
|
+
Requires-Dist: scikit-rf
|
|
20
|
+
Requires-Dist: matplotlib
|
|
21
|
+
Requires-Dist: numpy
|
|
22
|
+
Requires-Dist: gdspy
|
|
23
|
+
Requires-Dist: meshio
|
|
24
|
+
Requires-Dist: pyvista
|
|
25
|
+
Requires-Dist: pyvistaqt
|
|
26
|
+
Provides-Extra: test
|
|
27
|
+
Requires-Dist: pytest; extra == "test"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# Python GUI for gds2palace
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
pip install setupEM
|
|
37
|
+
|
|
38
|
+
**Full documentation, installation guide, and usage walkthrough:**
|
|
39
|
+
https://github.com/VolkerMuehlhaus/setupEM
|
|
40
|
+
|
|
41
|
+
## Recent changes
|
|
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
|
+
|
|
58
|
+
# What's New - October 31, 2026 (setupEM 0.16.0)
|
|
59
|
+
|
|
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:
|
|
61
|
+
- 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**.
|
|
62
|
+
- 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.
|
|
63
|
+
- 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**.
|
|
64
|
+
|
|
65
|
+
**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.
|
|
66
|
+
|
|
67
|
+
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.
|
|
68
|
+
|
|
69
|
+
**Fixes:**
|
|
70
|
+
- `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.
|
|
71
|
+
- 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.
|
|
72
|
+
- 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.
|
|
73
|
+
- 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.
|
|
74
|
+
- `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.
|
|
75
|
+
|
|
76
|
+
# What's New - October 29, 2026
|
|
77
|
+
|
|
78
|
+
**File > Edit \*.py model in place** (new, setupEM and setupThermal): edits a gds2palace model script directly, e.g. one from the gds2palace MCP server, an example or your own code. Create Model and **File > Save** write only the values you change; the script's loops, comments and custom code stay. Settings the script computes itself are greyed out. A script that builds several models (a parameter sweep) lists them on the Create Model tab, and Start Simulation runs the ticked ones. After importing a script that setupEM didn't write, a bar below the menu offers **Edit in place instead**.
|
|
79
|
+
|
|
80
|
+
**File > Import from \*.py model** now runs a gds2palace script to read it, without reading the GDSII file and without meshing. The run stops where the script builds the model, so its solver start never runs. The import now gets exactly what gds2palace would get, also values and ports the script computes. Before, ports made in a loop (as in many gds2palace MCP scripts) were left out, and the imported model was missing them. The script's own code before building the model does run, e.g. a script that generates its GDSII file writes it. If the run fails, the import reads the script text as before, and the bar below the menu says why.
|
|
81
|
+
|
|
82
|
+
**File menu:** the three Recent submenus are now one **Open Recent** submenu, with sections for configs, imported \*.py models and \*.py models edited in place. A file reopens the way it was opened. The menu is grouped as open, recent, save, preferences. **Load Default Config** and **Save as Default Config** are removed: defaults for new models are set in **File > Preferences**. An existing `default.simcfg` / `default.tsimcfg` in your home directory still opens with **Load Config**, and **Save Config** can write it.
|
|
83
|
+
|
|
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.
|
|
85
|
+
|
|
86
|
+
Full history: [CHANGES.md](https://github.com/VolkerMuehlhaus/setupEM/blob/main/doc/CHANGES.md)
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
**Note:** the `setupEM` PyPI package itself requires:
|
|
91
|
+
|
|
92
|
+
- gds2palace>=0.9.4
|
|
93
|
+
- gds_prepare_for_EM>=1.6.0
|
|
94
|
+
- PySide6
|
|
95
|
+
- shiboken6
|
|
96
|
+
- scipy
|
|
97
|
+
- requests
|
|
98
|
+
- scikit-rf
|
|
99
|
+
- matplotlib
|
|
100
|
+
- numpy
|
|
101
|
+
- gdspy
|
|
102
|
+
- meshio
|
|
103
|
+
- pyvista
|
|
104
|
+
- pyvistaqt
|
|
105
|
+
|
|
106
|
+
(Other Python modules mentioned above are only needed to run standalone helper scripts in this repository, not to use the installed package.)
|
|
@@ -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.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Python GUI for gds2palace
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
pip install setupEM
|
|
8
|
+
|
|
9
|
+
**Full documentation, installation guide, and usage walkthrough:**
|
|
10
|
+
https://github.com/VolkerMuehlhaus/setupEM
|
|
11
|
+
|
|
12
|
+
## Recent changes
|
|
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
|
+
|
|
29
|
+
# What's New - October 31, 2026 (setupEM 0.16.0)
|
|
30
|
+
|
|
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:
|
|
32
|
+
- 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**.
|
|
33
|
+
- 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.
|
|
34
|
+
- 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**.
|
|
35
|
+
|
|
36
|
+
**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.
|
|
37
|
+
|
|
38
|
+
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.
|
|
39
|
+
|
|
40
|
+
**Fixes:**
|
|
41
|
+
- `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.
|
|
42
|
+
- 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.
|
|
43
|
+
- 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.
|
|
44
|
+
- 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.
|
|
45
|
+
- `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.
|
|
46
|
+
|
|
47
|
+
# What's New - October 29, 2026
|
|
48
|
+
|
|
49
|
+
**File > Edit \*.py model in place** (new, setupEM and setupThermal): edits a gds2palace model script directly, e.g. one from the gds2palace MCP server, an example or your own code. Create Model and **File > Save** write only the values you change; the script's loops, comments and custom code stay. Settings the script computes itself are greyed out. A script that builds several models (a parameter sweep) lists them on the Create Model tab, and Start Simulation runs the ticked ones. After importing a script that setupEM didn't write, a bar below the menu offers **Edit in place instead**.
|
|
50
|
+
|
|
51
|
+
**File > Import from \*.py model** now runs a gds2palace script to read it, without reading the GDSII file and without meshing. The run stops where the script builds the model, so its solver start never runs. The import now gets exactly what gds2palace would get, also values and ports the script computes. Before, ports made in a loop (as in many gds2palace MCP scripts) were left out, and the imported model was missing them. The script's own code before building the model does run, e.g. a script that generates its GDSII file writes it. If the run fails, the import reads the script text as before, and the bar below the menu says why.
|
|
52
|
+
|
|
53
|
+
**File menu:** the three Recent submenus are now one **Open Recent** submenu, with sections for configs, imported \*.py models and \*.py models edited in place. A file reopens the way it was opened. The menu is grouped as open, recent, save, preferences. **Load Default Config** and **Save as Default Config** are removed: defaults for new models are set in **File > Preferences**. An existing `default.simcfg` / `default.tsimcfg` in your home directory still opens with **Load Config**, and **Save Config** can write it.
|
|
54
|
+
|
|
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.
|
|
56
|
+
|
|
57
|
+
Full history: [CHANGES.md](https://github.com/VolkerMuehlhaus/setupEM/blob/main/doc/CHANGES.md)
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
**Note:** the `setupEM` PyPI package itself requires:
|
|
62
|
+
|
|
63
|
+
- gds2palace>=0.9.4
|
|
64
|
+
- gds_prepare_for_EM>=1.6.0
|
|
65
|
+
- PySide6
|
|
66
|
+
- shiboken6
|
|
67
|
+
- scipy
|
|
68
|
+
- requests
|
|
69
|
+
- scikit-rf
|
|
70
|
+
- matplotlib
|
|
71
|
+
- numpy
|
|
72
|
+
- gdspy
|
|
73
|
+
- meshio
|
|
74
|
+
- pyvista
|
|
75
|
+
- pyvistaqt
|
|
76
|
+
|
|
77
|
+
(Other Python modules mentioned above are only needed to run standalone helper scripts in this repository, not to use the installed package.)
|
|
@@ -0,0 +1,179 @@
|
|
|
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
|
+
"""Update a script edited in place from a settings file (*.simcfg) of the same layout.
|
|
20
|
+
|
|
21
|
+
A layout tool such as the KLayout plug-in klayout_em_export writes the GDS file and a *.simcfg next to it. When the
|
|
22
|
+
layout changes, it exports again: same GDS file name, new ports (numbered 1..N without gaps, so they can shift).
|
|
23
|
+
A model script made before, maybe edited by hand, still has the old ports. setupEM's edit-in-place mode can update
|
|
24
|
+
it: the settings that belong to the layout (LAYOUT_KEYS and the ports) come from the *.simcfg, everything else
|
|
25
|
+
(frequencies, mesh, the script's own code) stays.
|
|
26
|
+
|
|
27
|
+
No Qt in here, so the module can be tested on its own.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
import ast
|
|
31
|
+
import glob
|
|
32
|
+
import json
|
|
33
|
+
import os
|
|
34
|
+
|
|
35
|
+
__all__ = ["LAYOUT_KEYS", "port_differences", "layout_differences", "newer_configs", "model_scripts"]
|
|
36
|
+
|
|
37
|
+
# saved_values that belong to the layout export, besides the ports
|
|
38
|
+
LAYOUT_KEYS = ("GdsFile", "SubstrateFile", "cellname", "purpose")
|
|
39
|
+
LAYOUT_LABELS = {"GdsFile": "GDSII file", "SubstrateFile": "stackup", "cellname": "cell", "purpose": "purpose"}
|
|
40
|
+
|
|
41
|
+
_PORT_KEYS = ("source_layernum", "direction", "from_layername", "to_layername", "target_layername")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _port_signature(port):
|
|
45
|
+
"""(source layer, direction, from, to, target) of a port dict; Z0 and excitation are not part of it."""
|
|
46
|
+
values = []
|
|
47
|
+
for key in _PORT_KEYS:
|
|
48
|
+
value = port.get(key)
|
|
49
|
+
if key == "source_layernum" and value not in (None, ""):
|
|
50
|
+
value = int(value)
|
|
51
|
+
elif key == "direction" and isinstance(value, str):
|
|
52
|
+
value = value.upper()
|
|
53
|
+
values.append(value or None)
|
|
54
|
+
layer, direction, frm, to, target = values
|
|
55
|
+
if direction and "Z" in direction:
|
|
56
|
+
target = None
|
|
57
|
+
else:
|
|
58
|
+
frm = to = None
|
|
59
|
+
return layer, direction, frm, to, target
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _describe(signature):
|
|
63
|
+
layer, direction, frm, to, target = signature
|
|
64
|
+
if direction and "Z" in direction:
|
|
65
|
+
return f"via {frm} -> {to} ({direction}) on layer {layer}"
|
|
66
|
+
return f"in-plane {direction} on {target}, layer {layer}"
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def port_differences(old_ports, new_ports):
|
|
70
|
+
"""Readable differences from old_ports to new_ports (lists of port dicts), [] if they match. Compared per port
|
|
71
|
+
number: layer, direction, from/to/target layer; not Z0 or excitation."""
|
|
72
|
+
old = {int(p["portnumber"]): _port_signature(p) for p in old_ports if p.get("portnumber") not in (None, "")}
|
|
73
|
+
new = {int(p["portnumber"]): _port_signature(p) for p in new_ports if p.get("portnumber") not in (None, "")}
|
|
74
|
+
out = []
|
|
75
|
+
for number in sorted(set(old) | set(new)):
|
|
76
|
+
if number not in new:
|
|
77
|
+
out.append(f"port {number}: removed")
|
|
78
|
+
elif number not in old:
|
|
79
|
+
out.append(f"port {number}: new, {_describe(new[number])}")
|
|
80
|
+
elif old[number] != new[number]:
|
|
81
|
+
out.append(f"port {number}: was {_describe(old[number])}, now {_describe(new[number])}")
|
|
82
|
+
return out
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _same_path(a, b, base_dir=""):
|
|
86
|
+
if not a or not b:
|
|
87
|
+
return a == b
|
|
88
|
+
norm = lambda p: os.path.normcase(os.path.abspath(os.path.join(base_dir, p)))
|
|
89
|
+
return norm(a) == norm(b)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def layout_differences(old_values, new_values, new_base_dir=""):
|
|
93
|
+
"""Readable differences of the LAYOUT_KEYS from old_values to new_values (saved_values dicts); file paths in
|
|
94
|
+
new_values relative to new_base_dir."""
|
|
95
|
+
out = []
|
|
96
|
+
for key in LAYOUT_KEYS:
|
|
97
|
+
if key not in new_values:
|
|
98
|
+
continue
|
|
99
|
+
old, new = old_values.get(key), new_values.get(key)
|
|
100
|
+
if key in ("GdsFile", "SubstrateFile"):
|
|
101
|
+
if not _same_path(old, new, new_base_dir):
|
|
102
|
+
out.append(f"{LAYOUT_LABELS[key]}: {os.path.basename(old or '-')} -> {os.path.basename(new or '-')}")
|
|
103
|
+
elif key == "purpose":
|
|
104
|
+
if [int(p) for p in old or []] != [int(p) for p in new or []]:
|
|
105
|
+
out.append(f"{LAYOUT_LABELS[key]}: {old} -> {new}")
|
|
106
|
+
elif old != new:
|
|
107
|
+
out.append(f"{LAYOUT_LABELS[key]}: {old} -> {new}")
|
|
108
|
+
return out
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def newer_configs(script_path, gds_path, folders, suffix=".simcfg", application="setupEM"):
|
|
112
|
+
"""[(path, data)] of the settings files in folders that belong to gds_path (their GdsFile is that file) and are
|
|
113
|
+
newer than script_path, newest first."""
|
|
114
|
+
try:
|
|
115
|
+
script_time = os.path.getmtime(script_path)
|
|
116
|
+
except OSError:
|
|
117
|
+
return []
|
|
118
|
+
seen, out = set(), []
|
|
119
|
+
for folder in folders:
|
|
120
|
+
if not folder or not os.path.isdir(folder):
|
|
121
|
+
continue
|
|
122
|
+
for path in glob.glob(os.path.join(folder, "*" + suffix)):
|
|
123
|
+
key = os.path.normcase(os.path.abspath(path))
|
|
124
|
+
if key in seen:
|
|
125
|
+
continue
|
|
126
|
+
seen.add(key)
|
|
127
|
+
try:
|
|
128
|
+
if os.path.getmtime(path) <= script_time:
|
|
129
|
+
continue
|
|
130
|
+
with open(path, encoding="utf-8") as f:
|
|
131
|
+
data = json.load(f)
|
|
132
|
+
except (OSError, ValueError):
|
|
133
|
+
continue
|
|
134
|
+
if not isinstance(data, dict) or data.get("application") != application:
|
|
135
|
+
continue
|
|
136
|
+
gds = (data.get("saved_values") or {}).get("GdsFile")
|
|
137
|
+
if gds and _same_path(gds, gds_path, os.path.dirname(path)):
|
|
138
|
+
out.append((path, data))
|
|
139
|
+
out.sort(key=lambda item: os.path.getmtime(item[0]), reverse=True)
|
|
140
|
+
return out
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def _reads_gds(script_path, gds_path):
|
|
144
|
+
"""True if one of the script's string literals, taken relative to the script's folder, is gds_path (the script
|
|
145
|
+
is read with ast, never run)."""
|
|
146
|
+
try:
|
|
147
|
+
with open(script_path, encoding="utf-8", errors="replace") as f:
|
|
148
|
+
text = f.read()
|
|
149
|
+
except OSError:
|
|
150
|
+
return False
|
|
151
|
+
if os.path.basename(gds_path) not in text: # cheap test before parsing
|
|
152
|
+
return False
|
|
153
|
+
try:
|
|
154
|
+
tree = ast.parse(text)
|
|
155
|
+
except (SyntaxError, ValueError):
|
|
156
|
+
return False
|
|
157
|
+
folder = os.path.dirname(os.path.abspath(script_path))
|
|
158
|
+
return any(isinstance(n, ast.Constant) and isinstance(n.value, str) and n.value.lower().endswith(".gds")
|
|
159
|
+
and _same_path(n.value, gds_path, folder) for n in ast.walk(tree))
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def model_scripts(gds_path, folders):
|
|
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
|
+
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
|
+
seen, out = set(), []
|
|
168
|
+
for folder in folders:
|
|
169
|
+
if not folder or not os.path.isdir(folder):
|
|
170
|
+
continue
|
|
171
|
+
for path in glob.glob(os.path.join(folder, "*.py")):
|
|
172
|
+
key = os.path.normcase(os.path.abspath(path))
|
|
173
|
+
if key in seen:
|
|
174
|
+
continue
|
|
175
|
+
seen.add(key)
|
|
176
|
+
if _reads_gds(path, gds_path):
|
|
177
|
+
out.append(path)
|
|
178
|
+
out.sort(key=os.path.getmtime, reverse=True)
|
|
179
|
+
return out
|
|
@@ -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"
|
|
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"
|
|
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"
|
|
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" />
|
|
@@ -830,7 +830,7 @@ def _port_values(port):
|
|
|
830
830
|
"port_Z0": _number(port.get("port_Z0", 50)),
|
|
831
831
|
"source_layernum": _number(int(port["source_layernum"])),
|
|
832
832
|
}
|
|
833
|
-
if str(port.get("direction", "")).upper()
|
|
833
|
+
if "Z" in str(port.get("direction", "")).upper():
|
|
834
834
|
values["from_layername"] = repr(port.get("from_layername", ""))
|
|
835
835
|
values["to_layername"] = repr(port.get("to_layername", ""))
|
|
836
836
|
else:
|