setupEM 0.18.4__tar.gz → 0.19.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 (61) hide show
  1. {setupem-0.18.4/src/setupEM.egg-info → setupem-0.19.0}/PKG-INFO +15 -19
  2. {setupem-0.18.4 → setupem-0.19.0}/README.md +5 -1
  3. {setupem-0.18.4 → setupem-0.19.0}/README_pypi.md +11 -15
  4. {setupem-0.18.4 → setupem-0.19.0}/pyproject.toml +3 -3
  5. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/__init__.py +1 -1
  6. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/gds_hierarchy_scan.py +13 -15
  7. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/piece_set.py +6 -4
  8. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/setupEM.py +0 -1
  9. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/setupThermal.py +0 -1
  10. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/setup_common.py +18 -9
  11. {setupem-0.18.4 → setupem-0.19.0/src/setupEM.egg-info}/PKG-INFO +15 -19
  12. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM.egg-info/SOURCES.txt +1 -0
  13. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM.egg-info/requires.txt +3 -3
  14. setupem-0.19.0/tests/test_cellname_default.py +48 -0
  15. {setupem-0.18.4 → setupem-0.19.0}/tests/test_piece_set.py +7 -7
  16. {setupem-0.18.4 → setupem-0.19.0}/tests/test_port_walls.py +25 -25
  17. {setupem-0.18.4 → setupem-0.19.0}/tests/test_thermal_powers.py +5 -5
  18. {setupem-0.18.4 → setupem-0.19.0}/LICENSE +0 -0
  19. {setupem-0.18.4 → setupem-0.19.0}/setup.cfg +0 -0
  20. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/__main__.py +0 -0
  21. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/cli_common.py +0 -0
  22. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/config_update.py +0 -0
  23. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/data/SG13CMOS5L_200um.xml +0 -0
  24. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/data/SG13G2_100um.xml +0 -0
  25. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/data/SG13G2_200um.xml +0 -0
  26. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/data/SG13G2_FEM_200um.xml +0 -0
  27. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/data/SG13G2_FEM_200um_passi3D.xml +0 -0
  28. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/data/SG13G2_nosub.xml +0 -0
  29. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/field_viewer.py +0 -0
  30. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/join_pieces.py +0 -0
  31. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/layout_preview.py +0 -0
  32. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/momentum_import.py +0 -0
  33. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/palace_results.py +0 -0
  34. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/result_viewer.py +0 -0
  35. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/run_with_overrides.py +0 -0
  36. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/script_model.py +0 -0
  37. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/script_probe.py +0 -0
  38. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/script_writer.py +0 -0
  39. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/simplify_gds.py +0 -0
  40. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/stackupEditor.py +0 -0
  41. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/stackup_writer.py +0 -0
  42. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM/thermal_results.py +0 -0
  43. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM.egg-info/dependency_links.txt +0 -0
  44. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM.egg-info/entry_points.txt +0 -0
  45. {setupem-0.18.4 → setupem-0.19.0}/src/setupEM.egg-info/top_level.txt +0 -0
  46. {setupem-0.18.4 → setupem-0.19.0}/tests/test_cli_startup.py +0 -0
  47. {setupem-0.18.4 → setupem-0.19.0}/tests/test_config_update.py +0 -0
  48. {setupem-0.18.4 → setupem-0.19.0}/tests/test_config_update_gui.py +0 -0
  49. {setupem-0.18.4 → setupem-0.19.0}/tests/test_deembedded_view.py +0 -0
  50. {setupem-0.18.4 → setupem-0.19.0}/tests/test_export_no_gui.py +0 -0
  51. {setupem-0.18.4 → setupem-0.19.0}/tests/test_join_pieces.py +0 -0
  52. {setupem-0.18.4 → setupem-0.19.0}/tests/test_margin_per_side.py +0 -0
  53. {setupem-0.18.4 → setupem-0.19.0}/tests/test_qt_platform_noise.py +0 -0
  54. {setupem-0.18.4 → setupem-0.19.0}/tests/test_return_applies.py +0 -0
  55. {setupem-0.18.4 → setupem-0.19.0}/tests/test_run_with_overrides.py +0 -0
  56. {setupem-0.18.4 → setupem-0.19.0}/tests/test_save_current_file.py +0 -0
  57. {setupem-0.18.4 → setupem-0.19.0}/tests/test_script_model.py +0 -0
  58. {setupem-0.18.4 → setupem-0.19.0}/tests/test_script_probe.py +0 -0
  59. {setupem-0.18.4 → setupem-0.19.0}/tests/test_script_writer.py +0 -0
  60. {setupem-0.18.4 → setupem-0.19.0}/tests/test_table_rows.py +0 -0
  61. {setupem-0.18.4 → setupem-0.19.0}/tests/test_thermal_results.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: setupEM
3
- Version: 0.18.4
3
+ Version: 0.19.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,8 +10,8 @@ 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.7
14
- Requires-Dist: gds_prepare_for_EM>=1.6.0
13
+ Requires-Dist: gds2palace>=0.11.0
14
+ Requires-Dist: gds_prepare_for_EM>=1.8.0
15
15
  Requires-Dist: PySide6
16
16
  Requires-Dist: shiboken6
17
17
  Requires-Dist: scipy
