Plotting

Plotting helpers for solver outputs and phase-space distributions.

openquantumsim.plot.expect_plot(times, values, *, ax=None, label=None, ylabel='expectation')

Plot one expectation-value time series.

Parameters:
  • times (Sequence[float] | ndarray[tuple[Any, ...], dtype[float64]])

  • values (Sequence[complex | float] | ndarray[tuple[Any, ...], dtype[Any]])

  • ax (Any | None)

  • label (str | None)

  • ylabel (str)

Return type:

Any

openquantumsim.plot.plot_expectations(result, *, ax=None, labels=None, ylabel='expectation')

Plot all expectation-value series stored in a solver result.

Parameters:
  • result (Result)

  • ax (Any | None)

  • labels (Sequence[str] | None)

  • ylabel (str)

Return type:

Any

openquantumsim.plot.plot_state_observable(result, name, *, ax=None, ylabel=None)

Plot a named state-observable series from a solver result.

Parameters:
  • result (Result)

  • name (str)

  • ax (Any | None)

  • ylabel (str | None)

Return type:

Any

openquantumsim.plot.plot_wigner(state, xvec=None, pvec=None, *, ax=None, points=201, xlim=(-5.0, 5.0), plim=None, cmap='RdBu_r', colorbar=True)

Plot a Wigner function as a diverging phase-space heatmap.

Parameters:
  • state (ndarray[tuple[Any, ...], dtype[complex128]])

  • xvec (Sequence[float] | ndarray[tuple[Any, ...], dtype[float64]] | None)

  • pvec (Sequence[float] | ndarray[tuple[Any, ...], dtype[float64]] | None)

  • ax (Any | None)

  • points (int)

  • xlim (tuple[float, float])

  • plim (tuple[float, float] | None)

  • cmap (str)

  • colorbar (bool)

Return type:

Any

openquantumsim.plot.plot_q_function(state, xvec=None, pvec=None, *, ax=None, points=201, xlim=(-5.0, 5.0), plim=None, cmap='viridis', colorbar=True)

Plot a Husimi-Q function as a positive phase-space heatmap.

Parameters:
  • state (ndarray[tuple[Any, ...], dtype[complex128]])

  • xvec (Sequence[float] | ndarray[tuple[Any, ...], dtype[float64]] | None)

  • pvec (Sequence[float] | ndarray[tuple[Any, ...], dtype[float64]] | None)

  • ax (Any | None)

  • points (int)

  • xlim (tuple[float, float])

  • plim (tuple[float, float] | None)

  • cmap (str)

  • colorbar (bool)

Return type:

Any

openquantumsim.plot.plot_phase_space(values, xvec, pvec, *, ax=None, cmap='viridis', colorbar=True, vmin=None, vmax=None, title=None)

Plot a precomputed phase-space array.

Parameters:
  • values (ndarray[tuple[Any, ...], dtype[float64]])

  • xvec (Sequence[float] | ndarray[tuple[Any, ...], dtype[float64]])

  • pvec (Sequence[float] | ndarray[tuple[Any, ...], dtype[float64]])

  • ax (Any | None)

  • cmap (str)

  • colorbar (bool)

  • vmin (float | None)

  • vmax (float | None)

  • title (str | None)

Return type:

Any

openquantumsim.plot.plot_density_matrix(rho, *, ax=None, absolute=True, colorbar=True, cmap='magma')

Plot a density matrix magnitude or real part.

Parameters:
  • rho (ndarray[tuple[Any, ...], dtype[complex128]])

  • ax (Any | None)

  • absolute (bool)

  • colorbar (bool)

  • cmap (str)

Return type:

Any