spheres.visualization.matplotlib_spheres.animate_spin

spheres.visualization.matplotlib_spheres.animate_spin(spin, H, dt=0.1, T=100, show_arrows=True, show=True, html_animation=False, filename=None, fps=20)[source]

Visualizes the evolution of a spin-j state with matplotlib.

%matplotlib notebook
animate_spin(qt.rand_ket(3), qt.rand_herm(3))
Parameters
  • spin (qt.Qobj) – Spin-j state.

  • H (qt.Qobj) – Hamiltonian.

  • dt (float) – Time step.

  • T (float) – Time interval.

  • show_arrows (bool) – If True, also shows vectors pointing to the stars.

  • show (bool) – Whether to automatically display the figure.

  • html_animation (bool) – Whether to return an HTML video.

  • filename (str) – Where to save the resulting animation.

  • fps (int) – Frames per second.

Returns

Return type

matplotlib.animation.FuncAnimation or IPython.core.display.HTML