snp2le 0.1.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.
- snp2le-0.1.1/LICENSE +201 -0
- snp2le-0.1.1/MANIFEST.in +3 -0
- snp2le-0.1.1/PKG-INFO +284 -0
- snp2le-0.1.1/README.md +250 -0
- snp2le-0.1.1/pyproject.toml +58 -0
- snp2le-0.1.1/setup.cfg +4 -0
- snp2le-0.1.1/snp2le/__init__.py +7 -0
- snp2le-0.1.1/snp2le/__main__.py +47 -0
- snp2le-0.1.1/snp2le/app.py +70 -0
- snp2le-0.1.1/snp2le/cli.py +459 -0
- snp2le-0.1.1/snp2le/core/__init__.py +1 -0
- snp2le-0.1.1/snp2le/core/dc.py +123 -0
- snp2le-0.1.1/snp2le/core/engine.py +110 -0
- snp2le-0.1.1/snp2le/core/io.py +121 -0
- snp2le-0.1.1/snp2le/core/ir.py +57 -0
- snp2le-0.1.1/snp2le/core/mna.py +127 -0
- snp2le-0.1.1/snp2le/core/netlist.py +298 -0
- snp2le-0.1.1/snp2le/core/state.py +58 -0
- snp2le-0.1.1/snp2le/core/structures/__init__.py +22 -0
- snp2le-0.1.1/snp2le/core/structures/balun.py +187 -0
- snp2le-0.1.1/snp2le/core/structures/base.py +87 -0
- snp2le-0.1.1/snp2le/core/structures/branchline.py +181 -0
- snp2le-0.1.1/snp2le/core/structures/inductor_pi.py +209 -0
- snp2le-0.1.1/snp2le/core/structures/mim_cap.py +155 -0
- snp2le-0.1.1/snp2le/core/structures/tline.py +178 -0
- snp2le-0.1.1/snp2le/core/structures/wilkinson.py +246 -0
- snp2le-0.1.1/snp2le/core/units.py +95 -0
- snp2le-0.1.1/snp2le/core/universal.py +196 -0
- snp2le-0.1.1/snp2le/core/xschem.py +166 -0
- snp2le-0.1.1/snp2le/examples/balun_ihp-sg13cmos5l.s4p +21 -0
- snp2le-0.1.1/snp2le/examples/blc_ihp-sg13g2.s4p +82 -0
- snp2le-0.1.1/snp2le/examples/bpf_ihp-sg13g2.s2p +82 -0
- snp2le-0.1.1/snp2le/examples/ind_500pH_ihp-sg13cmos5l.s2p +103 -0
- snp2le-0.1.1/snp2le/examples/ind_d20_w7_sp3_nw1_r10_ihp-sg13g2.s2p +2029 -0
- snp2le-0.1.1/snp2le/examples/mim_cap_170fF_ihp-sg13g2.s2p +1202 -0
- snp2le-0.1.1/snp2le/examples/mom_cap_74fF_02_ihp-sg13cmos5l.s2p +13 -0
- snp2le-0.1.1/snp2le/examples/tline_100um_ihp-sg13g2.s2p +403 -0
- snp2le-0.1.1/snp2le/examples/wpd_ihp-sg13g2.s3p +82 -0
- snp2le-0.1.1/snp2le/gui/__init__.py +1 -0
- snp2le-0.1.1/snp2le/gui/assets/iicqc.png +0 -0
- snp2le-0.1.1/snp2le/gui/assets/iicqc.svg +150 -0
- snp2le-0.1.1/snp2le/gui/assets/iicqc_official.svg +344 -0
- snp2le-0.1.1/snp2le/gui/assets/jku.png +0 -0
- snp2le-0.1.1/snp2le/gui/assets/jku.svg +77 -0
- snp2le-0.1.1/snp2le/gui/assets/snp2le.ico +0 -0
- snp2le-0.1.1/snp2le/gui/assets/snp2le_logo.svg +130 -0
- snp2le-0.1.1/snp2le/gui/assets/spin_down.svg +1 -0
- snp2le-0.1.1/snp2le/gui/assets/spin_up.svg +1 -0
- snp2le-0.1.1/snp2le/gui/combobox_style.py +70 -0
- snp2le-0.1.1/snp2le/gui/design_view.py +212 -0
- snp2le-0.1.1/snp2le/gui/footer.py +40 -0
- snp2le-0.1.1/snp2le/gui/help_dialog.py +182 -0
- snp2le-0.1.1/snp2le/gui/log_dialog.py +40 -0
- snp2le-0.1.1/snp2le/gui/logo.py +53 -0
- snp2le-0.1.1/snp2le/gui/main_window.py +763 -0
- snp2le-0.1.1/snp2le/gui/mpl_style.py +28 -0
- snp2le-0.1.1/snp2le/gui/plot_view.py +666 -0
- snp2le-0.1.1/snp2le/gui/schematic_widget.py +68 -0
- snp2le-0.1.1/snp2le/gui/style.py +125 -0
- snp2le-0.1.1/snp2le/gui/top_bar.py +455 -0
- snp2le-0.1.1/snp2le/gui/widgets.py +110 -0
- snp2le-0.1.1/snp2le.egg-info/PKG-INFO +284 -0
- snp2le-0.1.1/snp2le.egg-info/SOURCES.txt +66 -0
- snp2le-0.1.1/snp2le.egg-info/dependency_links.txt +1 -0
- snp2le-0.1.1/snp2le.egg-info/entry_points.txt +2 -0
- snp2le-0.1.1/snp2le.egg-info/requires.txt +11 -0
- snp2le-0.1.1/snp2le.egg-info/top_level.txt +1 -0
- snp2le-0.1.1/tests/test_core.py +339 -0
snp2le-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Simon Dorrer
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
snp2le-0.1.1/MANIFEST.in
ADDED
snp2le-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: snp2le
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Convert Touchstone S-parameter files into lumped-element netlists for Ngspice and VACASK
|
|
5
|
+
Author-email: Simon Dorrer <simon.dorrer@jku.at>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/iic-jku/snp2le
|
|
8
|
+
Project-URL: Repository, https://github.com/iic-jku/snp2le
|
|
9
|
+
Project-URL: Issues, https://github.com/iic-jku/snp2le/issues
|
|
10
|
+
Keywords: EDA,S-parameters,Touchstone,SPICE,ngspice,VACASK,vector-fitting,macromodel,RF,microwave
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: X11 Applications :: Qt
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: PySide6>=6.6
|
|
24
|
+
Requires-Dist: scikit-rf>=1.0
|
|
25
|
+
Requires-Dist: numpy>=1.24
|
|
26
|
+
Requires-Dist: scipy>=1.10
|
|
27
|
+
Requires-Dist: matplotlib>=3.7
|
|
28
|
+
Requires-Dist: schemdraw>=0.18
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest; extra == "dev"
|
|
31
|
+
Requires-Dist: build; extra == "dev"
|
|
32
|
+
Requires-Dist: twine; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
<img src="https://raw.githubusercontent.com/iic-jku/snp2le/main/snp2le/gui/assets/snp2le_logo.svg" alt="snp2le logo" width="140">
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
# snp2le: S-Parameter To Lumped Element Netlist Converter
|
|
40
|
+
|
|
41
|
+
[](https://github.com/iic-jku/snp2le/blob/main/LICENSE)
|
|
42
|
+

|
|
43
|
+

|
|
44
|
+
|
|
45
|
+
(c) 2026 Simon Dorrer
|
|
46
|
+
|
|
47
|
+
Institute for Integrated Circuits and Quantum Computing (IICQC), Johannes Kepler University (JKU), Linz, Austria
|
|
48
|
+
|
|
49
|
+
> [!IMPORTANT]
|
|
50
|
+
> The converter (GUI and CLI) runs anywhere with **Python ≥ 3.10**, see [Install](https://github.com/iic-jku/snp2le#install) below.
|
|
51
|
+
> *Running* the exported netlists in a testbench additionally needs **Xschem** plus **Ngspice** and/or **VACASK**. The easiest way to get all of them is the [IIC-OSIC-TOOLS](https://github.com/iic-jku/IIC-OSIC-TOOLS) container.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## Description
|
|
55
|
+
|
|
56
|
+
**snp2le** turns a Touchstone **`.sNp`** S-parameter file (for example from an [AWS Palace](https://awslabs.github.io/palace/) EM simulation) into an equivalent **lumped-element netlist** for **Ngspice** (Berkeley SPICE3) and **VACASK** (Spectre syntax). An EM-extracted structure can then be co-simulated at circuit level, without re-running the field solve.
|
|
57
|
+
|
|
58
|
+
It offers two conversion philosophies:
|
|
59
|
+
|
|
60
|
+
- **Universal (any N-port).** Vector-fits the S-parameters with [scikit-rf](https://scikit-rf.org) `VectorFitting`, optionally enforces passivity, and synthesises a passive macromodel of R, C and controlled sources. It works for any structure and port count, and is electrically exact but not physically interpretable.
|
|
61
|
+
- **Structure-specific.** Fits a known physical topology, so every component maps to reality (series L, shunt C, coupling k, and so on) at a chosen **extraction frequency**. See [Available structures](https://github.com/iic-jku/snp2le#available-structures).
|
|
62
|
+
|
|
63
|
+
A single dialect-agnostic **Circuit IR** drives both netlist backends and the on-screen schematic, so the outputs always agree. The code is split into a pure-Python, Qt-free `snp2le.core` (fully unit-tested) and a thin PySide6 `snp2le.gui`, both driven by one entry point, `engine.convert(state, net)`.
|
|
64
|
+
|
|
65
|
+
<p align="center">
|
|
66
|
+
<a href="https://raw.githubusercontent.com/iic-jku/snp2le/main/doc/fig/snp2le_gui_bpf.png"><img src="https://raw.githubusercontent.com/iic-jku/snp2le/main/doc/fig/snp2le_gui_bpf.png" alt="snp2le GUI, band-pass filter" width="85%"></a><br>
|
|
67
|
+
<em>The snp2le GUI converting a band-pass filter (BPF) S-parameter file into a lumped-element netlist.</em>
|
|
68
|
+
</p>
|
|
69
|
+
|
|
70
|
+
<p align="center">
|
|
71
|
+
<a href="https://raw.githubusercontent.com/iic-jku/snp2le/main/doc/fig/snp2le_plots_bpf.png"><img src="https://raw.githubusercontent.com/iic-jku/snp2le/main/doc/fig/snp2le_plots_bpf.png" alt="snp2le plots, data vs model vs simulation" width="85%"></a><br>
|
|
72
|
+
<em>Plot view: loaded data (grey) vs extracted model (blue) vs imported testbench simulation (red).</em>
|
|
73
|
+
</p>
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
## Directory Structure
|
|
77
|
+
|
|
78
|
+
- 📄 **pyproject.toml** packaging metadata, dependencies and the `snp2le` entry point
|
|
79
|
+
- 📄 **MANIFEST.in** source-distribution manifest (bundles the examples and assets)
|
|
80
|
+
- 📄 **requirements.txt** runtime dependencies (mirrors `pyproject.toml`)
|
|
81
|
+
- 📁 **snp2le/** the application package (pip-installable)
|
|
82
|
+
- 📄 `__init__.py` package version
|
|
83
|
+
- 📄 `__main__.py` single entry point (`snp2le` opens the GUI, `snp2le -b` runs the CLI)
|
|
84
|
+
- 📄 `app.py` GUI launcher
|
|
85
|
+
- 📄 `cli.py` command-line interface
|
|
86
|
+
- 📁 **core/** pure Python, Qt-free, all the maths
|
|
87
|
+
- 📄 `engine.py` `convert(state, net)` returns `Results`, the single entry point
|
|
88
|
+
- 📄 `io.py` load Touchstone (scikit-rf), parse Ngspice result tables
|
|
89
|
+
- 📄 `units.py` engineering-notation parse and format
|
|
90
|
+
- 📄 `ir.py` dialect-agnostic Circuit IR (element list and couplings)
|
|
91
|
+
- 📄 `netlist.py` render the IR to Ngspice (SPICE3) and VACASK (Spectre)
|
|
92
|
+
- 📄 `universal.py` vector-fit passive macromodel
|
|
93
|
+
- 📄 `mna.py` rebuild N-port S-parameters from an RLC IR (model overlay)
|
|
94
|
+
- 📄 `dc.py` DC operating-point (singularity) check for the macromodel
|
|
95
|
+
- 📄 `state.py` `ConverterState` and `Results` dataclasses
|
|
96
|
+
- 📄 `xschem.py` headless Xschem netlist and simulate commands
|
|
97
|
+
- 📁 **structures/** physical extractors, one file per topology
|
|
98
|
+
- 📄 `base.py`, `inductor_pi.py`, `mim_cap.py`, `tline.py`
|
|
99
|
+
- 📄 `wilkinson.py`, `balun.py`, `branchline.py`
|
|
100
|
+
- 📄 `__init__.py` registry (the GUI dropdown and CLI auto-discover it)
|
|
101
|
+
- 📁 **gui/** PySide6, no maths
|
|
102
|
+
- 📄 `main_window.py` the controller
|
|
103
|
+
- 📄 `top_bar.py` load, mode, structure, options, simulator, run
|
|
104
|
+
- 📄 `design_view.py` result, element values, tolerances, schematic, netlist
|
|
105
|
+
- 📄 `plot_view.py` four S-parameter or extracted-parameter plots
|
|
106
|
+
- 📄 `help_dialog.py`, `style.py`, `widgets.py`, and more
|
|
107
|
+
- 📁 **assets/** logos (svg and png), `snp2le.ico`
|
|
108
|
+
- 📁 **examples/** Touchstone `.sNp` sample files (BPF, inductor, balun, BLC, WPD, and more)
|
|
109
|
+
- 📁 **tests/** pytest suite (`test_core.py`)
|
|
110
|
+
- 📁 **doc/** `architecture.md` and screenshots (in `fig/`)
|
|
111
|
+
- 📁 **testbenches/xschem/** BPF testbenches (Ngspice and VACASK) plus postprocess eval scripts
|
|
112
|
+
- 📁 **netlist/** exported lumped-element netlists
|
|
113
|
+
- 📁 **spice/** Ngspice (`.spice`)
|
|
114
|
+
- 📁 **spectre/** VACASK (`.inc`) plus `syntax_cheatsheet.inc`
|
|
115
|
+
- 📁 **schematic/xschem/** DUT symbol (`bpf_le.sym`) and `xschemrc`
|
|
116
|
+
- 📁 **sim_data/** simulation results, imported and overlaid on the plots
|
|
117
|
+
- 📄 **README.md**, 📄 **LICENSE** (Apache-2.0), 📄 **CITATION.cff**
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
## How to Use
|
|
121
|
+
|
|
122
|
+
### Install
|
|
123
|
+
|
|
124
|
+
From PyPI:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
pip install snp2le
|
|
128
|
+
# or, for an isolated install with its own command on PATH:
|
|
129
|
+
pipx install snp2le
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
From source (for development), an editable install pulls in every dependency:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
git clone https://github.com/iic-jku/snp2le.git
|
|
136
|
+
cd snp2le
|
|
137
|
+
|
|
138
|
+
python -m venv .venv
|
|
139
|
+
# Windows: .venv\Scripts\activate
|
|
140
|
+
# macOS / Linux: source .venv/bin/activate
|
|
141
|
+
|
|
142
|
+
pip install -e .
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Run the GUI
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
snp2le # after installing (pip / pipx)
|
|
149
|
+
python -m snp2le # from the repo root of a source checkout, no install needed
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
A bundled example is preloaded on first run. More live in `snp2le/examples/`.
|
|
153
|
+
|
|
154
|
+
> [!NOTE]
|
|
155
|
+
> Start it as a module (`python -m snp2le`), not `python snp2le/app.py`. The launcher
|
|
156
|
+
> imports the `snp2le` package, which Python only finds when it is run as a module from
|
|
157
|
+
> the repo root (or after `pip install`).
|
|
158
|
+
|
|
159
|
+
### Typical workflow
|
|
160
|
+
|
|
161
|
+
1. **Load** a Touchstone `.sNp` file from the top bar. The header shows the port count and frequency range.
|
|
162
|
+
2. **Choose a mode.** Universal (set *Max order* and *Enforce passivity*) or Structure-specific (pick a structure and set the *extraction frequency*). Some structures expose an extra option such as *Stages*, *Isolation R* or *Resistive loss*.
|
|
163
|
+
3. **Inspect** the result, element values, per-element **tolerances** at the extraction frequency, the drawn schematic, and the generated netlist in the **Design & Schematic** view.
|
|
164
|
+
4. **Compare** the loaded data (grey) against the extracted model (blue) in the **Plot** view (up to four traces, magnitude and phase).
|
|
165
|
+
5. **Export** the netlist. *Export Ngspice* writes a `.spice` file and *Export VACASK* writes an `.inc` file. The `.SUBCKT` is named after the file, so a testbench that instantiates it resolves the include.
|
|
166
|
+
|
|
167
|
+
> [!TIP]
|
|
168
|
+
> The **Help** button in the top bar opens a full in-app guide to every control.
|
|
169
|
+
|
|
170
|
+
### Run a testbench (simulate)
|
|
171
|
+
|
|
172
|
+
Drop the exported subcircuit into an Xschem testbench, then run it from the GUI:
|
|
173
|
+
|
|
174
|
+
1. **Load .sch.** Pick the testbench. The **Simulator** auto-selects from the file name (a name ending in `_ngspice.sch` selects Ngspice or `_vacask.sch` selects VACASK) and can be overridden.
|
|
175
|
+
2. **Run Simulation.** Both simulators netlist and simulate through Xschem and write their result to `sim_data/`, which is imported and overlaid on the plots automatically. The button turns green on success or red on failure. On failure the dialog shows the simulator log.
|
|
176
|
+
3. **Show output.** Tick it to show the simulator's console and plot windows. Leave it unticked to run quietly. The result is imported either way.
|
|
177
|
+
|
|
178
|
+
> [!NOTE]
|
|
179
|
+
> A simulator (Xschem plus Ngspice and/or VACASK) is only needed for this step. The conversion and export themselves are pure Python.
|
|
180
|
+
|
|
181
|
+
### Run the tests
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
pytest # from the repo root
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
## CLI Overview
|
|
189
|
+
|
|
190
|
+
The same engine is available headlessly for Makefiles and batch use, through the `-b` (batch) flag:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
snp2le -b list-structures
|
|
194
|
+
snp2le -b convert <file.sNp> [options]
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
From a source checkout without installing, use `python -m snp2le -b ...` in place of `snp2le -b`.
|
|
198
|
+
|
|
199
|
+
### `convert` options
|
|
200
|
+
|
|
201
|
+
| Option | Scope | Description |
|
|
202
|
+
| --- | --- | --- |
|
|
203
|
+
| `inputs` | all | one or more `.sNp` files or globs |
|
|
204
|
+
| `--mode universal\|structure` | both | conversion philosophy (default `universal`) |
|
|
205
|
+
| `--structure KEY` | structure | structure key (see `list-structures`) |
|
|
206
|
+
| `--order N` | universal | maximum model order (poles) |
|
|
207
|
+
| `--passive` / `--no-passive` | universal | enforce passivity (default on) |
|
|
208
|
+
| `--fext FREQ` | structure | extraction frequency, e.g. `7GHz` |
|
|
209
|
+
| `--stages N` | structure | RLGC ladder cells (transmission line) |
|
|
210
|
+
| `--iso-r` / `--no-iso-r` | structure | Wilkinson isolation R or branch-line arm loss |
|
|
211
|
+
| `--format ngspice\|vacask\|both` | both | output dialect(s). VACASK writes `.inc` |
|
|
212
|
+
| `-o, --output PATH` | both | output path (single input), names the `.SUBCKT` |
|
|
213
|
+
| `--values` | structure | print the extracted element values |
|
|
214
|
+
| `--tolerances` | structure | print per-element tolerances at `f_ext` |
|
|
215
|
+
| `--simulate SCH` | sim | run an Xschem testbench after converting |
|
|
216
|
+
| `--simulator ngspice\|vacask` | sim | simulator for `--simulate` (default: auto from `.sch` name) |
|
|
217
|
+
| `--show-output` | sim | show the simulator's console and plot windows |
|
|
218
|
+
| `--timeout S` | sim | seconds to wait for a `--simulate` result (default 180) |
|
|
219
|
+
| `--plot [SPARAMS]` | sim | display data, model and sim plots (e.g. `S11,S21`) |
|
|
220
|
+
| `--quiet` | both | suppress the per-file status line |
|
|
221
|
+
|
|
222
|
+
### Examples
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
# universal macromodel to an Ngspice netlist
|
|
226
|
+
snp2le -b convert coupler.s4p --mode universal --order 12 -o coupler.spice
|
|
227
|
+
|
|
228
|
+
# structure extraction at 7 GHz, both dialects, print values and tolerances
|
|
229
|
+
snp2le -b convert ind.s2p --mode structure --structure inductor-pi \
|
|
230
|
+
--fext 7GHz --format both --values --tolerances
|
|
231
|
+
|
|
232
|
+
# convert the BPF, run its Xschem testbench, and show data vs model vs sim plots
|
|
233
|
+
snp2le -b convert snp2le/examples/bpf_ihp-sg13g2.s2p \
|
|
234
|
+
--mode universal --order 13 -o netlist/spice/bpf_le.spice \
|
|
235
|
+
--simulate testbenches/xschem/bpf_le_tb_acsp_ngspice.sch --plot
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
> [!NOTE]
|
|
239
|
+
> `--simulate` and `--plot` need Xschem (and a display for `--plot`). They print a clear message and skip if Xschem is not on `PATH`.
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
## Available structures
|
|
243
|
+
|
|
244
|
+
| Key | Model | Ports | Notes |
|
|
245
|
+
| --- | --- | --- | --- |
|
|
246
|
+
| `inductor-pi` | Inductor | 2 | series R-L plus shunt C/R per port |
|
|
247
|
+
| `mim-cap` | MIM capacitor | 2 | series C with parasitic L/R plus shunt C (use it for MOM caps too) |
|
|
248
|
+
| `tline-rlgc` | Transmission line (RLGC) | 2 | N-cell pi-ladder (`--stages`) |
|
|
249
|
+
| `wilkinson-inphase` | Wilkinson divider (in-phase) | 3 | optional isolation resistor (`--iso-r`) |
|
|
250
|
+
| `wilkinson` | Wilkinson divider (quadrature) | 3 | quadrature (90 deg) outputs |
|
|
251
|
+
| `balun` | Balun (transformer) | 4 | coupled inductors (k, M, n), Qp and Qs |
|
|
252
|
+
| `branchline` | Branch-line coupler | 4 | optional fitted arm loss (`--iso-r`) |
|
|
253
|
+
|
|
254
|
+
New structures plug in by subclassing `snp2le.core.structures.base.Structure` and registering them in `snp2le/core/structures/__init__.py`. They then appear in the GUI dropdown and the CLI automatically.
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
## Cite This Work
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
@misc{2026_snp2le,
|
|
261
|
+
author = {Dorrer, Simon},
|
|
262
|
+
month = july,
|
|
263
|
+
year = {2026},
|
|
264
|
+
title = {{GitHub Repository for snp2le: A S-Parameter To Lumped Element Netlist Converter}},
|
|
265
|
+
url = {https://github.com/iic-jku/snp2le},
|
|
266
|
+
doi = {ToDo}
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
## Acknowledgements
|
|
272
|
+
|
|
273
|
+
- The structure-specific extractors (inductor, MIM capacitor, RLGC line) were inspired by Volker Mühlhaus' [lumpedmodel](https://github.com/VolkerMuehlhaus/lumpedmodel).
|
|
274
|
+
- The passivity-enforcement strategy for the universal macromodel was adapted from the [COBRA project](https://github.com/DI-PASSIONATE/COBRA).
|
|
275
|
+
- Vector fitting is provided by [scikit-rf](https://scikit-rf.org).
|
|
276
|
+
|
|
277
|
+
<p align="center">
|
|
278
|
+
<img src="https://raw.githubusercontent.com/iic-jku/snp2le/main/snp2le/gui/assets/iicqc_official.svg" alt="Institute for Integrated Circuits and Quantum Computing" height="100">
|
|
279
|
+
</p>
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
## License
|
|
283
|
+
|
|
284
|
+
Licensed under the **Apache License 2.0**, see [`LICENSE`](https://github.com/iic-jku/snp2le/blob/main/LICENSE).
|