twpasolver.plotting module#

Collection of plot functions.

twpasolver.plotting.plot_mode_currents(gain_result: Dict[str, Any], mode_names: List[str] | None = None, 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) Axes[source]#

Plot the mean current of each mode in dB as a function of cell number.

Parameters:
  • gain_result – Dictionary output from the gain analysis function

  • mode_names – Optional list of mode names for labeling (auto-detected if not provided)

  • figsize – Figure size tuple (width, height)

  • log_scale – Whether to plot in dB scale (True) or linear scale (False)

  • line_styles – Optional list of line styles for different modes

  • colors – Optional list of colors for different modes

  • title – Custom title for the plot

  • ylim – Optional y-axis limits as (min, max)

Returns:

The matplotlib figure object

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 response of twpa.

Parameters:
  • freqs (np.ndarray) – Array of frequency values.

  • s21_db (np.ndarray) – S21 parameter in dB.

  • k_star (np.ndarray) – k* parameter.

  • pump_freq (Optional[float]) – Frequency of the pump signal.

  • freqs_unit (str) – Unit of the frequency values.

  • figsize (tuple[float, float]) – Size of the figure.

  • **plot_kwargs – Additional keyword arguments for the plot.

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

Plot gain in dB.

Parameters:
  • freqs (np.ndarray) – Array of frequency values.

  • gain_db (np.ndarray) – Gain values in dB.

  • freqs_unit (str) – Unit of the frequency values.

  • **plot_kwargs – Additional keyword arguments for the 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 phase matching.

Parameters:
  • pump_freqs (np.ndarray) – Array of pump frequency values.

  • signal_freqs (np.ndarray) – Array of signal frequency values.

  • delta_pm (np.ndarray) – Phase mismatch values.

  • freqs_unit (str) – Unit of the frequency values.

  • thin (int) – Thinning factor for plotting.

  • log_abs (bool) – Whether to plot the logarithm of the absolute values.

  • **plot_kwargs – Additional keyword arguments for the plot.