@@ -19,7 +19,7 @@ Requires-Dist: requests
19
19
  Requires-Dist: scikit-rf
20
20
  Requires-Dist: matplotlib
21
21
  Requires-Dist: numpy
22
- Requires-Dist: gdspy
22
+ Requires-Dist: gdstk
23
23
  Requires-Dist: meshio
24
24
  Requires-Dist: pyvista
25
25
  Requires-Dist: pyvistaqt
@@ -40,6 +40,14 @@ https://github.com/VolkerMuehlhaus/setupEM
40
40
 
41
41
  ## Recent changes
42
42
 
43
+ # What's New - November 19, 2026 (setupEM 0.19.0)
44
+
45
+ Needs gds2palace 0.11 and gds_prepare_for_EM 1.8 or newer (`pip install` updates them). setupEM, gds2palace and gds_prepare_for_EM read layouts with gdstk now instead of gdspy, which is no longer maintained (its polygon fracturing could hang); gdspy is no longer installed with setupEM.
46
+
47
+ **The cell read when the Cellname box says "(default)".** gds2palace 0.11 reads the design cell then: the top-level cell with the largest bounding box, never KLayout's `$$$CONTEXT_INFO$$$`. Before, it read the first top-level cell, which depends on the order in the file (for some KLayout files `$$$CONTEXT_INFO$$$`). The box now names that cell, e.g. "(default: T582_BEOL_D1_300u)", so you see which cell the model and the layout preview use; it is still saved as an empty cell name. Tools > Simplify GDS takes the same cell (gds_prepare_for_EM 1.8).
48
+
49
+ **Tools > Simplify GDS** gets gds_prepare_for_EM 1.8: merged vias are complete (before, rings of vias came out cut open and large via fields lost strips along their fracture lines), circuit blocks whose wiring is drawn as paths are no longer deleted as seal rings, and large layouts are much faster.
50
+
43
51
  # What's New - November 16, 2026 (setupEM 0.18.4)
44
52
 
