twpasolver.plotting module#

Collection of plot functions.

twpasolver.plotting.plot_mode_currents(x: ndarray, I_tuples: ndarray, mode_names: List[str], pump_freq: float | None = None, freqs_unit: str = 'GHz', figsize: tuple = (9, 5), log_scale: bool = True, line_styles: List[str] | None = None, colors: List[str] | None = None, title: str | None = None, ylim: tuple | None = None, lw=2) → Axes[source]#

Plot the mean current of each mode over frequency as a function of cell number.

Parameters:
  • x – Positions in unit cells, shape (n_x,).

  • I_tuples – Mode currents, shape (n_freq, n_modes, n_x).

  • mode_names – Legend labels.

  • log_scale – Plot in dBm (True) or in A (False).

twpasolver.plotting.plot_response(freqs: ndarray, s21_db: ndarray, k_star: ndarray, pump_freq: float | None = None, freqs_unit: str = 'GHz', figsize: tuple[float, float] = (5.0, 6.0), **plot_kwargs) → Axes[source]#

Plot |S21| in dB and the wavenumber k* (rad) versus frequency.

Parameters:
  • pump_freq (Optional[float]) – If given, marked with a vertical line.

  • freqs_unit (str) – Unit label for the frequency axis.

  • **plot_kwargs – Passed to ax.plot.

twpasolver.plotting.plot_gain(freqs: ndarray, gain_db: ndarray, freqs_unit: str = 'GHz', **plot_kwargs) → Axes[source]#

Plot gain in dB versus frequency.

Parameters:
  • freqs_unit (str) – Unit label for the frequency axis.

  • **plot_kwargs – Passed to ax.plot.

twpasolver.plotting.plot_phase_matching(pump_freqs: ndarray, signal_freqs: ndarray, delta_pm: ndarray, freqs_unit: str = 'GHz', thin=1, log_abs=True, **plot_kwargs) → Axes[source]#

Plot the phase mismatch map over pump and signal frequency.

Parameters:
  • delta_pm (np.ndarray) – Phase mismatch, shape (len(signal_freqs), len(pump_freqs)).

  • freqs_unit (str) – Unit label for the frequency axes.

  • thin (int) – Plot every thin-th point along both axes.

  • log_abs (bool) – Plot log|delta_pm|.

  • **plot_kwargs – Passed to ax.pcolor.