twpasolver.analysis.results module#
Results of the gain and phase-matching analyses.
- class twpasolver.analysis.results.GainResult(model: str, unit: str, signal_freqs: ~numpy.ndarray, pump_freq: float, x: ~numpy.ndarray, mode_labels: list[str], signal_mode: str, pump_mode: str, I_fwd: ~numpy.ndarray, I_bwd: ~numpy.ndarray, a_in: ~numpy.ndarray, a_out: ~numpy.ndarray, b_in: ~numpy.ndarray, b_out: ~numpy.ndarray, gain_db: ~numpy.ndarray, gain_db_12: ~numpy.ndarray, gain_db_11: ~numpy.ndarray, gain_db_22: ~numpy.ndarray, converged: ~numpy.ndarray, diagnostics: dict[str, typing.Any] = <factory>, history: dict[str, typing.Any] = <factory>)[source]#
Bases:
_SaveableResult of
TWPAnalysis.gain(); the same fields for every model.Frequencies are in
unit, positions in unit cells, currents in A.- Variables:
model (str) – Gain model,
"simple"or"bloch".unit (str) – Frequency unit.
signal_freqs (numpy.ndarray) – Signal frequencies, shape (n_freq,).
pump_freq (float) – Pump frequency.
x (numpy.ndarray) – Positions along the device, shape (n_x,).
mode_labels (list[str]) – Mode names, in the order of the mode axis.
pump_mode (signal_mode,) – Names of the signal and pump modes.
I_bwd (I_fwd,) – Forward and backward mode currents inside the device, shape (n_freq, n_modes, n_x);
I_bwdis zero forsimple.a_out (a_in,) – Currents incident from the external lines at x=0 and x=L, shape (n_freq, n_modes).
b_out (b_in,) – Currents going out into the external lines at x=0 and x=L (
b_inis NaN forsimple, which does not model it).gain_db_22 (gain_db, gain_db_12, gain_db_11,) – Signal S21, S12, S11 and S22 in dB, shape (n_freq,); NaN where the reference input is zero. With inputs at both ends the outputs contain the response to both.
converged (numpy.ndarray) – Points whose solution converged (
bloch) or reached the end of the device (simple), shape (n_freq,).diagnostics (dict[str, Any]) – Solver tables (
bloch: Bloch tables, edge-basis flags,residuals). The forward-backward residual is the largest change of any mode between passes relative to that mode’s largest forward plus backward envelope; nearly empty backward envelopes dominate it, so 1e-3 to 1e-1 is common while the gains are stable.history (dict[str, Any]) – With
BlochSolverConfig(save_all_passes=True), every pass:I_fwd,I_bwd,b_in,b_outand the four gains with a leading pass axis of lengthpasses; NaN after the last pass a point ran (diagnostics["passes_used"]). Otherwise empty.
- signal_freqs: ndarray#
- x: ndarray#
- I_fwd: ndarray#
- I_bwd: ndarray#
- a_in: ndarray#
- a_out: ndarray#
- b_in: ndarray#
- b_out: ndarray#
- gain_db: ndarray#
- gain_db_12: ndarray#
- gain_db_11: ndarray#
- gain_db_22: ndarray#
- converged: ndarray#
- class twpasolver.analysis.results.PhaseMatchingResult(unit: str, process: str, mixing: str, signal_mode: str, pump_mode: str, idler_mode: str, signal_freqs: ndarray, pump_freqs: ndarray, delta: ndarray, relative: bool, optimal_pump_freq: float, f_triplets: ndarray, k_triplets: ndarray)[source]#
Bases:
_SaveableResult of
TWPAnalysis.phase_matching().- Variables:
unit (str) – Frequency unit.
mixing (process,) – Process (
"PA","FCU","FCD") and mixing ("3WM","4WM").idler_mode (signal_mode, pump_mode,) – Mode names.
pump_freqs (signal_freqs,) – Grids, shapes (n_signal,) and (n_pump,).
delta (numpy.ndarray) – Phase mismatch per unit cell (relative to the signal
kifrelative), shape (n_signal, n_pump); NaN for pumps in a stopband.relative (bool) – Whether
deltais divided by the signal wavenumber.optimal_pump_freq (float) – Pump with the smallest mean
|delta|; NaN if none.k_triplets (f_triplets,) – Pump, signal and idler frequencies and (length-weighted) wavenumbers for every pump and signal, shape (n_pump * n_signal, 3).
- signal_freqs: ndarray#
- pump_freqs: ndarray#
- delta: ndarray#
- f_triplets: ndarray#
- k_triplets: ndarray#