def check(self, im_axis_fine=None): """Sanity check for Pade approximant Evaluate the Pade approximant on the imaginary axis, however not only at Matsubara frequencies, but on a dense grid. If the approximant is good, then this should yield a smooth interpolating curve on the Matsubara axis. On the other hand, little 'spikes' are a hint for pole-zero pairs close to the imaginary axis. This is usually a result of noise and a different choice of Matsubara frequencies may help. Parameters ---------- im_axis_fine : numpy.ndarray, default=None Imaginary-axis points where the approximant is evaluated for checking. If not specified, an array of length 500 is generated, which goes up to twice the maximum frequency that was used for constructing the approximant. Returns ------- numpy.ndarray Values of the Pade approximant at the points of `im_axis_fine`. """ if im_axis_fine is None: self.ivcheck = np.linspace(0, 2 * np.max(self.im_axis), num=500) else: self.ivcheck = im_axis_fine check = pade.C(self.ivcheck * 1j, 1j * self.im_axis, self.im_data, self.a) return check
def check(self,show_plot=False): # As a check, look if Pade approximant smoothly interpolates the original data self.ivcheck=np.linspace(0,2*np.max(self.im_axis),num=500) self.check=pade.C(self.ivcheck*1j,1j*self.im_axis,self.im_data,self.a) if show_plot: f1=plt.figure() plt.plot(ivpade,siwpade.real,marker='*',linestyle='None') plt.plot(ivpade,siwpade.imag,marker='*',linestyle='None') plt.plot(ivcheck,check.real) plt.plot(ivcheck,check.imag) f1.show()
def solve(self,show_plot=False): # Compute the Pade approximation on the real axis self.result=pade.C(self.re_axis,1j*self.im_axis,self.im_data,self.a) if show_plot: f2=plt.figure(2) plt.plot(zr.real,result.real) plt.plot(zr.real,result.imag) f2.show() # Compute the integral of the imaginary part #self.norm=-np.trapz(self.result.imag,self.re_axis)/np.pi #print 'norm: ',self.norm return self.result
def check(self, show_plot=False): # As a check, look if Pade approximant smoothly interpolates the original data self.ivcheck = np.linspace(0, 2 * np.max(self.im_axis), num=500) self.check = pade.C(self.ivcheck * 1j, 1j * self.im_axis, self.im_data, self.a) return self.check
def solve(self, show_plot=False): # Compute the Pade approximation on the real axis self.result = pade.C(self.re_axis, 1j * self.im_axis, self.im_data, self.a) return self.result