def PlotSpatial(weight, lattice, SpinIn, SpinOut, DoesSave=True): Omega = 0 OriginalSubLat = 0 coord3 = 0 weight.FFT("R", "T") x = [] y = [] z = [] points, _ = lattice.GetSitesList() for vec, coord, sub in points: if lattice.Dim == 2 or (lattice.Dim == 3 and coord[2] == 0): x.append(vec[0]) y.append(vec[1]) if coord[0] == coord[1] == 0 and sub == OriginalSubLat: z.append(0.0) else: z.append(weight.Data[SpinIn, OriginalSubLat, SpinOut, sub, weight.Map.CoordiIndex(coord), Omega].real) log.info("Max:{0}, Min: {1}".format(max(z), min(z))) plt.figure() plt.scatter(x, y, c=z, s=10, edgecolor="black", linewidth=0) c = plt.colorbar(orientation='horizontal', shrink=0.8, ticks=np.linspace(min(z), max(z), 4)) c.set_label("magnitude") plt.axis('equal') if DoesSave: plt.savefig("spatial_sub{0}.pdf".format(OriginalSubLat)) else: plt.show() plt.close()
def PlotWeightvsR(Name, weight, lattice, SpinIn, SpinOut, Tau=0, DoesSave=True): Omega=0 OriginalSubLat=0 coord3=0 #weight.FFT("R","W") weight.FFT("R","T") x=[] y=[] z=[] points, _=lattice.GetSitesList(HasOffset=False) for vec, coord, sub in points: if not all(v == 0 for v in coord) and all(v<l/2 for v,l in zip(coord, lattice.L)): x.append(np.linalg.norm(vec)) y.append(abs(weight.Data[SpinIn, OriginalSubLat, SpinOut, sub, weight.Map.CoordiIndex(coord), Omega])) #sort x,y according to the distance in x x,y = (list(x) for x in zip(*sorted(zip(x, y), key=lambda pair: pair[0]))) #fitting #fitParams, fitCovariances = curve_fit(Exp, x, y) plt.figure() plt.plot(x,y, "o") #plt.plot(x, Exp(x, fitParams[0], fitParams[1]), '-', #label="fit with ${0}exp(-R/{1}a)$".format(fitParams[0], 1.0/fitParams[1])) plt.yscale("log") plt.xlabel("$R/a$") plt.ylabel("$|{0}(\omega={1})|$".format(Name,Omega)) #plt.legend() if DoesSave: plt.savefig("WeightvsR.pdf") else: plt.show() plt.close()