Repository navigation
EMpy 3.0.1 is a physics and numerical bug-fix release resolving 17 issues uncovered by a systematic electrodynamic audit across all modules, and expanding the test suite to 104 tests with closed-form analytical benchmarks covering every solver.
Fixed
- Photonic Devices & Materials (
EMpy.devices,EMpy.materials):- Fixed
NRR.CMforN ≥ 2rings to compose each ring section(L1 · K · L2)as aChainMatrixviacomposeCMlistinstead of cascading withcomposeTMlist(previously modeled a single ring coupledNtimes to the input bus rather thanNserially coupled CROW rings). - Fixed
T_CTCRR.DROPrelative phase sign (-1jinstead of+1j, matchingj³ = -jacross three cross-couplings underCoupler's[[t, jK], [jK, t]]convention). - Fixed
EMpy.materials.SiO2thermo-optic coefficientdn/dTfrom1.1e-4to1.0e-5 K⁻¹(fused silica near 1.55 µm).
- Fixed
- Transfer Matrix (
EMpy.transfer_matrix):- Replaced
AnisotropicTransferMatrix.solve's raw 4 × 4D P D⁻¹cascade with a bounded passive Enhanced Transmittance Matrix (ETM) backward sweep (|exp(-i k_z d)| ≤ 1), eliminating catastrophic cancellation on thick coupled anisotropic layers andNaNoverflow on thick metals. - Replaced
IsotropicTransferMatrix.solve's raw cascade with closed-form Abeles layer matrices usingsincatq_z → 0(eliminatingLinAlgErrorat exact inner-layer grazing/cutoffn_i = n_0 sin θ) and per-layerexp(-|Im φ|)scaling (eliminating thick-metal overflow).
- Replaced
- Rigorous Coupled-Wave Analysis (
EMpy.RCWA):- Unified the
zero_ktthreshold (|kt| ≤ 1e-13 * k) inIsotropicRCWAandAnisotropicRCWAsofc² + fs² = 1holds identically near normal incidence and for near-normal exiting diffraction orders. - Fixed internal-layer mode branch selection in
IsotropicRCWA(Re(q) + Im(q) ≥ 0) andAnisotropicRCWA(-(Re(q) + Im(q)) ≥ 0) under oblique incidence from a lossy superstrate, eliminating singular/explodingMTp1. - Fixed
AnisotropicRCWA's custom-grating fallback to avoid using(ε⁻¹)_xxas1/ε_xxwhen off-diagonalx-coupling is present, and updatedget_pitch()to recognize custom grating classes with a.pitchattribute.
- Unified the
- Waveguide Mode Solvers (
EMpy.modesolvers.FD,EMpy.modesolvers.FMM):- Fixed swapped
n/smesh weights inVFDModeSolver.build_matrix(ayxnoff-diagonalε_xyterms), restoring exactx ↔ yrotational symmetry and second-order consistency on non-uniform anisotropic meshes. - Fixed
stretchmeshgeometric method'G'for mesh compression (0 < f < 1) via exact convexbrentqbracketing on(-1/f, ln f), preventing convergence to the trivial rootb = 0. - Fixed
FDMode.norm()to return strictly realsqrt(|P|)sonormalize()yields unit norm without injecting a spurious global phase on lossy/PML modes. - Fixed off-by-one right-branch continuity guards (
idx1 > n2 - 1) inFMMshootingandFMMshootingTMfor slices with≥ 2layers to the right of the peak-index layer, and added scale-invariant derivative/flux matching fallback when a mode has a node at the matching interface. - Fixed
FMM2dinterior-slice indexing (i = idx - 1) inMvecand generalizedcheck_matchingforNslices ≥ 4. - Replaced single-endpoint evanescent evaluation in
FMMMode1dy.eval,FMMMode2d.eval,_slice_mode1dx, and_refine_mode1dwith symmetric two-endpoint decaying exponentials (_eval_segment) for|Im(k·d)| > 1, and madeFMMMode2d.norm()strictly real. - Enforced the passive cutoff branch
Re(k_eff) - Im(k_eff) ≥ 0continuously asκ → 0⁺inanalyticalsolutionandFMM1d_y. - Fixed
findzerosnewscalar indexing on single-zero scan windows (len(zeri) == 1) and added local-minimum detection so broad off-axis minima in lossy waveguides are not missed.
- Fixed swapped
Tests
- Expanded the verification suite from 85 to 104 tests with closed-form analytical benchmarks across every solver: Lekner/Yeh uniaxial oblique Fresnel (
AnisotropicTransferMatrix), lossless CROW Möbius recursion (NRR), Yariv critical coupling and resonant group delay (APRR,SRR), balanced 3 dBMZ, homogeneous PEC waveguide & uniaxial anisotropic slab dispersion (VFDModeSolver,SVFDModeSolver), finite-box slab & multi-layer/multi-slice Abeles dispersion (FMM1d,FMM2d), Hertzian electric & magnetic dipole near/mid/far fields (currentsScatteringKottler), and Stefan–Boltzmann / Wien blackbody laws.
Full Changelog: 3.0.0...3.0.1