45
53
  **File > Save (Ctrl+S) saves the settings file you opened.** Opened from a `.simcfg` (e.g. the KLayout plug-in's export, with Open in setupEM), Ctrl+S did nothing: the action existed only for a script edited in place, and changes such as a port wall extension were lost without a question when setupEM was closed. Now:
@@ -60,26 +68,14 @@ Needs gds2palace 0.10.7 or newer (`pip install` updates it).
60
68
 
61
69
  **Internal:** the model script writer of setupEM and setupThermal is now a module without Qt (`script_writer.py`, issue #52). The written scripts are unchanged; `tests/test_script_writer.py` checks 8 recorded scripts against both the GUI and the writer.
62
70
 
63
- # What's New - November 13, 2026 (setupEM 0.18.2)
64
-
65
- **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.
66
-
67
- **Command line fixes** (from issue #52):
68
- - 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.
69
- - `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.
70
-
71
- **Scripts used on two machines** (e.g. Windows and Linux):
72
- - 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.
73
- - 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.
74
-
75
71
  Full history: [CHANGES.md](https://github.com/VolkerMuehlhaus/setupEM/blob/main/doc/CHANGES.md)
76
72
 
77
73
  ---
78
74
 
79
75
  **Note:** the `setupEM` PyPI package itself requires:
80
76
 
81
- - gds2palace>=0.10.7
82
- - gds_prepare_for_EM>=1.6.0
77
+ - gds2palace>=0.11.0
78
+ - gds_prepare_for_EM>=1.8.0
83
79
  - PySide6
84
80
  - shiboken6
85
81
  - scipy
@@ -87,7 +83,7 @@ Full history: [CHANGES.md](https://github.com/VolkerMuehlhaus/setupEM/blob/main/
87
83
  - scikit-rf
88
84
  - matplotlib
89
85
  - numpy
90
- - gdspy
86
+ - gdstk
91
87
  - meshio
92
88
  - pyvista
93
89
  - pyvistaqt
@@ -95,7 +95,7 @@ The setupEM module also installs these dependencies:
95
95
  - scikit-rf
96
96
  - matplotlib
97
97
  - numpy
98
- - gdspy
98
+ - gdstk
99
99
  - meshio
100
100
  - pyvista
101
101
  - pyvistaqt
@@ -343,6 +343,10 @@ If you then start KLayout using this script, a new menu item is available: Tools
343
343
 
344
344
  If you use setupEM in a publication, please cite it. The **Cite this repository** button on the GitHub repository page gives APA and BibTeX entries, generated from [CITATION.cff](./CITATION.cff).
345
345
 
346
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23766714.svg)](https://doi.org/10.5281/zenodo.23766714)
347
+
348
+ Each release of setupEM is archived on Zenodo with its own DOI. The DOI above, 10.5281/zenodo.23766714, always resolves to the latest version; the record lists the DOIs of all versions, so you can cite the version you used.
349
+
346
350
  Please also cite [gds2palace](https://github.com/VolkerMuehlhaus/gds2palace_ihp_sg13g2), which builds the model, and the [Palace](https://github.com/awslabs/palace) solver that computed your results.
347
351
 
348
352
  # License
@@ -11,6 +11,14 @@ https://github.com/VolkerMuehlhaus/setupEM
11
11
 
12
12
  ## Recent changes
13
13
 
14
+ # What's New - November 19, 2026 (setupEM 0.19.0)
15
+
16
+ Needs gds2palace 0.11 and gds_prepare_for_EM 1.8 or newer (`pip install` updates them). setupEM, gds2palace and gds_prepare_for_EM read layouts with gdstk now instead of gdspy, which is no longer maintained (its polygon fracturing could hang); gdspy is no longer installed with setupEM.
17
+
18
+ **The cell read when the Cellname box says "(default)".** gds2palace 0.11 reads the design cell then: the top-level cell with the largest bounding box, never KLayout's `$$$CONTEXT_INFO$$$`. Before, it read the first top-level cell, which depends on the order in the file (for some KLayout files `$$$CONTEXT_INFO$$$`). The box now names that cell, e.g. "(default: T582_BEOL_D1_300u)", so you see which cell the model and the layout preview use; it is still saved as an empty cell name. Tools > Simplify GDS takes the same cell (gds_prepare_for_EM 1.8).
19
+
20
+ **Tools > Simplify GDS** gets gds_prepare_for_EM 1.8: merged vias are complete (before, rings of vias came out cut open and large via fields lost strips along their fracture lines), circuit blocks whose wiring is drawn as paths are no longer deleted as seal rings, and large layouts are much faster.
21
+
14
22
  # What's New - November 16, 2026 (setupEM 0.18.4)
15
23
 
16
24
  **File > Save (Ctrl+S) saves the settings file you opened.** Opened from a `.simcfg` (e.g. the KLayout plug-in's export, with Open in setupEM), Ctrl+S did nothing: the action existed only for a script edited in place, and changes such as a port wall extension were lost without a question when setupEM was closed. Now:
@@ -31,26 +39,14 @@ Needs gds2palace 0.10.7 or newer (`pip install` updates it).
31
39
 
32
40
  **Internal:** the model script writer of setupEM and setupThermal is now a module without Qt (`script_writer.py`, issue #52). The written scripts are unchanged; `tests/test_script_writer.py` checks 8 recorded scripts against both the GUI and the writer.
33
41
 
34
- # What's New - November 13, 2026 (setupEM 0.18.2)
35
-
36
- **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.
37
-
38
- **Command line fixes** (from issue #52):
39
- - 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.
40
- - `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.
41
-
42
- **Scripts used on two machines** (e.g. Windows and Linux):
43
- - 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.
44
- - 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.
45
-
46
42
  Full history: [CHANGES.md](https://github.com/VolkerMuehlhaus/setupEM/blob/main/doc/CHANGES.md)
47
43
 
48
44
  ---
49
45
 
50
46
  **Note:** the `setupEM` PyPI package itself requires:
51
47
 
52
- - gds2palace>=0.10.7
53
- - gds_prepare_for_EM>=1.6.0
48
+ - gds2palace>=0.11.0
49
+ - gds_prepare_for_EM>=1.8.0
54
50
  - PySide6
55
51
  - shiboken6
56
52
  - scipy
@@ -58,7 +54,7 @@ Full history: [CHANGES.md](https://github.com/VolkerMuehlhaus/setupEM/blob/main/
58
54
  - scikit-rf
59
55
  - matplotlib
60
56
  - numpy
61
- - gdspy
57
+ - gdstk
62
58
  - meshio
63
59
  - pyvista
64
60
  - pyvistaqt
@@ -12,8 +12,8 @@ authors = [
12
12
  { name = "Volker Muehlhaus", email = "volker@muehlhaus.com" }
13
13
  ]
14
14
  dependencies = [
15
- "gds2palace>=0.10.7",
16
- "gds_prepare_for_EM>=1.6.0",
15
+ "gds2palace>=0.11.0",
16
+ "gds_prepare_for_EM>=1.8.0",
17
17
  "PySide6",
18
18
  "shiboken6",
19
19
  "scipy",
@@ -21,7 +21,7 @@ dependencies = [
21
21
  "scikit-rf",
22
22
  "matplotlib",
23
23
  "numpy",
24
- "gdspy",
24
+ "gdstk",
25
25
  "meshio",
26
26
  "pyvista",
27
27
  "pyvistaqt"
@@ -31,4 +31,4 @@ def main():
31
31
 
32
32
 
33
33
  __all__ = ["main"]
34
- __version__ = "0.18.4"
34
+ __version__ = "0.19.0"
@@ -19,7 +19,7 @@
19
19
  """
20
20
  gds_hierarchy_scan.py
21
21
 
22
- Cheap, pure-gdspy GDS cell-hierarchy walkers that never call cell.flatten().
22
+ Cheap GDS cell-hierarchy walkers (gdstk objects) that never call cell.flatten().
23
23
  gds2palace's own gds_reader.read_gds() flattens the whole chosen cell (every
24
24
  array/reference expanded into real, individual polygon objects) before doing
25
25
  anything else - fine for actually building a model, but for a densely-arrayed
@@ -47,11 +47,14 @@ def layers_present_in_range(gds_path, cellname, layer_min, layer_max, purposelis
47
47
  polygon whose datatype is in purposelist (any datatype if purposelist is
48
48
  falsy), anywhere in the cell hierarchy - without flattening. Recursive,
49
49
  memoized-per-cell-name, set-union based: unlike estimate_polygon_count,
50
- presence needs no CellArray columns*rows multiplication (N copies of a
51
- present layer is still just "present"), so CellReference and CellArray
50
+ presence needs no array columns*rows multiplication (N copies of a
51
+ present layer is still just "present"), so plain and array references
52
52
  are treated identically here. Raises on open/resolve failure, same as
53
- open_gds_cell(); callers wrap in their own try/except.
53
+ open_gds_cell() (gds_prepare_for_EM >= 1.8: gdstk library and cell);
54
+ callers wrap in their own try/except.
54
55
  """
56
+ import gdstk
57
+
55
58
  library, cell = open_gds_cell(gds_path, cellname)
56
59
  wanted = set(range(layer_min, layer_max + 1))
57
60
  purposeset = set(int(p) for p in purposelist) if purposelist else None
@@ -62,20 +65,15 @@ def layers_present_in_range(gds_path, cellname, layer_min, layer_max, purposelis
62
65
  if c.name in memo:
63
66
  return memo[c.name]
64
67
  found = set()
65
- for polygonset in c.polygons:
66
- for layer, datatype in zip(polygonset.layers, polygonset.datatypes):
67
- layer = int(layer)
68
- if layer in wanted and (purposeset is None or int(datatype) in purposeset):
69
- found.add(layer)
68
+ for polygon in c.polygons:
69
+ if polygon.layer in wanted and (purposeset is None or polygon.datatype in purposeset):
70
+ found.add(polygon.layer)
70
71
  for ref in c.references:
71
72
  if found >= wanted:
72
73
  break # already covers every requested layer - nothing left to gain
73
- ref_cell = ref.ref_cell
74
- if isinstance(ref_cell, str):
75
- ref_cell = library.cells.get(ref_cell)
76
- if ref_cell is None:
77
- continue
78
- found |= scan(ref_cell)
74
+ if not isinstance(ref.cell, gdstk.Cell):
75
+ continue # cell missing from the file
76
+ found |= scan(ref.cell)
79
77
  memo[c.name] = found
80
78
  return found
81
79
 
@@ -103,10 +103,12 @@ def ports_on_edge(gds, cellname, port_layers):
103
103
  if stamp in _edge_cache:
104
104
  return _edge_cache[stamp]
105
105
  try:
106
- import gdspy
107
- lib = gdspy.GdsLibrary(infile=gds)
108
- cell = lib.cells.get(cellname) or (lib.top_level() or [None])[0]
109
- by_spec = cell.get_polygons(by_spec=True)
106
+ import gdstk
107
+ from gds2palace.util_gds_reader import select_design_cell
108
+ cell = select_design_cell(gdstk.read_gds(gds), cellname) # the cell read_gds() reads
109
+ by_spec = {}
110
+ for polygon in cell.get_polygons(include_paths=True):
111
+ by_spec.setdefault((polygon.layer, polygon.datatype), []).append(polygon.points)
110
112
  except Exception: # noqa: BLE001 - an unreadable layout: the caller falls back to the export's record
111
113
  return None
112
114
  points = [p for polys in by_spec.values() for p in polys if len(p)]
@@ -22,7 +22,6 @@ import numpy as np
22
22
  import importlib.metadata
23
23
  import importlib.util
24
24
  import requests
25
- import gdspy
26
25
  from scipy.interpolate import interp1d
27
26
  from PySide6.QtWidgets import (
28
27
  QApplication, QMainWindow, QWidget, QHBoxLayout, QVBoxLayout,
@@ -21,7 +21,6 @@ import sys, json, os, pathlib, ast, webbrowser, argparse, math
21
21
  import numpy as np
22
22
  import importlib.metadata
23
23
  import requests
24
- import gdspy
25
24
  from scipy.interpolate import interp1d
26
25
  from PySide6.QtWidgets import (
27
26
  QApplication, QMainWindow, QWidget, QHBoxLayout, QVBoxLayout,
@@ -37,7 +37,6 @@ import importlib.metadata
37
37
  import xml.etree.ElementTree as ET
38
38
  import numpy as np
39
39
  import requests
40
- import gdspy
41
40
  import shiboken6
42
41
  from scipy.interpolate import interp1d
43
42
  from PySide6.QtWidgets import (
@@ -302,7 +301,10 @@ def get_saved_value(saved_values, key, default):
302
301
  # (saved_values["cellname"], gds_reader.read_gds()'s cellname= argument, the
303
302
  # generated Python model's settings['cellname']), only the combo box display
304
303
  # uses this label. Translate at the two boundaries with cellname_for_display()/
305
- # cellname_from_display() rather than special-casing "" throughout.
304
+ # cellname_from_display() rather than special-casing "" throughout. Once the GDS
305
+ # file is read, the entry names the cell that "" means: "(default: <cell>)", the
306
+ # design cell gds2palace's read_gds() takes (select_design_cell: the largest
307
+ # top-level cell, never KLayout's $$$CONTEXT_INFO$$$).
306
308
  CELLNAME_DEFAULT_LABEL = "(default)"
307
309
 
308
310
 
@@ -310,8 +312,12 @@ def cellname_for_display(cellname):
310
312
  return cellname if cellname else CELLNAME_DEFAULT_LABEL
311
313
 
312
314
 
315
+ def cellname_default_label(design_cell_name):
316
+ return f"{CELLNAME_DEFAULT_LABEL[:-1]}: {design_cell_name})" if design_cell_name else CELLNAME_DEFAULT_LABEL
317
+
318
+
313
319
  def cellname_from_display(text):
314
- return "" if text == CELLNAME_DEFAULT_LABEL else text
320
+ return "" if text == CELLNAME_DEFAULT_LABEL or text.startswith(CELLNAME_DEFAULT_LABEL[:-1] + ": ") else text
315
321
 
316
322
 
317
323
  def is_setupem_generated(path):
@@ -908,17 +914,19 @@ class FileInputTab(QWidget):
908
914
 
909
915
  def update_cellnames_from_gds(self, filename):
910
916
  if filename:
911
- # get top level cellnames now
917
+ # get the cellnames now, and the design cell that "(default)" stands for
912
918
  try:
913
- lib = gdspy.GdsLibrary()
914
- lib.read_gds(filename)
915
- cellnames = list(lib.cells.keys())
919
+ import gdstk
920
+ from gds2palace.util_gds_reader import select_design_cell
921
+ lib = gdstk.read_gds(filename)
922
+ cellnames = [c.name for c in lib.cells]
923
+ default_name = select_design_cell(lib).name if lib.top_level() else ""
916
924
  except Exception:
917
925
  # called on a just-resolved path during load_values() now, not only after
918
926
  # the user explicitly picked a file via the Browse dialog - be defensive
919
927
  return False
920
928
  self.cellname_box.clear()
921
- self.cellname_box.addItem(CELLNAME_DEFAULT_LABEL)
929
+ self.cellname_box.addItem(cellname_default_label(default_name))
922
930
  for cellname in cellnames:
923
931
  self.cellname_box.addItem(cellname)
924
932
  return True
@@ -1146,7 +1154,8 @@ class FileInputTab(QWidget):
1146
1154
  # was set) with no way to pick a different one without re-browsing for the file.
1147
1155
  saved_cellname = get_saved_value(saved_values, "cellname", "")
1148
1156
  if os.path.isfile(gdsfile) and self.update_cellnames_from_gds(gdsfile):
1149
- index = self.cellname_box.findText(cellname_for_display(saved_cellname))
1157
+ # the "(default: ...)" entry is always the first one
1158
+ index = self.cellname_box.findText(saved_cellname) if saved_cellname else 0
1150
1159
  self.cellname_box.setCurrentIndex(index if index >= 0 else 0)
1151
1160
  else:
1152
1161
  self.cellname_box.clear()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: setupEM
3
- Version: 0.18.4
3
+ Version: 0.19.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,8 +10,8 @@ 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.7
14
- Requires-Dist: gds_prepare_for_EM>=1.6.0
13
+ Requires-Dist: gds2palace>=0.11.0
14
+ Requires-Dist: gds_prepare_for_EM>=1.8.0
15
15
  Requires-Dist: PySide6
16
16
  Requires-Dist: shiboken6
17
17
  Requires-Dist: scipy
@@ -19,7 +19,7 @@ Requires-Dist: requests
19
19
  Requires-Dist: scikit-rf
20
20
  Requires-Dist: matplotlib
21
21
  Requires-Dist: numpy
22
- Requires-Dist: gdspy
22
+ Requires-Dist: gdstk
23
23
  Requires-Dist: meshio
24
24
  Requires-Dist: pyvista
25
25
  Requires-Dist: pyvistaqt
@@ -40,6 +40,14 @@ https://github.com/VolkerMuehlhaus/setupEM
40
40
 
41
41
  ## Recent changes
42
42
 
43
+ # What's New - November 19, 2026 (setupEM 0.19.0)
44
+
45
+ Needs gds2palace 0.11 and gds_prepare_for_EM 1.8 or newer (`pip install` updates them). setupEM, gds2palace and gds_prepare_for_EM read layouts with gdstk now instead of gdspy, which is no longer maintained (its polygon fracturing could hang); gdspy is no longer installed with setupEM.
46
+
47
+ **The cell read when the Cellname box says "(default)".** gds2palace 0.11 reads the design cell then: the top-level cell with the largest bounding box, never KLayout's `$$$CONTEXT_INFO$$$`. Before, it read the first top-level cell, which depends on the order in the file (for some KLayout files `$$$CONTEXT_INFO$$$`). The box now names that cell, e.g. "(default: T582_BEOL_D1_300u)", so you see which cell the model and the layout preview use; it is still saved as an empty cell name. Tools > Simplify GDS takes the same cell (gds_prepare_for_EM 1.8).
48
+
49
+ **Tools > Simplify GDS** gets gds_prepare_for_EM 1.8: merged vias are complete (before, rings of vias came out cut open and large via fields lost strips along their fracture lines), circuit blocks whose wiring is drawn as paths are no longer deleted as seal rings, and large layouts are much faster.
50
+
43
51
  # What's New - November 16, 2026 (setupEM 0.18.4)
44
52
 
45
53
  **File > Save (Ctrl+S) saves the settings file you opened.** Opened from a `.simcfg` (e.g. the KLayout plug-in's export, with Open in setupEM), Ctrl+S did nothing: the action existed only for a script edited in place, and changes such as a port wall extension were lost without a question when setupEM was closed. Now:
@@ -60,26 +68,14 @@ Needs gds2palace 0.10.7 or newer (`pip install` updates it).
60
68
 
61
69
  **Internal:** the model script writer of setupEM and setupThermal is now a module without Qt (`script_writer.py`, issue #52). The written scripts are unchanged; `tests/test_script_writer.py` checks 8 recorded scripts against both the GUI and the writer.
62
70
 
63
- # What's New - November 13, 2026 (setupEM 0.18.2)
64
-
65
- **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.
66
-
67
- **Command line fixes** (from issue #52):
68
- - 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.
69
- - `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.
70
-
71
- **Scripts used on two machines** (e.g. Windows and Linux):
72
- - 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.
73
- - 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.
74
-
75
71
  Full history: [CHANGES.md](https://github.com/VolkerMuehlhaus/setupEM/blob/main/doc/CHANGES.md)
76
72
 
77
73
  ---
78
74
 
79
75
  **Note:** the `setupEM` PyPI package itself requires:
80
76
 
81
- - gds2palace>=0.10.7
82
- - gds_prepare_for_EM>=1.6.0
77
+ - gds2palace>=0.11.0
78
+ - gds_prepare_for_EM>=1.8.0
83
79
  - PySide6
84
80
  - shiboken6
85
81
  - scipy
@@ -87,7 +83,7 @@ Full history: [CHANGES.md](https://github.com/VolkerMuehlhaus/setupEM/blob/main/
87
83
  - scikit-rf
88
84
  - matplotlib
89
85
  - numpy
90
- - gdspy
86
+ - gdstk
91
87
  - meshio
92
88
  - pyvista
93
89
  - pyvistaqt
@@ -37,6 +37,7 @@ src/setupEM/data/SG13G2_200um.xml
37
37
  src/setupEM/data/SG13G2_FEM_200um.xml
38
38
  src/setupEM/data/SG13G2_FEM_200um_passi3D.xml
39
39
  src/setupEM/data/SG13G2_nosub.xml
40
+ tests/test_cellname_default.py
40
41
  tests/test_cli_startup.py
41
42
  tests/test_config_update.py
42
43
  tests/test_config_update_gui.py
@@ -1,5 +1,5 @@
1
- gds2palace>=0.10.7
2
- gds_prepare_for_EM>=1.6.0
1
+ gds2palace>=0.11.0
2
+ gds_prepare_for_EM>=1.8.0
3
3
  PySide6
4
4
  shiboken6
5
5
  scipy
@@ -7,7 +7,7 @@ requests
7
7
  scikit-rf
8
8
  matplotlib
9
9
  numpy
10
- gdspy
10
+ gdstk
11
11
  meshio
12
12
  pyvista
13
13
  pyvistaqt
@@ -0,0 +1,48 @@
1
+ # The Cellname box: "(default: <cell>)" names the cell that an empty cell name stands for, the design cell that
2
+ # gds2palace's read_gds() reads (select_design_cell: the largest top-level cell, never KLayout's $$$CONTEXT_INFO$$$),
3
+ # and is still saved as "". ports_on_edge() looks at that cell too.
4
+ #
5
+ # Run from the repo root: python -m pytest tests
6
+
7
+ import os
8
+ import sys
9
+
10
+ import gdstk
11
+
12
+ os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
13
+ HERE = os.path.dirname(os.path.abspath(__file__))
14
+ sys.path.insert(0, os.path.join(HERE, "..", "src"))
15
+
16
+ from setupEM import piece_set # noqa: E402
17
+ from setupEM.setup_common import (CELLNAME_DEFAULT_LABEL, cellname_default_label, # noqa: E402
18
+ cellname_for_display, cellname_from_display)
19
+
20
+
21
+ def multi_top(path):
22
+ """$$$CONTEXT_INFO$$$ first and largest (no port), a small device cell placed nowhere (port on its right edge),
23
+ the design with a port on its left edge (layer 201): each cell gives another answer. The old first-top-level
24
+ choice depended on the reader's order (gdspy's even varied between runs)."""
25
+ lib = gdstk.Library()
26
+ lib.new_cell("$$$CONTEXT_INFO$$$").add(gdstk.rectangle((0, 0), (1000, 1000), layer=1))
27
+ lib.new_cell("small_device").add(gdstk.rectangle((0, 0), (10, 10), layer=134),
28
+ gdstk.rectangle((10, 4), (10, 6), layer=201)) # a port on its right edge
29
+ design = lib.new_cell("DESIGN")
30
+ design.add(gdstk.rectangle((0, -50), (300, 50), layer=134), gdstk.rectangle((0, -5), (0, 5), layer=201))
31
+ lib.write_gds(str(path))
32
+ return str(path)
33
+
34
+
35
+ def test_default_label_round_trip():
36
+ label = cellname_default_label("DESIGN")
37
+ assert label == "(default: DESIGN)"
38
+ assert cellname_from_display(label) == ""
39
+ assert cellname_from_display(CELLNAME_DEFAULT_LABEL) == ""
40
+ assert cellname_from_display("DESIGN") == "DESIGN"
41
+ assert cellname_for_display("") == CELLNAME_DEFAULT_LABEL
42
+ assert cellname_default_label("") == CELLNAME_DEFAULT_LABEL
43
+
44
+
45
+ def test_ports_on_edge_reads_the_design_cell(tmp_path):
46
+ path = multi_top(tmp_path / "multi.gds")
47
+ assert gdstk.read_gds(path).top_level()[0].name != "DESIGN"
48
+ assert piece_set.ports_on_edge(path, "", {201}) == {"xmin"}
@@ -10,7 +10,7 @@ import json
10
10
  import os
11
11
  import sys
12
12
 
13
- import gdspy
13
+ import gdstk
14
14
  import numpy as np
15
15
  import pytest
16
16
  import skrf as rf
@@ -47,17 +47,17 @@ def messages(monkeypatch):
47
47
  def _gds(path, x0, x1, ports=(201, 202), ymin_port=None):
48
48
  """a line from x0 to x1 between two ground strips; ports: the layers of the port at x0 and at x1 (None: no port
49
49
  there); ymin_port: the layer of a port on the lower layout edge"""
50
- lib = gdspy.GdsLibrary()
51
- cell = gdspy.Cell("line", exclude_from_current=True)
50
+ lib = gdstk.Library()
51
+ cell = gdstk.Cell("line")
52
52
  lib.add(cell)
53
- cell.add(gdspy.Rectangle((x0, -5), (x1, 5), layer=134))
53
+ cell.add(gdstk.rectangle((x0, -5), (x1, 5), layer=134))
54
54
  for y0, y1 in ((-55, -15), (15, 55)):
55
- cell.add(gdspy.Rectangle((x0, y0), (x1, y1), layer=134))
55
+ cell.add(gdstk.rectangle((x0, y0), (x1, y1), layer=134))
56
56
  for layer, x in zip(ports, (x0, x1)):
57
57
  if layer:
58
- cell.add(gdspy.Rectangle((x, -5), (x, 5), layer=layer))
58
+ cell.add(gdstk.rectangle((x, -5), (x, 5), layer=layer))
59
59
  if ymin_port:
60
- cell.add(gdspy.Rectangle((x0 + 20, -55), (x0 + 30, -55), layer=ymin_port))
60
+ cell.add(gdstk.rectangle((x0 + 20, -55), (x0 + 30, -55), layer=ymin_port))
61
61
  lib.write_gds(str(path))
62
62
  return str(path).replace("\\", "/")
63
63
 
@@ -7,7 +7,7 @@
7
7
  import os
8
8
  import sys
9
9
 
10
- import gdspy
10
+ import gdstk
11
11
  import pytest
12
12
 
13
13
  os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
@@ -51,17 +51,17 @@ def answer(monkeypatch, button_text):
51
51
 
52
52
  def gssg_gds(path, stub_on_ymax=False):
53
53
  """GSSG lines from the xmin edge, ports 1 um deep on 201/202; optionally a stub with a port on the ymax edge"""
54
- lib = gdspy.GdsLibrary()
55
- cell = gdspy.Cell("line", exclude_from_current=True)
54
+ lib = gdstk.Library()
55
+ cell = gdstk.Cell("line")
56
56
  lib.add(cell)
57
57
  for k, (y0, y1) in enumerate([(-15, -5), (5, 15)]):
58
- cell.add(gdspy.Rectangle((0, y0), (300, y1), layer=134))
59
- cell.add(gdspy.Rectangle((0, y0), (1, y1), layer=201 + k))
58
+ cell.add(gdstk.rectangle((0, y0), (300, y1), layer=134))
59
+ cell.add(gdstk.rectangle((0, y0), (1, y1), layer=201 + k))
60
60
  for y0, y1 in ((-65, -25), (25, 65)):
61
- cell.add(gdspy.Rectangle((0, y0), (300, y1), layer=134))
61
+ cell.add(gdstk.rectangle((0, y0), (300, y1), layer=134))
62
62
  if stub_on_ymax:
63
- cell.add(gdspy.Rectangle((150, 65), (160, 80), layer=134))
64
- cell.add(gdspy.Rectangle((150, 79), (160, 80), layer=203))
63
+ cell.add(gdstk.rectangle((150, 65), (160, 80), layer=134))
64
+ cell.add(gdstk.rectangle((150, 79), (160, 80), layer=203))
65
65
  lib.write_gds(str(path))
66
66
  return str(path)
67
67
 
@@ -205,15 +205,15 @@ def test_a_via_port_row_keeps_topmetal2_as_target(monkeypatch, app, tmp_path):
205
205
 
206
206
 
207
207
  def test_an_error_on_one_wall_still_checks_the_other(monkeypatch, app, messages, tmp_path):
208
- lib = gdspy.GdsLibrary()
209
- cell = gdspy.Cell("line", exclude_from_current=True)
208
+ lib = gdstk.Library()
209
+ cell = gdstk.Cell("line")
210
210
  lib.add(cell)
211
211
  for k, (y0, y1) in enumerate([(-15, -5), (5, 15)]):
212
- cell.add(gdspy.Rectangle((0, y0), (300, y1), layer=134))
213
- cell.add(gdspy.Rectangle((0, y0), (1, y1), layer=201 + k))
214
- cell.add(gdspy.Rectangle((299, y0), (300, y1), layer=203 + k))
212
+ cell.add(gdstk.rectangle((0, y0), (300, y1), layer=134))
213
+ cell.add(gdstk.rectangle((0, y0), (1, y1), layer=201 + k))
214
+ cell.add(gdstk.rectangle((299, y0), (300, y1), layer=203 + k))
215
215
  for y0, y1 in ((-65, -25), (25, 65)):
216
- cell.add(gdspy.Rectangle((0, y0), (300, y1), layer=134))
216
+ cell.add(gdstk.rectangle((0, y0), (300, y1), layer=134))
217
217
  lib.write_gds(str(tmp_path / "line.gds"))
218
218
  window, module = open_window(monkeypatch, str(tmp_path / "line.gds"), ports=(1, 2, 3, 4))
219
219
  window.ports_tab.portslist.item(0, 3).setText("LBE")
@@ -251,13 +251,13 @@ def test_target_and_via_presets_use_the_topmost_metal(monkeypatch, app, stackup,
251
251
 
252
252
  def test_a_via_port_on_a_port_wall_is_used_as_a_gap_port(monkeypatch, app, messages, tmp_path):
253
253
  """the 60 GHz PA case: TopMetal2 lines over a Metal3 plane, via ports Metal3 -> TopMetal2 along the edge"""
254
- lib = gdspy.GdsLibrary()
255
- cell = gdspy.Cell("line", exclude_from_current=True)
254
+ lib = gdstk.Library()
255
+ cell = gdstk.Cell("line")
256
256
  lib.add(cell)
257
257
  for k, (y0, y1) in enumerate([(-15, -5), (5, 15)]):
258
- cell.add(gdspy.Rectangle((0, y0), (300, y1), layer=134))
259
- cell.add(gdspy.Rectangle((0, y0), (0, y1), layer=201 + k))
260
- cell.add(gdspy.Rectangle((0, -65), (300, 65), layer=30))
258
+ cell.add(gdstk.rectangle((0, y0), (300, y1), layer=134))
259
+ cell.add(gdstk.rectangle((0, y0), (0, y1), layer=201 + k))
260
+ cell.add(gdstk.rectangle((0, -65), (300, 65), layer=30))
261
261
  lib.write_gds(str(tmp_path / "line.gds"))
262
262
  window, module = open_window(monkeypatch, str(tmp_path / "line.gds"))
263
263
  window.ports_tab.update_port_from_import([
@@ -331,14 +331,14 @@ def test_window_size_and_divider_are_kept_between_sessions(monkeypatch, app):
331
331
 
332
332
  def test_extension_auto_is_checked_saved_and_shown(monkeypatch, app, messages, tmp_path):
333
333
  from setupEM.layout_preview import LayoutPreviewWindow
334
- lib = gdspy.GdsLibrary()
335
- cell = gdspy.Cell("line", exclude_from_current=True)
334
+ lib = gdstk.Library()
335
+ cell = gdstk.Cell("line")
336
336
  lib.add(cell)
337
337
  for k, (y0, y1) in enumerate([(-15, -5), (5, 15)]):
338
- cell.add(gdspy.Rectangle((0, y0), (20, y1), layer=134))
339
- cell.add(gdspy.Rectangle((0, y0), (1, y1), layer=201 + k))
340
- cell.add(gdspy.Rectangle((20, -40), (120, 40), layer=134))
341
- cell.add(gdspy.Rectangle((0, -60), (120, 60), layer=250))
338
+ cell.add(gdstk.rectangle((0, y0), (20, y1), layer=134))
339
+ cell.add(gdstk.rectangle((0, y0), (1, y1), layer=201 + k))
340
+ cell.add(gdstk.rectangle((20, -40), (120, 40), layer=134))
341
+ cell.add(gdstk.rectangle((0, -60), (120, 60), layer=250))
342
342
  lib.write_gds(str(tmp_path / "dev.gds"))
343
343
  window, module = open_window(monkeypatch, str(tmp_path / "dev.gds"))
344
344
  window.mesh_tab.set_port_wall("xmin")
@@ -36,12 +36,12 @@ def app(monkeypatch):
36
36
  @pytest.fixture
37
37
  def export(tmp_path):
38
38
  """A thermal export as the plug-in writes it: GDS (outline on 201, a box per heat source), .tsimcfg, map."""
39
- import gdspy
40
- lib = gdspy.GdsLibrary()
41
- cell = lib.add(gdspy.Cell("cascode", exclude_from_current=True)).cells["cascode"]
42
- cell.add(gdspy.Rectangle((0, 0), (100, 100), layer=201))
39
+ import gdstk
40
+ lib = gdstk.Library()
41
+ cell = lib.new_cell("cascode")
42
+ cell.add(gdstk.rectangle((0, 0), (100, 100), layer=201))
43
43
  for n, layer in enumerate(LAYERS):
44
- cell.add(gdspy.Rectangle((10 * n, 10), (10 * n + 5, 15), layer=layer))
44
+ cell.add(gdstk.rectangle((10 * n, 10), (10 * n + 5, 15), layer=layer))
45
45
  gds = tmp_path / "cascode_thermal.gds"
46
46
  lib.write_gds(str(gds))
47
47
  sources = [{"layer": layer, "device": f"dev{n}@{n},0", "pcell": "npn13G2" if "Q" in name else "rhigh",
File without changes
File without changes