twpasolver package#
twpasolver package.
Twpasolver: TWPA Analysis and Simulation Library#
twpasolver is a Python library for analyzing and simulating Traveling Wave
Parametric Amplifiers (TWPAs) by solving systems of Coupled Mode Equations (CMEs).
Key Features#
- Extended CME Systems:
Solve CMEs with arbitrary numbers of modes beyond pump-signal-idler
Automatic inclusion of pump harmonics, frequency conversion terms, and harmonics
Support for 3-wave mixing (3WM) and 4-wave mixing (4WM) processes
Rotating Wave Approximation (RWA) term selection
- Mode Management:
ModeArrayclass with symbolic frequency dependency trackingAutomatic mode relationship propagation using dependency graphs
Support for forward and backward propagating modes
Parameter interpolation (kappa, gamma, alpha) from base data
- Performance:
Numba-accelerated parallel CME solvers
Efficient matrix operations for 2x2 ABCD matrices
Frequency array processing with caching
Parameter sweeps with result caching
- Gain Models:
MINIMAL_3WM: Basic three-wave mixing model with only pump, signal and idler
GENERAL_IDEAL: Extended modes without losses or reflections
GENERAL_LOSS_ONLY: Extended modes with losses
GENERAL: Full model with losses and reflections
- Circuit Modeling:
Hierarchical composition of one-port and two-port network elements
Pre-built KITWPA cell models (lumped or distributed elements)
Custom circuit elements with automatic ABCD matrix computation
- Analysis Tools:
Phase matching analysis with custom mode configurations
Gain and bandwidth calculations with pump depletion effects
Parameter sweeps with automatic result caching
Built-in plotting functions
Core Classes#
TWPAnalysis: Main analysis engine with extended CME supportModeArray: Mode relationship handler with symbolic frequency propagationTWPA: Nonlinear TWPA model with circuit compositionABCDArray: Optimized 2x2 matrix arraysTwoPortCell: Network parameter container with format conversion
Usage Examples#
See the Tutorials section for detailed examples from simple linear component analysis to complex multi-mode simulations with pump harmonics and frequency conversion processes.
Subpackages#
- twpasolver.models package
Submodules#
- twpasolver.analysis module
- TWPA Analysis and Simulation
GainModelprepare_relations_coefficients()analysis_function()AnalyzerTWPAnalysisTWPAnalysis.twpaTWPAnalysis.load_model_from_fileTWPAnalysis.update_base_data()TWPAnalysis.get_mode_array()TWPAnalysis.add_mode_array()TWPAnalysis.phase_matching()TWPAnalysis.gain()TWPAnalysis.bandwidth()TWPAnalysis.plot_response()TWPAnalysis.plot_gain()TWPAnalysis.plot_mode_currents()TWPAnalysis.plot_phase_matching()TWPAnalysis.model_post_init()
- twpasolver.basemodel module
- twpasolver.bonus_types module
- twpasolver.cmes module
- twpasolver.file_utils module
- twpasolver.frequency module
- twpasolver.logger module
- twpasolver.mathutils module
- twpasolver.matrices_arrays module
- twpasolver.modes_rwa module
- twpasolver.plotting module
- twpasolver.twoport module