setupEM 0.18.4__tar.gz → 0.19.1__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 (65) hide show
  1. setupem-0.19.1/PKG-INFO +85 -0
  2. {setupem-0.18.4 → setupem-0.19.1}/README.md +5 -1
  3. setupem-0.19.1/README_pypi.md +56 -0
  4. {setupem-0.18.4 → setupem-0.19.1}/pyproject.toml +3 -3
  5. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/__init__.py +1 -1
  6. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/gds_hierarchy_scan.py +13 -15
  7. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/layout_preview.py +47 -24
  8. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/piece_set.py +6 -4
  9. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/setupEM.py +57 -33
  10. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/setupThermal.py +0 -1
  11. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/setup_common.py +18 -9
  12. setupem-0.19.1/src/setupEM.egg-info/PKG-INFO +85 -0
  13. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM.egg-info/SOURCES.txt +2 -0
  14. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM.egg-info/requires.txt +3 -3
  15. setupem-0.19.1/tests/test_cellname_default.py +48 -0
  16. {setupem-0.18.4 → setupem-0.19.1}/tests/test_piece_set.py +7 -7
  17. {setupem-0.18.4 → setupem-0.19.1}/tests/test_port_walls.py +25 -25
  18. setupem-0.19.1/tests/test_status_line.py +117 -0
  19. {setupem-0.18.4 → setupem-0.19.1}/tests/test_thermal_powers.py +5 -5
  20. setupem-0.18.4/PKG-INFO +0 -95
  21. setupem-0.18.4/README_pypi.md +0 -66
  22. setupem-0.18.4/src/setupEM.egg-info/PKG-INFO +0 -95
  23. {setupem-0.18.4 → setupem-0.19.1}/LICENSE +0 -0
  24. {setupem-0.18.4 → setupem-0.19.1}/setup.cfg +0 -0
  25. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/__main__.py +0 -0
  26. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/cli_common.py +0 -0
  27. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/config_update.py +0 -0
  28. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/data/SG13CMOS5L_200um.xml +0 -0
  29. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/data/SG13G2_100um.xml +0 -0
  30. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/data/SG13G2_200um.xml +0 -0
  31. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/data/SG13G2_FEM_200um.xml +0 -0
  32. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/data/SG13G2_FEM_200um_passi3D.xml +0 -0
  33. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/data/SG13G2_nosub.xml +0 -0
  34. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/field_viewer.py +0 -0
  35. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/join_pieces.py +0 -0
  36. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/momentum_import.py +0 -0
  37. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/palace_results.py +0 -0
  38. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/result_viewer.py +0 -0
  39. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/run_with_overrides.py +0 -0
  40. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/script_model.py +0 -0
  41. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/script_probe.py +0 -0
  42. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/script_writer.py +0 -0
  43. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/simplify_gds.py +0 -0
  44. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/stackupEditor.py +0 -0
  45. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/stackup_writer.py +0 -0
  46. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM/thermal_results.py +0 -0
  47. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM.egg-info/dependency_links.txt +0 -0
  48. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM.egg-info/entry_points.txt +0 -0
  49. {setupem-0.18.4 → setupem-0.19.1}/src/setupEM.egg-info/top_level.txt +0 -0
  50. {setupem-0.18.4 → setupem-0.19.1}/tests/test_cli_startup.py +0 -0
  51. {setupem-0.18.4 → setupem-0.19.1}/tests/test_config_update.py +0 -0
  52. {setupem-0.18.4 → setupem-0.19.1}/tests/test_config_update_gui.py +0 -0
  53. {setupem-0.18.4 → setupem-0.19.1}/tests/test_deembedded_view.py +0 -0
  54. {setupem-0.18.4 → setupem-0.19.1}/tests/test_export_no_gui.py +0 -0
  55. {setupem-0.18.4 → setupem-0.19.1}/tests/test_join_pieces.py +0 -0
  56. {setupem-0.18.4 → setupem-0.19.1}/tests/test_margin_per_side.py +0 -0
  57. {setupem-0.18.4 → setupem-0.19.1}/tests/test_qt_platform_noise.py +0 -0
  58. {setupem-0.18.4 → setupem-0.19.1}/tests/test_return_applies.py +0 -0
  59. {setupem-0.18.4 → setupem-0.19.1}/tests/test_run_with_overrides.py +0 -0
  60. {setupem-0.18.4 → setupem-0.19.1}/tests/test_save_current_file.py +0 -0
  61. {setupem-0.18.4 → setupem-0.19.1}/tests/test_script_model.py +0 -0
  62. {setupem-0.18.4 → setupem-0.19.1}/tests/test_script_probe.py +0 -0
  63. {setupem-0.18.4 → setupem-0.19.1}/tests/test_script_writer.py +0 -0
  64. {setupem-0.18.4 → setupem-0.19.1}/tests/test_table_rows.py +0 -0
  65. {setupem-0.18.4 → setupem-0.19.1}/tests/test_thermal_results.py +0 -0
