defplot_frame(i):f=plt.figure(figsize=(8*1.3,5*1.3))s_wigner=plt.subplot2grid((5,8),(0,0),colspan=5,rowspan=5)s_purity=plt.subplot2grid((5,8),(0,5),colspan=5,rowspan=1)s_phase=plt.subplot2grid((5,8),(1,5),colspan=5,rowspan=2,sharex=s_purity)s_population=plt.subplot2grid((5,8),(3,5),colspan=5,rowspan=2,sharex=s_purity)s_drive=inset_axes(s_wigner,width='30%',height='30%',loc=2)plt.setp(s_purity.get_xticklabels(),visible=False)plt.setp(s_phase.get_xticklabels(),visible=False)plt.setp(s_drive.get_xticklabels(),visible=False)plt.setp(s_drive.get_yticklabels(),visible=False)s_purity.set_title('Purity')s_phase.set_title('Relative Phase')s_population.set_title('Population')s_drive.set_xlabel('Drives')s_population.set_xlabel('$T$')s_wigner.set_xlabel(r'$Re(\alpha)$')s_wigner.set_ylabel(r'$Im(\alpha)$')s_wigner.set_xlim(-1.5*alpha0,1.5*alpha0)s_wigner.set_ylim(-1.5*alpha0,1.5*alpha0)s_drive.set_xlim(-1.5*alpha0,1.5*alpha0)s_drive.set_ylim(-1.5*alpha0,1.5*alpha0)s_purity.set_ylim(0.99,1.0003)s_phase.set_ylim(0,2*np.pi)s_population.set_ylim(0,1)s_population.set_xlim(0,T)s_purity.plot(time[:i],purity[:i],'k',alpha=0.5,linewidth=4)s_phase.plot(time[:i],phases[:i,0],'g',alpha=0.5,linewidth=4)s_phase.plot(time[:i],phases[:i,1],'r',alpha=0.5,linewidth=4)s_population.plot(time[:i],populations[:i],alpha=0.5,linewidth=4)s_purity.plot(time[i],purity[i],'ko',alpha=0.5)s_phase.plot(time[i],phases[i,0],'g^',alpha=0.5)s_phase.plot(time[i],phases[i,1],'rv',alpha=0.5)s_population.plot(time[i],populations[i,0],'bs',alpha=0.5)s_population.plot(time[i],populations[i,1],'g^',alpha=0.5)s_population.plot(time[i],populations[i,2],'rv',alpha=0.5)s_drive.plot(np.real(alphas[::SKIP][:i]),np.imag(alphas[::SKIP][:i]),'b')s_drive.plot(np.real(betas[::SKIP][:i]),np.imag(betas[::SKIP][:i]),'g')s_drive.plot(np.real(gammas[::SKIP][:i]),np.imag(gammas[::SKIP][:i]),'r')s_drive.plot(np.real(alphas[::SKIP][i]),np.imag(alphas[::SKIP][i]),'bo')s_drive.plot(np.real(betas[::SKIP][i]),np.imag(betas[::SKIP][i]),'go')s_drive.plot(np.real(gammas[::SKIP][i]),np.imag(gammas[::SKIP][i]),'ro')ra,ia=np.linspace(-3,3,100),np.linspace(-3,3,100)w=qutip.wigner(frames[::SKIP][i],ra,ia,g=2)s_wigner.contourf(ra,ia,w,100,vmin=-0.4,vmax=0.4,cmap=mpl.cm.get_cmap('RdBu'))s_phase.legend([r'$\alpha$ to $\beta$',r'$\alpha$ to $\gamma$'])s_population.legend([r'$\alpha$',r'$\beta$',r'$\gamma$'])f.tight_layout()returnf