gftool.basis.pole.PoleFct.from_z
- classmethod PoleFct.from_z(z, gf_z, n_pole, moments=(), width=1.0, weight=None)[source]
Generate instance fitting
gf_z
.This function is only meaningful away from the real axis. Finds poles and weights for a pole Green’s function matching the given Green’s function
gf_z
.Note that for an odd number of moments, the central pole is at z = 0, so the causal Green’s function g(0) diverges.
- Parameters:
- z(…, N_z) complex np.ndarray
Frequencies at which
gf_z
is given. Mind that the fit is only meaningful away from the real axis.- gf_z(…, N_z) complex np.ndarray
Causal Green’s function which is fitted.
- n_poleint
Number of poles to fit.
- moments(…, N) float array_like
Moments of the high-frequency expansion, where G(z) = moments / z**np.arange(N) for large z.
- widthfloat, optional
Distance of the largest pole to the origin (default: 1.0).
- weight(…, N_z) float np.ndarray, optional
Weighting of the fit. If an error σ of the input
gf_z
is known, this should be weight=1/σ. If high-frequency moments should be fitted correctly, width=abs(z)**(N+1) is a good fit.
- Returns:
- PoleFct
Instance with (N) poles at the Chebyshev nodes for degree N and (…, N) residues such that the pole function fits
gf_z
.
- Raises:
- ValueError
If more moments are given than poles are fitted (len(moments) > n_pole).
See also
Notes
We employ the similarity of the relation betweens the
moments
and the poles and residues with polynomials and the Vandermond matrix. The poles are chooses as Chebyshev nodes, the residues are calculated accordingly.