using BitInformation, PyPlot N = 100_000 x = zeros(N) y = zeros(N) x[1] = randn() y[1] = randn() cx = 0.95 cy = 0.999 for i in 2:N x[i] = cx*x[i-1] + sqrt(1-cx^2)*randn() y[i] = cy*y[i-1] + sqrt(1-cy^2)*randn() end # subsample and m last time steps to plot sub = 10 m = 1000 hcat(bitinformation(x)[12:20], bitinformation(y)[12:20]) hcat(bitinformation(x[1:sub:end])[12:20], bitinformation(y[1:sub:end])[12:20]) bitinformation(randn(N))[1:12] fig,axs = subplots(2,3,sharex=true,sharey=true,figsize=(9,4)) c = "teal" axs[1,3].plot(randn(m),c,lw=3) axs[1,2].plot(x[1:m],c,lw=3) axs[1,1].plot(y[1:m],c,lw=3,label="full precision") axs[2,3].plot(1:sub:m,randn(m÷sub),c,lw=3) axs[2,2].plot(1:sub:m,x[1:sub:m],c,lw=3) axs[2,1].plot(1:sub:m,y[1:sub:m],c,lw=3) axs[1,3].plot(round(randn(m),-11),"C1",lw=2) axs[1,2].plot(round(x[1:m],1),"C1") axs[1,1].plot(round(y[1:m],4),"C1",label="round to\n99% information") axs[2,3].plot(1:sub:m,round(randn(m÷sub),-11),"C1",lw=2) axs[2,2].plot(1:sub:m,round(x[1:sub:m],-1),"C1") axs[2,1].plot(1:sub:m,round(y[1:sub:m],2),"C1") axs[1,3].set_title("High resolution, noise",loc="left") axs[1,2].set_title("High resolution, rough",loc="left") axs[1,1].set_title("High resolution, smooth",loc="left") axs[2,3].set_title("Low resolution, noise",loc="left") axs[2,2].set_title("Low resolution, rough",loc="left") axs[2,1].set_title("Low resolution, smooth",loc="left") for (iax,ax) in enumerate(axs) ax.set_title(string(Char(iax+96)),loc="right",fontweight="bold") end for ax in axs[2,:] ax.set_xlabel("dimension to compress") end for ax in axs[:,1] ax.set_ylabel("values") ax.set_yticks([-2,0,2]) end axs[1,1].legend(loc=3,fontsize=8) axs[1,1].set_xlim(1,m-1) tight_layout() savefig("resolution_information.png",dpi=200) savefig("resolution_information.pdf")