Metadata-Version: 2.4
Name: setupEM
Version: 0.11.1.post1
Summary: Python tool for configuration of gds2palace workflow with GUI.
Author-email: Volker Muehlhaus <volker@muehlhaus.com>
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://github.com/VolkerMuehlhaus/setupEM
Project-URL: Repository, https://github.com/VolkerMuehlhaus/setupEM
Project-URL: Changelog, https://github.com/VolkerMuehlhaus/setupEM/blob/main/doc/CHANGES.md
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: gds2palace>=0.8.0
Requires-Dist: gds_prepare_for_EM>=1.3.0
Requires-Dist: PySide6
Requires-Dist: shiboken6
Requires-Dist: scipy
Requires-Dist: requests
Requires-Dist: scikit-rf
Requires-Dist: matplotlib
Requires-Dist: numpy
Requires-Dist: gdspy
Requires-Dist: meshio
Requires-Dist: pyvista
Requires-Dist: pyvistaqt
Dynamic: license-file

# Python GUI for gds2palace 

![Intro](https://raw.githubusercontent.com/VolkerMuehlhaus/setupEM/main/doc/png/setupEM_banner.png)

## Install

    pip install setupEM

**Full documentation, installation guide, and usage walkthrough:**
https://github.com/VolkerMuehlhaus/setupEM

## Recent changes

# What's New - October 5, 2026

**Import Model** (*.py) with several GDS purposes (datatypes), e.g. `settings['purpose'] = [0, 35, 4]`, now works: the purpose field shows "0, 35, 4" and the model uses all three. Before, the field showed "(0, 35, 4)" and no datatype matched, so the layout preview and the model had no polygons on any layer. Models with a single purpose were not affected. A single number in the script (`settings['purpose'] = 0`) is now also read as `[0]`.

# What's New - October 2, 2026

**3D Field Viewer:** with **Log color scale**, a **Range** dropdown (-10, -20 ... -70 dB below Max) replaces the Min field; the default is -70 dB. dB means 20·log10 for E and B fields and 10·log10 for power-like arrays such as S or the energy densities. Switching to another result file or cycle now keeps the selected field (if the new data has it; a field you picked comes back as soon as it is available again) and keeps the camera view, zoom and clip position if the new mesh has the same bounding box, e.g. another AMR iteration or the matching "boundary" file. Only a file with different bounds resets the view.

**Tools > Simplify GDS...** has a new step **Merge via arrays** (default off), with a merge distance (default: the via array merge distance from Preferences). Vias closer than this distance are merged into one shape, but only if they connect the same metal shapes above and below, so merging never shorts different metal shapes. The via layers and the metal layers above and below them come from the loaded XML stackup. Vias without metal above or below are kept unchanged. Merged vias in the file are treated as solid metal in the model: fill factor correction needs the original vias, which are then no longer in the file. For accurate via resistance, merge vias in the model instead (via array merge distance > 0 with fill factor correction). gds2palace prints a note when fill factor correction is on and the vias in the file seem to be merged already. Requires gds_prepare_for_EM v1.3.0 or later.

The via array merging of the models themselves (gds2palace `merge_polygon_size`) no longer shorts different metal shapes either, with gds2palace v0.8.1 or later.

# What's New - September 30, 2026

The **Adaptive mesh refinement (AMR)** group on the Mesh and Boundaries tab is now called **Solver & Adaptive Mesh Refinement (AMR)** and has a new Palace linear solver setting, shown with **Show advanced configuration** = **Yes**. 

**Complex coarse solve** (default **Yes** for every model, set in **Preferences > Palace**) lets Palace's direct coarse solver factorize the full complex system instead of only its real part. With **No** (Palace's own default), some models don't converge at some frequencies and get wrong S-parameters there: a D-band line failed at 170 GHz, and an inductor failed at 2.4 GHz with 1.1 nH instead of 2.5 nH, while it converged at 0.1 and 10 GHz. With **Yes** both converged in 1-31 iterations and ran 3.5-6x faster. Models that already converge give identical results in about the same or less time. The cost is peak RAM, depending on the model 1.0-1.6x at order 2 and 1.5-1.9x at order 1; the AMR RAM estimate includes this. 

**Maximum solver iterations** (400) and **Solver tolerance** (1e-6) can now be changed too, in **Preferences > Palace**. These settings require gds2palace v0.8.0 or later and are hidden with an older version. setupEM module installation now requires gds2palace v0.8.0 or later, which also restores the dielectric loss tangent in Palace models that had been deleted by mistake.

**Conformal AMR (experimental)** is a new advanced setting in the **Solver & Adaptive Mesh Refinement (AMR)** group (default **No**, set in **Preferences > Palace**). With AMR iterations > 0, it switches Palace from its default nonconformal (hanging-node) mesh refinement to conformal refinement (gds2palace `settings['adaptive_mesh_conformal']`). In the test cases so far it converged in fewer AMR iterations (D-band balun: 2 iterations instead of 4, in half the time), but the mesh cell count grows faster per iteration.

setupEM now warns when Palace's linear solver does **not converge**: Palace carries on and writes S-parameters for that frequency anyway, but they are unreliable. Each case gets a ⚠ warning in the Log panel with its frequency, and all of them are listed again at the end of the run.

Full history: [CHANGES.md](https://github.com/VolkerMuehlhaus/setupEM/blob/main/doc/CHANGES.md)

---

**Note:** the `setupEM` PyPI package itself requires:

- gds2palace>=0.8.0
- gds_prepare_for_EM>=1.3.0
- PySide6
- shiboken6
- scipy
- requests
- scikit-rf
- matplotlib
- numpy
- gdspy
- meshio
- pyvista
- pyvistaqt

(Other Python modules mentioned above are only needed to run standalone helper scripts in this repository, not to use the installed package.)
