Phase Space

Phase-space distributions for finite Fock-space states.

openquantumsim.phase_space.wigner(state, xvec, pvec=None)

Evaluate the Wigner function on an x/p grid.

The state may be a ket or density matrix in a truncated Fock basis. The returned array has shape (len(pvec), len(xvec)).

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

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

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

Return type:

ndarray[tuple[Any, …], dtype[float64]]

openquantumsim.phase_space.q_function(state, xvec, pvec=None)

Evaluate the Husimi-Q function on an x/p grid.

The convention is Q(alpha) = <alpha|rho|alpha> / pi with alpha = (x + i p) / sqrt(2).

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

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

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

Return type:

ndarray[tuple[Any, …], dtype[float64]]

openquantumsim.phase_space.phase_space_grid(*, xlim=(-5.0, 5.0), plim=None, points=201)

Return equally spaced x and p axes for phase-space plots.

Parameters:
  • xlim (tuple[float, float])

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

  • points (int)

Return type:

tuple[ndarray[tuple[Any, …], dtype[float64]], ndarray[tuple[Any, …], dtype[float64]]]