Skip to content

dq.plot_wigner_gif

plot_wigner_gif(
    states: ArrayLike,
    *,
    gif_duration: float = 5.0,
    fps: int = 10,
    w: float = 5.0,
    h: float | None = None,
    xmax: float = 5.0,
    ymax: float | None = None,
    vmax: float = 2 / jnp.pi,
    npixels: int = 101,
    cmap: str = "dq",
    interpolation: str = "bilinear",
    cross: bool = False,
    clear: bool = False,
    filename: str = ".tmp/dynamiqs/wigner.gif",
    dpi: int = 72,
    display: bool = True
)

Plot a GIF of the Wigner function of multiple states.

Warning

Documentation redaction in progress.

Warning

This function creates files in the current working directory under .tmp/dynamiqs.

Note

By default, the GIF is displayed in Jupyter notebook environments.

See dq.plot_wigner() for more details.

Examples

>>> n = 16
>>> a = dq.destroy(n)
>>> H = dq.zero(n)
>>> jump_ops = [a @ a - 4.0 * dq.eye(n)]  # cat state inflation
>>> psi0 = dq.coherent(n, 0)
>>> tsave = np.linspace(0, 1.0, 1001)
>>> result = dq.mesolve(H, jump_ops, psi0, tsave)
>>> dq.plot_wigner_gif(
...     result.states,
...     fps=25,  # 25 frames per second
...     xmax=4.0,
...     ymax=2.0,
...     filename='docs/figs_code/wigner-cat.gif',
...     dpi=150,
...     display=False,
... )

plot_wigner_gif_cat

>>> n = 16
>>> a = dq.destroy(n)
>>> H = dq.dag(a) @ dq.dag(a) @ a @ a  # Kerr Hamiltonian
>>> psi0 = dq.coherent(n, 2)
>>> tsave = np.linspace(0, np.pi, 1001)
>>> result = dq.sesolve(H, psi0, tsave)
>>> dq.plot_wigner_gif(
...     result.states,
...     gif_duration=10.0,  # 10 seconds GIF
...     fps=25,
...     xmax=4.0,
...     clear=True,
...     filename='docs/figs_code/wigner-kerr.gif',
...     dpi=150,
...     display=False,
... )

plot_wigner_gif_kerr