HFSS 工作流需 Ansys 许可,且经典 COM 后端基本只能在 Windows 上使用;用 gRPC 后端要额外安装 pyaedt 可选依赖;HFSS 中每个约瑟夫森结需手动建矩形 Lumped RLC 边界和折线,参数扫描还需开启 Save Fields。
pyEPR
zlatko-minev活跃维护用能量参与比方法自动分析和设计量子微波芯片与器件,把超导量子电路的设计流程从手工仿真变成脚本化计算。
Powerful, automated analysis and design of quantum microwave chips & devices [Energy-Participation Ratio and more]
pip install pyEPR-quantum
pip install "pyEPR-quantum[pyaedt]"README 未说明显存或 GPU 要求;纯数值对角化可在普通 CPU 上运行,HFSS 仿真部分需本机或远程 Windows 上的 Ansys HFSS 及相应许可。
用能量参与比方法把 HFSS 电磁仿真结果自动转成量子比特哈密顿量,省去手工推导
用能量参与比方法自动分析和设计量子微波芯片与器件,把超导量子电路的设计流程从手工仿真变成脚本化计算。
核心能力
- 从 HFSS 本征模仿真提取能量参与比 p_mj 与零点相位涨落
- 数值对角化哈密顿量,输出缀饰频率、非谐性与色散位移矩阵 χ
- 支持任意模式数与结数,可处理通量子等强非谐电路
- 提供纯数值工作流,无需 HFSS 许可即可算 transmon 非谐性
- 新增基于 PyAEDT 的 gRPC 后端,可在 Linux 和 macOS 上连接 AEDT
容易踩的坑
- 1.0.2最新正式版2026-09-28 · 2026-09-28 01:26 UTC
NumPy 2 and pandas 3 compatibility fixes.
Bug fixes
- NumPy 2:
print_matrix,df_interpolate_valueanddf_find_indexraisedAttributeError. They usednp.matandnp.NaN, which NumPy 2.0 removed.print_matrixruns at the end of everyQuantumAnalysis.analyze_variation()withprint_result=True, the default, so a default EPR analysis stopped at its report under NumPy 2.print_matrixnow uses a 2-D array (notnumpy.matrix, which NumPy is deprecating) and the other two usenp.nan; both work with NumPy 1.x too. A new test (tests/test_numpy2_compat.py) runs the three helpers and fails if any removed NumPy name appears in the package source. - pandas 3: reading a Q3D matrix export raised
TypeError.AnsysQ3DSetup.load_q3d_matrix(through_readin_Q3D_matrix) calledpd.read_csv(delim_whitespace=True), deprecated in pandas 2.2 and removed in 3.0. It now usessep=r"\s+", the same parsing. Tested on the sample export from the docstring (tests/test_q3d_matrix_reader.py), with pandas 2.3 and 3.0. df_find_indexcompared the target with the index, not the values. It finds the index (e.g. Lj) that gives a target value (e.g. a frequency), but chose between interpolating and extrapolating by checking the target against the index range, so a target inside the value range could be extrapolated (with a degree-2 fit through the points) instead of interpolated.
Documentation
- The docs build with 0 warnings:
conf.pyassignedexclude_patternsa second time (empty), which discarded the first; README notes beside the tutorial notebooks are now excluded.
Full changelog: https://github.com/zlatko-minev/pyEPR/blob/master/CHANGELOG.md
- NumPy 2:
- 1.0.12026-07-17 · 2026-07-17 18:24 UTC
查看更新说明
What's Changed
- fix: replace ureg(variation) with _variation_index() in DistributedAnalysis by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/210
- test: add coverage tests for calcs.quantum, basic, transmon, convert by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/211
- Release 1.0.1: variation-indexing bugfix by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/212
Full Changelog: https://github.com/zlatko-minev/pyEPR/compare/1.0.0...1.0.1
- 1.0.0PyEPR v1!2026-06-27 · 2026-06-27 16:38 UTC
查看更新说明
What's new in 1.0.0
First major release — marking a decade of use in quantum hardware labs and the first release with cross-platform HFSS access.
New features
-
PyAEDT / gRPC backend (
pyEPR.ansys_pyaedt.PyaedtDistributedAnalysis) — runs the full EPR field extraction through Ansys's official PyAEDT library entirely over gRPC. No COM, nopywin32. Works on Linux, macOS, and Windows. Contributed by Joey Yaker. Validated digit-for-digit against the COM path (p_mj = 0.9755,pyaedt 1.1.0+ AEDT 2026.1). Install:pip install "pyEPR-quantum[pyaedt]" -
Tutorial 7 — end-to-end PyAEDT workflow notebook.
-
Docs — new
pyaedt_backendpage, updated landing page and README featuring both backends.
No breaking changes
All existing COM workflows (
DistributedAnalysis,QuantumAnalysis,ProjectInfo) and deprecated aliases are unchanged. The[pyaedt]extra is strictly optional —import pyEPRnever requires it.Upgrading from 0.9.x
Drop-in. No call-site changes needed. Optionally install the gRPC backend with
pip install "pyEPR-quantum[pyaedt]"What's Changed
- docs(agent): expand CLAUDE.md and add /health-check slash command by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/205
- Add optional PyAEDT (gRPC) backend for HFSS field extraction by @joeyyaker in https://github.com/zlatko-minev/pyEPR/pull/207
- docs: update for PyAEDT (gRPC) backend by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/208
- bump version to 1.0.0 by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/209
New Contributors
- @joeyyaker made their first contribution in https://github.com/zlatko-minev/pyEPR/pull/207
Full Changelog: https://github.com/zlatko-minev/pyEPR/compare/0.9.6...1.0.0
-
- 0.9.6pyEPR v0.9.6 — Documentation & CI overhaul2026-05-17 · 2026-05-17 13:57 UTC
查看更新说明
pyEPR v0.9.6 — Documentation & CI overhaul
Documentation
- New theme — migrated from
sphinx-rtd-themeto PyData Sphinx Theme (same theme as NumPy, SciPy, pandas, QuTiP). Landing page now has a feature-card hero, install tabs, and a five-line quickstart. - sphinx-design components — hero image, three feature cards (Simulate / Extract / Diagonalize), pip/conda/uv install tabs, and HFSS-required / no-HFSS-required badges throughout.
- myst-nb replaces nbsphinx for rendering tutorial notebooks (pre-executed outputs, no kernel needed).
- Tutorials page — all six tutorial notebooks shown in order (1–6) as clickable cards with consistent titles. Tutorials 3, 5, 6 marked No HFSS required; 1, 2, 4 marked Ansys HFSS required.
- Zero-warning Sphinx build — down from 177 warnings. Fixed header levels, duplicate object descriptions, dead substitution references, broken code-block directives, and RST markup errors across
ansys.py,calcs/,toolbox/, andcore_*.py. - About page — replaced dead badge image URLs (frapsoft.com, rawgit.com) with sphinx-design inline badges.
- Key Classes reference — slimmed to narrative-only with cross-reference links; moved up in TOC as onboarding material.
- README — absolute
raw.githubusercontent.comimage URLs so the hero image and xmon GIF render correctly on PyPI.
CI / Build
- RTD pre-build step —
_tutorial_notebooks/is copied intodocs/source/before Sphinx runs (Sphinx does not follow symlinks outside the source root). - CI
test_docsjob — same notebook copy step added so the docs build is consistent between RTD and GitHub Actions. - CI matrix — Python 3.10 + 3.12 on Ubuntu and macOS (dropped Python 3.9).
- pandoc added as an RTD apt package (required by myst-nb for some notebook outputs).
Dependencies
- Added:
pydata-sphinx-theme,sphinx-design,myst-nb - Removed:
sphinx-rtd-theme,sphinx-tabs,nbsphinx
What's Changed
- 0.9.5 post-merge: CI matrix, README overhaul, docs title, unit fix, nbsphinx tutorials by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/197
- fix: add pandoc to RTD build so tutorial notebooks render on docs site by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/198
- docs + ci: PyData theme, cards landing page, notebook gallery, CI matrix, image fixes by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/199
- docs: fix all RTD build warnings/errors (tabs, symlink, duplicates, docstrings) by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/200
- docs: eliminate remaining 15 RTD warnings → 0 warnings by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/201
- docs+ci: fix notebook toctree warnings in CI and RTD by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/202
- docs: fix About page badges; slim Key Classes page; reorder TOC by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/203
- bump version to 0.9.6 by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/204
Full Changelog: https://github.com/zlatko-minev/pyEPR/compare/0.9.5...0.9.6
- New theme — migrated from
- 0.9.5pyEPR 0.9.5 — Exact cosine diagonalization, generic junction potential, documentation refresh2026-05-17 · 2026-05-17 04:15 UTC
查看更新说明
What's new in 0.9.5
New features
Exact cosine diagonalization (
use_full_cos=True) For strongly anharmonic circuits such as fluxonium (φ_zpf ≳ 1) the truncated Taylor series diverges. Passuse_full_cos=Truetoepr_numerical_diagonalizationoranalyze_variationto evaluate cos(φ) − 1 + φ²/2 exactly via matrix exponential. SeeMatrixOps.cos_full_correctionand arXiv:2411.15039.Generic junction potential (
make_nonlinear_potential) Convert any scalar Python function V(φ) — flux-biased junctions, asymmetric SQUIDs, exotic elements — into the EPR-compatible operator-valued correction, automatically expanding around the bias minimum.from pyEPR.calcs import make_nonlinear_potential nl = make_nonlinear_potential(lambda phi: -np.cos(phi - phi_ext))Public Q3D convergence plot API pyEPR.reports.plot_q3d_convergence_main and plot_q3d_convergence_chi_f are now public documented functions. Old underscore names remain as aliases. Tutorial 5 — Generic junction potential and fluxonium EPR Tutorial 6 — EPR without HFSS — purely numerical workflow Improvements • Numeric sort for >9 variations (fixes “10” sorting before “2”) • Float sweep variable sort fixed for small floats (e.g. Lj = 1.4e-8) • DeprecationWarning on Project_Info, pyEPR_HFSSAnalysis, pyEPR_Analysis • Logger replaces print in DistributedAnalysis and QuantumAnalysis • NumPy-style docstrings on all major classes and functions • All 6 tutorials refreshed with EPR physics, derivations, and references Upgrading from 0.9.4 No breaking changes. All existing call signatures are unchanged. If you use Project_Info, pyEPR_HFSSAnalysis, or pyEPR_Analysis you will see a DeprecationWarning — update to ProjectInfo, DistributedAnalysis, QuantumAnalysis at your convenience. Full changelog See CHANGELOG.md.
What's Changed
- fix #140, #141: pandas FutureWarning and report line-width per-curve loop by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/189
- feat: context manager, junctions kwarg, get_variable_value shortcut; remove manual.yml by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/191
- fix+refactor: numerical sort for >9 variations, float sweep variables, print→logger cleanup by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/193
- feat: DeprecationWarning on Project_Info, pyEPR_HFSSAnalysis, pyEPR_Analysis aliases by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/194
- docs: NumPy-style docstrings and type hints for ProjectInfo, QuantumAnalysis, DistributedAnalysis by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/192
- feat: exact cosine diagonalization for strongly anharmonic circuits (use_full_cos=True) by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/195
- docs+feat: CHANGELOG, without-HFSS tutorial, public Q3D convergence API by @zlatko-minev in https://github.com/zlatko-minev/pyEPR/pull/196
Full Changelog: https://github.com/zlatko-minev/pyEPR/compare/0.9.4...0.9.5
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
pyEPR — Energy-Participation-Ratio Framework
Automated Python module for the design and quantization of Josephson quantum circuits
pyEPR bridges classical EM simulation and quantum circuit theory via the energy-participation ratio (EPR) method. Given a 3-D HFSS eigenmode simulation — or your own frequencies and inductances — it extracts the full quantum Hamiltonian in minutes:
- Simulate the linearized circuit in Ansys HFSS to get eigenmode frequencies and field distributions.
- Extract energy participation ratios $p_{mj}$ and zero-point phase fluctuations $\varphi_\mathrm{zpf}^{(mj)}$ for each junction and mode.
- Diagonalize $H = \sum_m \omega_m a_m^\dagger a_m - \sum_j E_J[\cos\hat\varphi_j - 1 + \hat\varphi_j^2/2]$ numerically to get dressed frequencies, anharmonicities, and the dispersive-shift matrix $\chi$.
Works for any number of modes and junctions. Handles strongly anharmonic circuits (fluxonium, $\varphi_\mathrm{zpf}\gtrsim 1$). No manual circuit diagram — only the 3-D geometry.
No HFSS licence? The Hamiltonian diagonalization (steps 2–3) works with any frequencies and inductances. Start with Tutorial 6 on Binder — runs in your browser, no install.
Install
pip install pyEPR-quantum
Requires Python 3.9–3.12. All dependencies (numpy, qutip, matplotlib, …) are installed automatically.
conda:
conda install -c conda-forge pyepr-quantum
development install:
git clone https://github.com/zlatko-minev/pyEPR.git && cd pyEPR
pip install -e ".[test]" && pytest
New in v0.9.6 — cross-platform gRPC backend (Linux · macOS · Windows)
pyEPR now ships a second HFSS transport that runs entirely over gRPC through
Ansys's official PyAEDT library — no COM, no
pywin32, and no Windows requirement.
| Classic COM backend | PyAEDT / gRPC backend | |
|---|---|---|
| Install | pip install pyEPR-quantum | pip install "pyEPR-quantum[pyaedt]" |
| Class | DistributedAnalysis | PyaedtDistributedAnalysis |
| Platform | Windows only | Linux · macOS · Windows |
| Transport | COM / pywin32 | gRPC (Ansys official API) |
| Session attach | new COM session | attaches to running AEDT via .aedt.lock |
from pyEPR.ansys_pyaedt import PyaedtDistributedAnalysis
eprd = PyaedtDistributedAnalysis(pinfo, aedt_version="2026.1")
eprd.do_EPR_analysis() # pure gRPC — no COM, works on Linux/macOS
f_ND, chi_ND = eprd.analyze()
The physics is identical — participations, eigenfrequencies, and the full
diagonalization feed pyEPR's own QuantumAnalysis unchanged, validated
digit-for-digit against the COM path.
The gRPC backend also resolves the stale-session and project-locked errors that
have long been the main pain point with COM.
Many thanks to Joey Yaker for designing and contributing this backend. See the PyAEDT backend docs for full details and Tutorial 7.
Quickstart — no Ansys required
Compute the transmon anharmonicity from first principles, no HFSS needed:
import numpy as np
from pyEPR.calcs.back_box_numeric import epr_numerical_diagonalization
# Standard transmon: E_J/h = 20 GHz, E_C/h = 300 MHz
# Plasma frequency f_p = sqrt(8 E_J E_C)/h ≈ 6.93 GHz
freqs = np.array([6.928]) # GHz (linearised plasma frequency)
Ljs = np.array([8.2e-9]) # H (Josephson inductance L_J = (Phi_0/2pi)^2 / E_J)
phi_zpf = np.array([[0.416]]) # dimensionless (n_modes x n_junctions)
# Diagonalize — returns dressed frequencies in Hz and chi matrix in MHz
f_dressed, chi_matrix = epr_numerical_diagonalization(
freqs, Ljs, phi_zpf, cos_trunc=8, fock_trunc=15
)
print(f"Qubit frequency : {f_dressed[0].real / 1e9:.3f} GHz")
print(f"Anharmonicity : {chi_matrix[0,0].real:.0f} MHz")
# -> Qubit frequency : 6.615 GHz
# -> Anharmonicity : 335 MHz
For multi-mode systems, fluxonium, or custom potentials: Tutorial 6.
Full HFSS workflow
import pyEPR as epr
# 1. Connect to Ansys HFSS
pinfo = epr.ProjectInfo(project_path=r'C:\sim_folder',
project_name=r'cavity_with_two_qubits',
design_name=r'Alice_Bob')
# 2. Specify Josephson junctions
pinfo.junctions['jAlice'] = {'Lj_variable':'Lj_alice', 'rect':'rect_alice',
'line': 'line_alice', 'Cj_variable':'Cj_alice'}
pinfo.junctions['jBob'] = {'Lj_variable':'Lj_bob', 'rect':'rect_bob',
'line': 'line_bob', 'Cj_variable':'Cj_bob'}
pinfo.validate_junction_info()
# 3. Extract EPR participation ratios
eprd = epr.DistributedAnalysis(pinfo)
eprd.do_EPR_analysis()
# 4. Quantum Hamiltonian — dressed frequencies and chi matrix
epra = epr.QuantumAnalysis(eprd.data_filename)
epra.analyze_all_variations(cos_trunc=8, fock_trunc=15)
epra.plot_hamiltonian_results(swp_variable='Lj_alice')
Documentation
Full docs, API reference, and guides: pyepr-docs.readthedocs.io
Tutorial Notebooks
The tutorials are Jupyter notebooks in _tutorial_notebooks/.
| # | Title | HFSS? | Topics |
|---|---|---|---|
| 1 | Startup example | Yes | End-to-end workflow: HFSS → EPR → χ matrix |
| 2 | Dielectric loss EPR | Yes | Dielectric energy participation, loss rates, HFSS fields calculator |
| 3 | Circuit QED parameters | No | E_J, E_C, L_J, I_c conversions; transmon model |
| 4 | Parametric sweeps | Yes | HFSS Optimetrics: linear, log, file-based sweeps |
| 5 | Generic junction potential & fluxonium | No | Exact cosine for fluxonium; custom V(phi); asymmetric SQUIDs |
| 6 | EPR without HFSS | No | Numerical workflow: supply freqs, Ljs, phi_zpf directly |
Tutorials 3, 5, and 6 require only
pip install pyEPR-quantum— no Ansys licence.
Video Tutorials
Who uses pyEPR?
pyEPR is used by superconducting qubit research groups worldwide, including:
- Yale University — Michel Devoret QLab and Rob Schoelkopf RSL
- IBM Quantum and Qiskit Metal
- QUANTIC — INRIA/ENS/MINES Paris/UPMC/CNRS (Zaki Leghtas group), France
- Quantum Circuit Group — Benjamin Huard, ENS Lyon, France
- Emanuel Flurin, CEA Saclay, France
- Ioan Pop group, KIT Physikalisches Institut, Germany
- UC Berkeley, Quantum Nanoelectronics Laboratory, Irfan Siddiqi
- Quantum Circuits, Inc. · Seeqc · Alice&Bob, France · Bleximo
- Serge Rosenblum Lab, Weizmann Institute, Israel
- University of Oxford — Leek Lab
- Britton Plourde Lab, Syracuse University
- Javad Shabani Lab, NYU
- UChicago Dave Schuster Lab · Lawrence Berkeley National Lab · Colorado School of Mines
- IPQC, SJTU, Shanghai · Bhabha Atomic Research Centre, India
- Quantum Device Lab ETHZ — Andreas Wallraff · Centre for Quantum Technologies / Qcrew
- SQC lab — Shay Hacohen-Gourgy, Israel · Quantum Computing UK
- ... and many more — e-mail
[email protected]to be added.
Platform support
| Feature | Windows | macOS | Linux |
|---|---|---|---|
| EPR / quantum analysis | Yes | Yes | Yes |
| Ansys HFSS COM interface | Yes | limited | limited |
The HFSS COM interface uses pythoncom/win32com (Windows). On macOS/Linux you can connect to a remote Windows HFSS instance via network COM.
PyAEDT is Ansys's official cross-platform AEDT scripting library. pyEPR and PyAEDT are complementary — use PyAEDT for geometry/mesh/solve automation, pyEPR for EPR quantization.
HFSS Project Setup
Eigenmode Design — Junction setup
The EPR method requires each Josephson junction to be modelled as a lumped RLC boundary on a rectangle in HFSS, together with a polyline defining the current direction. Steps:
- Create a rectangle for each junction (e.g.,
rect_alice). Assign aLumped RLCboundary with inductance variableLj_alice. - Draw a polyline spanning the junction rectangle to define current flow (e.g.,
line_alice). - The linearised Josephson inductance used in HFSS is $L_J = (\Phi_0/2\pi)^2/E_J$. The full cosine potential is restored in the quantum Hamiltonian step.
- Enable Save Fields for each variation if running parametric sweeps (Tutorial 4).
- Use
Mixed Ordersolutions for best accuracy.
For a full walkthrough, see Tutorial 1 and the HFSS setup guide in the docs.
Troubleshooting
See the troubleshooting guide in the docs.
Common issues:
- pint error
system='mks' unknown— upgrade pint:pip install pint --upgrade - QuTiP not found — it is installed automatically with pyEPR-quantum; for manual install:
pip install qutip - COM Error on opening HFSS — check file path (no apostrophes/special chars); check HFSS hasn't popped an error dialog
- Parametric sweep missing field solutions — enable "Save Fields and Mesh" in ParametricSetup → Properties → Options (see Tutorial 4)
ValueError: cannot set WRITEABLE flag— upgrade numpy
Citation
If you use pyEPR in your research, please cite:
EPR method (primary reference):
Z. K. Minev, Z. Leghtas, S. O. Mundhada, L. Christakis, I. M. Pop, M. H. Devoret, Energy-participation quantization of Josephson circuits, npj Quantum Information 7, 131 (2021) · arXiv:2010.00620
Software (Zenodo DOI for the specific version):
BibTeX for both: pyEPR.bib
Related:
- Z. K. Minev, Ph.D. Dissertation, Yale (2018), Ch. 4 — arXiv:1902.10355
- A. Petrescu, C. T. Hann, Z. K. Minev et al., EPR for very anharmonic circuits — arXiv:2411.15039
Authors and Contributors
- Authors: Zlatko Minev & Zaki Leghtas, 2015–present.
- Contributors: Phil Reinhold, Lysander Christakis, Devin Cody, Zachary Parrott, Asaf Diringer, and many others.
- Original
pyHFSS.pyandpyNumericalDiagonalization.pyby Phil Reinhold — original repo. - To contribute: open a GitHub issue or PR, or contact Z. Minev.
Community contributions
Joey Yaker — PyAEDT gRPC backend (pyEPR.ansys_pyaedt, v0.9.6).
Designed and implemented PyaedtDistributedAnalysis: a complete alternative HFSS transport layer that
drives the EPR field extraction entirely over gRPC via Ansys's official PyAEDT API, with no COM / pywin32.
Includes the key insight that CalculatorWrite (write to a .fld file) must replace the stateful
ClcEval/GetTopEntryValue round-trip for results to survive gRPC — validated digit-for-digit against
the COM path. Makes pyEPR fully cross-platform for users with PyAEDT installed.