@@ -0,0 +1,85 @@
1
+ Metadata-Version: 2.4
2
+ Name: setupEM
3
+ Version: 0.19.1
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.12.0
14
+ Requires-Dist: gds_prepare_for_EM>=1.8.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: gdstk
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
+ ![Intro](https://raw.githubusercontent.com/VolkerMuehlhaus/setupEM/main/doc/png/setupEM_banner.png)
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 22, 2026 (setupEM 0.19.1)
44
+
45
+ Needs gds2palace 0.12.0 or newer (`pip install` updates it).
46
+
47
+ **Tube ports in the layout preview.** gds2palace 0.12.0 builds a via port shape drawn with an area (short side more than 10 % of the long side) as a tube port: the four side walls of the shape's bounding box, as one port. This is meant for a port that stands for a real conductor, e.g. a copper pillar between two chips that are simulated as two separate models (example `more_examples/chiplet_split_at_pillars` in the gds2palace repository). The layout preview draws such a port as its four walls. Via ports drawn as lines are shown as one sheet, as before.
48
+
49
+ **Status line with Palace 0.19.** Palace 0.19 writes the progress of the adaptive frequency sweep in a new form, and the status line stayed at "Port: n/a | Freq: ROM build" for the whole sweep. It now shows port and frequency progress with Palace 0.19 as with older versions, and a model with one excitation shows "Port 1/1". After a run with adaptive mesh refinement, the AMR iteration no longer drops back by one at the end (e.g. from 2/2 to 1/2).
50
+
51
+ # What's New - November 19, 2026 (setupEM 0.19.0)
52
+
53
+ 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.
54
+
55
+ **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).
56
+
57
+ **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.
58
+
59
+ # What's New - November 16, 2026 (setupEM 0.18.4)
60
+
61
+ **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:
62
+ - Ctrl+S saves into the `.simcfg` / `.tsimcfg` the model was opened from (the menu names it). Its other entries, e.g. the plug-in's link to the model script, are kept. A script edited in place and a piece of a split region are saved as before; a new model asks for a file name.
63
+ - Closing setupEM, opening another file or File > New asks "Save the changes to ...?" when the settings changed since the file was opened or saved.
64
+
65
+ Full history: [CHANGES.md](https://github.com/VolkerMuehlhaus/setupEM/blob/main/doc/CHANGES.md)
66
+
67
+ ---
68
+
69
+ **Note:** the `setupEM` PyPI package itself requires:
70
+
71
+ - gds2palace>=0.12.0
72
+ - gds_prepare_for_EM>=1.8.0
73
+ - PySide6
74
+ - shiboken6
75
+ - scipy
76
+ - requests
77
+ - scikit-rf
78
+ - matplotlib
79
+ - numpy
80
+ - gdstk
81
+ - meshio
82
+ - pyvista
83
+ - pyvistaqt
84
+
85
+ (Other Python modules mentioned above are only needed to run standalone helper scripts in this repository, not to use the installed package.)
@@ -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
@@ -0,0 +1,56 @@
1
+ # Python GUI for gds2palace
2
+
3
+ ![Intro](https://raw.githubusercontent.com/VolkerMuehlhaus/setupEM/main/doc/png/setupEM_banner.png)
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 22, 2026 (setupEM 0.19.1)
15
+
16
+ Needs gds2palace 0.12.0 or newer (`pip install` updates it).
17
+
18
+ **Tube ports in the layout preview.** gds2palace 0.12.0 builds a via port shape drawn with an area (short side more than 10 % of the long side) as a tube port: the four side walls of the shape's bounding box, as one port. This is meant for a port that stands for a real conductor, e.g. a copper pillar between two chips that are simulated as two separate models (example `more_examples/chiplet_split_at_pillars` in the gds2palace repository). The layout preview draws such a port as its four walls. Via ports drawn as lines are shown as one sheet, as before.
19
+
20
+ **Status line with Palace 0.19.** Palace 0.19 writes the progress of the adaptive frequency sweep in a new form, and the status line stayed at "Port: n/a | Freq: ROM build" for the whole sweep. It now shows port and frequency progress with Palace 0.19 as with older versions, and a model with one excitation shows "Port 1/1". After a run with adaptive mesh refinement, the AMR iteration no longer drops back by one at the end (e.g. from 2/2 to 1/2).
21
+
22
+ # What's New - November 19, 2026 (setupEM 0.19.0)
23
+
24
+ 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.
25
+
26
+ **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).
27
+
28
+ **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.
29
+
30
+ # What's New - November 16, 2026 (setupEM 0.18.4)
31
+
32
+ **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:
33
+ - Ctrl+S saves into the `.simcfg` / `.tsimcfg` the model was opened from (the menu names it). Its other entries, e.g. the plug-in's link to the model script, are kept. A script edited in place and a piece of a split region are saved as before; a new model asks for a file name.
34
+ - Closing setupEM, opening another file or File > New asks "Save the changes to ...?" when the settings changed since the file was opened or saved.
35
+
36
+ Full history: [CHANGES.md](https://github.com/VolkerMuehlhaus/setupEM/blob/main/doc/CHANGES.md)
37
+
38
+ ---
39
+
40
+ **Note:** the `setupEM` PyPI package itself requires:
41
+
42
+ - gds2palace>=0.12.0
43
+ - gds_prepare_for_EM>=1.8.0
44
+ - PySide6
45
+ - shiboken6
46
+ - scipy
47
+ - requests
48
+ - scikit-rf
49
+ - matplotlib
50
+ - numpy
51
+ - gdstk
52
+ - meshio
53
+ - pyvista
54
+ - pyvistaqt
55
+
56
+ (Other Python modules mentioned above are only needed to run standalone helper scripts in this repository, not to use the installed package.)
@@ -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.12.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.1"
@@ -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
 
@@ -167,6 +167,17 @@ VIA_POSITIVE_COLOR = PORT_OUTLINE_COLOR # pink/magenta: +Z, current out of the
167
167
  VIA_NEGATIVE_COLOR = "#3399ff" # blue: -Z, current into the page
168
168
 
169
169
 
170
+ def _via_port_is_tube(size_x, size_y):
171
+ """True if gds2palace makes a tube port (four side walls) from a via port shape of this size:
172
+ gds2palace 0.12.0 and newer, for a shape whose short side is more than 10 % of its long side.
173
+ Always False with an older gds2palace, which makes one sheet from any shape."""
174
+ try:
175
+ from gds2palace import simulation_setup
176
+ return bool(simulation_setup.via_port_is_tube(size_x, size_y))
177
+ except (ImportError, AttributeError):
178
+ return False
179
+
180
+
170
181
  def _via_marker_items(negative):
171
182
  """Graphics item for a Z/-Z via port's marker: a filled circle at the port
172
183
  location - pink for current out of the page (+Z), blue for into the page
@@ -1406,12 +1417,15 @@ class LayoutPreviewWindow(QDialog):
1406
1417
 
1407
1418
  # A via port (from_layername/to_layername, not target_layername)
1408
1419
  # whose drawn marker polygon has finite size in BOTH x and y isn't
1409
- # actually meshed as that full rectangle - gds2palace's add_ports()
1410
- # (util_simulation_setup.py) collapses whichever axis is shorter
1411
- # down to its minimum edge (not its true center, despite what the
1412
- # user guide says) and keeps only the longer axis at full extent,
1413
- # to get a single 2D sheet. Show that effective line so a
1414
- # finite-area via port doesn't look like it becomes a full sheet.
1420
+ # meshed as that full rectangle. gds2palace's add_ports()
1421
+ # (util_simulation_setup.py) makes one of two things from it:
1422
+ # - a narrow box (a line): one sheet along the longer axis, at the
1423
+ # min edge of the shorter axis (not its center);
1424
+ # - a shape with area (gds2palace 0.12.0 and newer, see
1425
+ # via_port_is_tube()): a tube port, the four side walls of the
1426
+ # bounding box.
1427
+ # Show those effective sheets so a finite-area via port doesn't
1428
+ # look like it becomes a full sheet.
1415
1429
  # Unlike the fixed-pixel-size markers above, this must scale/pan
1416
1430
  # with the real geometry, so it's added directly rather than
1417
1431
  # through the ItemIgnoresTransformations + setPos() path.
@@ -1419,25 +1433,34 @@ class LayoutPreviewWindow(QDialog):
1419
1433
  size_x = poly.xmax - poly.xmin
1420
1434
  size_y = poly.ymax - poly.ymin
1421
1435
  if size_x > 0 and size_y > 0:
1422
- if size_y > size_x:
1423
- line = QLineF(QPointF(poly.xmin, -poly.ymin), QPointF(poly.xmin, -poly.ymax))
1436
+ is_tube = _via_port_is_tube(size_x, size_y)
1437
+ x0, x1, y0, y1 = poly.xmin, poly.xmax, -poly.ymin, -poly.ymax
1438
+ if is_tube:
1439
+ lines = [QLineF(QPointF(x0, y0), QPointF(x0, y1)), QLineF(QPointF(x1, y0), QPointF(x1, y1)),
1440
+ QLineF(QPointF(x0, y0), QPointF(x1, y0)), QLineF(QPointF(x0, y1), QPointF(x1, y1))]
1441
+ sheet_tooltip = (" - tube port: the four side walls of the drawn shape "
1442
+ "(for a port that stands for a conductor, not de-embedded)")
1443
+ elif size_y > size_x:
1444
+ lines = [QLineF(QPointF(x0, y0), QPointF(x0, y1))]
1424
1445
  else:
1425
- line = QLineF(QPointF(poly.xmin, -poly.ymin), QPointF(poly.xmax, -poly.ymin))
1426
- centerline_item = QGraphicsLineItem(line)
1427
- # fat and dashed, deliberately much bolder than the
1428
- # input frame's own solid MARKER_OUTLINE_WIDTH
1429
- # outline, so it reads as the actual simulated line
1430
- # rather than getting lost inside the drawn rectangle
1431
- centerline_pen = QPen(QColor(outline_color), MARKER_OUTLINE_WIDTH * 2)
1432
- centerline_pen.setCosmetic(True)
1433
- centerline_pen.setStyle(Qt.DashLine)
1434
- centerline_item.setPen(centerline_pen)
1435
- centerline_item.setToolTip(
1436
- tooltip + " - effective via port sheet "
1437
- "(gds2palace pins the shorter axis to its min edge)")
1438
- centerline_item.setZValue(marker_zvalue + 1)
1439
- scene.addItem(centerline_item)
1440
- group.add(centerline_item)
1446
+ lines = [QLineF(QPointF(x0, y0), QPointF(x1, y0))]
1447
+ if not is_tube:
1448
+ sheet_tooltip = (" - effective via port sheet "
1449
+ "(gds2palace pins the shorter axis to its min edge)")
1450
+ for line in lines:
1451
+ centerline_item = QGraphicsLineItem(line)
1452
+ # fat and dashed, deliberately much bolder than the
1453
+ # input frame's own solid MARKER_OUTLINE_WIDTH
1454
+ # outline, so it reads as the actual simulated sheet
1455
+ # rather than getting lost inside the drawn rectangle
1456
+ centerline_pen = QPen(QColor(outline_color), MARKER_OUTLINE_WIDTH * 2)
1457
+ centerline_pen.setCosmetic(True)
1458
+ centerline_pen.setStyle(Qt.DashLine)
1459
+ centerline_item.setPen(centerline_pen)
1460
+ centerline_item.setToolTip(tooltip + sheet_tooltip)
1461
+ centerline_item.setZValue(marker_zvalue + 1)
1462
+ scene.addItem(centerline_item)
1463
+ group.add(centerline_item)
1441
1464
 
1442
1465
  text = QGraphicsSimpleTextItem(label_text)
1443
1466
  font = QFont()
@@ -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,
@@ -2545,32 +2544,39 @@ class CreateModelTab(CreateModelTabBase):
2545
2544
  _RE_STANDARD = re.compile(r"^calibration standard (\d+) of (\d+): ([^,\s]+)")
2546
2545
  _RE_STANDARD_REUSED = re.compile(r"^\s*reused, solved")
2547
2546
  _RE_DEVICE_MODEL = re.compile(r"^device model\s*$")
2548
- _RE_EXCITATION = re.compile(r"(?:Sweeping|Adding) excitation index \d+ \((\d+)/(\d+)\):")
2547
+ # Palace 0.19 prints "Sweeping excitation index 5:" without "(k/N)" in the PROM online
2548
+ # phase, so the position is optional here and then comes from the excitation map below.
2549
+ _RE_EXCITATION = re.compile(r"(?:Sweeping|Adding) excitation index (\d+)(?: \((\d+)/(\d+)\))?:")
2550
+ # Printed once per excitation before any solve, same wording in Palace 0.15 to 0.19:
2551
+ # "Excitation 2/3 with index 5 has contributions from:" (several excitations)
2552
+ # "Excitation with index 1 has contributions from:" (one excitation)
2553
+ # It maps an excitation index to its position, for log lines that only name the index.
2554
+ _RE_EXCITATION_MAP = re.compile(r"^Excitation(?: (\d+)/(\d+))? with index (\d+) has contributions from:")
2549
2555
  # "It i/n: ... (total elapsed time = t s, solve k/N)" in a uniform sweep, but only
2550
2556
  # "It i/n: ... (total elapsed time = t s)" - no trailing solve k/N - during PROM's online
2551
2557
  # (interpolated-evaluation) phase, so the solve suffix is matched separately and is
2552
2558
  # optional; its presence is what distinguishes a real full-order solve from a PROM
2553
2559
  # evaluation (see _parse_palace_status_line).
2554
- _RE_FREQ = re.compile(r"It (\d+)/(\d+):")
2560
+ # Palace 0.19 names the excitation in the PROM online phase, which runs frequency by
2561
+ # frequency through all excitations: "It 5/119, excitation 2: ω/2π = ..." (0.18 and older:
2562
+ # "It 5/119: ω/2π = ...", one excitation after the other).
2563
+ _RE_FREQ = re.compile(r"It (\d+)/(\d+)(?:, excitation (\d+))?:")
2555
2564
  _RE_SOLVE_SUFFIX = re.compile(r"solve (\d+)/(\d+)\)")
2556
2565
  # PROM's offline phase (building the reduced-order model) has no "It i/n" progress at
2557
2566
  # all - only these per-port greedy-sampling steps, with no fixed total to divide by:
2558
2567
  # "Greedy iteration 1 (n = 4): ω* = 2.716e+01 GHz (4.986e-01), error = 7.573e-03, memory = 1/2"
2559
2568
  _RE_GREEDY = re.compile(r"Greedy iteration (\d+) \(n = (\d+)\):")
2560
- # Different Palace releases report each just-finished AMR pass differently, but both
2561
- # number 1-based from the very first (unrefined-mesh) solve - there is no "iteration 0"
2562
- # in either wording. Confirmed two ways: the "global unknowns" figure on these lines
2563
- # matches the DOF count of the solve that just finished (not a next/refined mesh), and
2564
- # palace_results.py's own output-folder naming (iteration1/, iteration2/, ...) uses the
2565
- # same 1-based scheme.
2566
- # "Completed 1 iteration of adaptive mesh refinement (AMR): Indicator norm=..., global unknowns=..." (older release)
2567
- # "Adaptive mesh refinement (AMR) iteration 1: Indicator norm=..., global unknowns=..." (v0.16.0-34-gea2e7b23)
2568
- # The newer release also prints "Proceeding with solve/estimate iteration 2..." right
2569
- # after refining/rebalancing, announcing the *next* iteration before its ports start
2570
- # solving - matched separately so the display updates immediately instead of lagging one
2571
- # iteration behind until that next iteration's own report line finally appears.
2572
- _RE_AMR_ITER_A = re.compile(r"Completed (\d+) iteration.*adaptive mesh refinement \(AMR\)")
2573
- _RE_AMR_ITER_B = re.compile(r"Adaptive mesh refinement \(AMR\) iteration (\d+):")
2569
+ # AMR lines, the same wording in Palace 0.12 to 0.19 (checked in the sources and in 0.18.1 and
2570
+ # 0.19.0 runs). Palace numbers solve passes from 1, the unrefined mesh being pass 1, like the
2571
+ # output folders iteration1/, iteration2/, ... that palace_results.py reads:
2572
+ # "Adaptive mesh refinement (AMR) iteration 1:" after pass 1 is solved, before refining
2573
+ # "Proceeding with solve/estimate iteration 2..." pass 2 (on the refined mesh) starts
2574
+ # "Completed 2 iterations of adaptive mesh refinement (AMR):" once, at the end
2575
+ # The status line counts refinements instead (the unrefined mesh is 0, the last pass of a
2576
+ # MaxIts=2 run is 2/2): pass numbers minus 1, but the final "Completed N" already counts
2577
+ # refinements and is shown as it is.
2578
+ _RE_AMR_DONE = re.compile(r"Completed (\d+) iterations? of adaptive mesh refinement \(AMR\)")
2579
+ _RE_AMR_ITER = re.compile(r"Adaptive mesh refinement \(AMR\) iteration (\d+):")
2574
2580
  _RE_AMR_PROCEEDING = re.compile(r"Proceeding with solve/estimate iteration (\d+)")
2575
2581
  # Frequency of the solve that follows: "It 7/7: ω/2π = 1.700e+02 GHz (...)" in a uniform
2576
2582
  # sweep, "Greedy iteration 1 (n = 4): ω* = 2.716e+01 GHz (...)" while PROM builds its model.
@@ -2599,6 +2605,7 @@ class CreateModelTab(CreateModelTabBase):
2599
2605
  self._status_solve_freq_ghz = None
2600
2606
  self._nonconverged = []
2601
2607
  self._status_stage = None # with port walls: which solve of run_sim runs (a standard or the model)
2608
+ self._status_excitations = {} # excitation index -> (position, total), see _RE_EXCITATION_MAP
2602
2609
  self._update_status_line()
2603
2610
 
2604
2611
  def _reset_status_for_run(self):
@@ -2632,6 +2639,7 @@ class CreateModelTab(CreateModelTabBase):
2632
2639
  def _new_solve(self, stage):
2633
2640
  """A new Palace run in run_sim (a calibration standard or the model): its own ports and frequencies"""
2634
2641
  self._status_stage = stage
2642
+ self._status_excitations = {}
2635
2643
  self._status_port_cur = self._status_port_total = None
2636
2644
  self._status_freq_display = None
2637
2645
  self._status_solve_display = ""
@@ -2665,10 +2673,18 @@ class CreateModelTab(CreateModelTabBase):
2665
2673
  self._update_status_line()
2666
2674
  return
2667
2675
 
2676
+ m = self._RE_EXCITATION_MAP.search(line)
2677
+ if m:
2678
+ position, total = (int(m.group(1)), int(m.group(2))) if m.group(1) else (1, 1)
2679
+ self._status_excitations[int(m.group(3))] = (position, total)
2680
+ return
2681
+
2668
2682
  m = self._RE_EXCITATION.search(line)
2669
2683
  if m:
2670
- self._status_port_cur = int(m.group(1))
2671
- self._status_port_total = int(m.group(2))
2684
+ if m.group(2):
2685
+ self._status_port_cur, self._status_port_total = int(m.group(2)), int(m.group(3))
2686
+ else:
2687
+ self._set_port_from_excitation_index(int(m.group(1)))
2672
2688
  # New port: the previous port's frequency/solve position no longer applies.
2673
2689
  self._status_freq_display = None
2674
2690
  self._status_solve_display = ""
@@ -2678,6 +2694,11 @@ class CreateModelTab(CreateModelTabBase):
2678
2694
 
2679
2695
  m = self._RE_FREQ.search(line)
2680
2696
  if m:
2697
+ if m.group(3):
2698
+ self._set_port_from_excitation_index(int(m.group(3)))
2699
+ elif self._status_port_cur is None and len(self._status_excitations) == 1:
2700
+ # one excitation: Palace prints no "excitation index" line at all
2701
+ self._status_port_cur = self._status_port_total = 1
2681
2702
  solve_m = self._RE_SOLVE_SUFFIX.search(line)
2682
2703
  if solve_m:
2683
2704
  # Real per-frequency full-order solve (uniform sweep) - meaningful progress.
@@ -2702,23 +2723,26 @@ class CreateModelTab(CreateModelTabBase):
2702
2723
  self._update_status_line()
2703
2724
  return
2704
2725
 
2705
- for amr_re in (self._RE_AMR_ITER_A, self._RE_AMR_ITER_B, self._RE_AMR_PROCEEDING):
2706
- m = amr_re.search(line)
2707
- if m and self._status_amr_max:
2708
- # Palace's own log numbers the initial, unrefined-mesh solve as "iteration
2709
- # 1" (confirmed earlier against DOF counts and palace_results.py's own
2710
- # iteration1/iteration2/... folder naming). Displayed here shifted down by
2711
- # 1 instead, so the initial solve reads "0" and each subsequent number
2712
- # counts completed *refinements* - e.g. the 2nd refinement (Palace's
2713
- # "iteration 3") reads "2/2" against a MaxIts=2 config, not "3/2". Not
2714
- # clamped to amr_max: MaxIts caps refinement actions, not solve passes, so
2715
- # the last legitimate pass is Palace's "iteration MaxIts+1" (displayed
2716
- # "MaxIts") - showing whatever Palace actually reports is more honest than
2717
- # silently capping it.
2718
- self._status_amr_cur = int(m.group(1)) - 1
2726
+ if self._status_amr_max:
2727
+ m = self._RE_AMR_DONE.search(line)
2728
+ if m:
2729
+ self._status_amr_cur = int(m.group(1))
2730
+ else:
2731
+ m = self._RE_AMR_ITER.search(line) or self._RE_AMR_PROCEEDING.search(line)
2732
+ if m:
2733
+ # Not clamped to MaxIts: showing what Palace reports is more honest.
2734
+ self._status_amr_cur = int(m.group(1)) - 1
2735
+ if m:
2719
2736
  self._update_status_line()
2720
2737
  return
2721
2738
 
2739
+ def _set_port_from_excitation_index(self, index):
2740
+ """Port k/N from a log line that only names the excitation index (Palace 0.19)"""
2741
+ if index in self._status_excitations:
2742
+ self._status_port_cur, self._status_port_total = self._status_excitations[index]
2743
+ else:
2744
+ self._status_port_cur, self._status_port_total = index, "?"
2745
+
2722
2746
  def _report_nonconvergence(self, iterations):
2723
2747
  """Flag an unconverged Palace linear solve right away in the log, and remember
2724
2748
  it for the end-of-run summary (_nonconvergence_summary(), from on_finished()).
@@ -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()