erlab.analysis.fit.functions.general¶
Some general functions and utilities used in fitting.
Many functions are numba-compiled for speed.
Note
numba-compiled functions do not accept xarray objects. To broadcast over xarray
objects, use xarray.apply_ufunc().
Functions
|
Interpolation formula for temperature dependent BCS-like gap magnitude. |
|
Convolves |
|
|
|
Dynes formula for superconducting density of states. |
|
Fermi-dirac distribution. |
|
Resolution-broadened Fermi edge. |
|
Fermi-dirac edge with linear backgrounds above and below the Fermi level. |
|
Resolution-broadened Fermi edge with linear backgrounds. |
|
Gaussian parametrized with standard deviation and amplitude. |
|
Gaussian parametrized with FWHM and peak height. |
|
Lorentzian parametrized with HWHM and amplitude. |
|
Lorentzian parametrized with FWHM and peak height. |
|
General phenomenological self-energy for superconductors. |
|
Resolution-broadened superconducting spectral function. |
|
Step function convolved with a Gaussian. |
|
Resolution broadened step function with linear backgrounds. |
|
Resolution-broadened Tomonaga-Luttinger liquid (TLL) spectral function. |
|
Voigt profile. |
- erlab.analysis.fit.functions.general.bcs_gap(x, a=1.76, b=1.74, tc=100.0)[source]¶
Interpolation formula for temperature dependent BCS-like gap magnitude.
\[\Delta(T) \simeq a \cdot k_B T_c \cdot \tanh\left(b \sqrt{\frac{T_c}{T} - 1}\right)\]- Parameters:
x (
array-like) – The temperature values in kelvins at which to calculate the BCS gap.a (
float, default:1.76) – Proportionality constant. Default is 1.76.b (
float, default:1.74) – Proportionality constant. Default is 1.74.tc (
float, default:100.0) – The critical temperature in Kelvins. Default is 100.0.
- erlab.analysis.fit.functions.general.do_convolve(x, func, resolution, pad=7, oversample=3, **kwargs)[source]¶
Convolves
funcwith gaussian of FWHMresolutioninx.- Parameters:
x (
ndarray[tuple[Any,...],dtype[float64]]) – An evenly spaced 1D array specifying where to evaluate the convolution.func (
Callable) – Function to convolve.resolution (
float) – FWHM of the gaussian kernel.pad (
int, default:7) – Multiples of the standard deviation \(\sigma\) to pad with.oversample (
int, default:3) – Factor by which to oversamplexfor convolution to reduce numerical artifacts.**kwargs – Additional keyword arguments to
func.
- erlab.analysis.fit.functions.general.do_convolve_2d(x, y, func, resolution, pad=5, **kwargs)[source]¶
- erlab.analysis.fit.functions.general.dynes(x, n0=1.0, gamma=0.003, delta=0.01)[source]¶
Dynes formula for superconducting density of states.
The formula is given by [4]:
\[N_0 \text{Re}\left[\frac{|x| + i \Gamma}{\sqrt{(|x| + i \Gamma)^2 - \Delta^2}}\right]\]where \(x\) is the binding energy, \(N_0\) is the normal-state density of states at the Fermi level, \(\Gamma\) is the broadening term, and \(\Delta\) is the superconducting energy gap.
- Parameters:
x (
array-like) – The input array of energy in eV.n0 (default:
1.0) – \(N_0\), by default 1.0.gamma (default:
0.003) – \(\Gamma\), by default 0.003.delta (default:
0.01) – The superconducting energy gap \(\Delta\), by default 0.01.
- erlab.analysis.fit.functions.general.fermi_dirac(x, center, temp)[source]¶
Fermi-dirac distribution.
\[f(x) = \frac{1}{1 + e^{(x-x_0)/k_B T}}\]
- erlab.analysis.fit.functions.general.fermi_dirac_broad(x, center, temp, resolution)[source]¶
Resolution-broadened Fermi edge.
The Fermi edge is calculated as:
\[\frac{1}{1 + e^{(x-x_0)/k_B T}} \otimes \text{g}(\sigma)\]where \(\text{g}(\sigma)\) is a Gaussian kernel with standard deviation \(\sigma\). Note that the resolution is given in FWHM rather than the standard deviation.
- Parameters:
x (
ndarray[tuple[Any,...],dtype[float64]]) – The energy values at which to calculate the Fermi edge.center (
float) – The Fermi level.temp (
float) – The temperature in K.resolution (
float) – The resolution of the Gaussian kernel in eV. Note that this is the FWHM of the Gaussian kernel, not the standard deviation.
- erlab.analysis.fit.functions.general.fermi_dirac_linbkg(x, center, temp, back0, back1, dos0, dos1)[source]¶
Fermi-dirac edge with linear backgrounds above and below the Fermi level.
\[I(x) = b_0 + b_1 x + \frac{d_0 - b_0 + (d_1 - b_1) x} {1 + e^{(x-x_0)/k_B T}}\]- Parameters:
x (
ndarray[tuple[Any,...],dtype[float64]]) – The energy values at which to calculate the Fermi edge.center (
float) – The Fermi level.temp (
float) – The temperature in K.back0 (
float) – The constant background above the Fermi level.back1 (
float) – The slope of the background above the Fermi level.dos0 (
float) – The constant background below the Fermi level.dos1 (
float) – The slope of the background below the Fermi level.
Note
back0andback1corresponds to the linear background above and below EF (due to non-homogeneous detector efficiency or residual intensity on the phosphor screen during swept measurements), whiledos0anddos1corresponds to the linear density of states below EF including the linear background.
- erlab.analysis.fit.functions.general.fermi_dirac_linbkg_broad(x, center, temp, resolution, back0, back1, dos0, dos1)[source]¶
Resolution-broadened Fermi edge with linear backgrounds.
\[I(x) = \left[ b_0 + b_1 x + \frac{d_0 - b_0 + (d_1 - b_1) x} {1 + e^{(x-x_0)/k_B T}} \right] \otimes \text{g}(\sigma)\]
- erlab.analysis.fit.functions.general.gaussian(x, center, sigma, amplitude)[source]¶
Gaussian parametrized with standard deviation and amplitude.
\[G(x) = \frac{A}{\sqrt{2\pi\sigma^2}} \exp\left[-\frac{(x-x_0)^2}{2\sigma^2}\right]\]
- erlab.analysis.fit.functions.general.gaussian_wh(x, center=0.0, width=1.0, height=1.0)[source]¶
Gaussian parametrized with FWHM and peak height.
\[G(x) = h \exp\left[-\frac{16 \log{2} (x-x_0)^2}{w^2}\right]\]Note
\(\sigma=\frac{w}{2\sqrt{2\log{2}}}\)
- erlab.analysis.fit.functions.general.lorentzian(x, center, gamma, amplitude)[source]¶
Lorentzian parametrized with HWHM and amplitude.
\[L(x) = \frac{A}{\pi\gamma\left[1 + \left(\frac{x-x_0}{\gamma}\right)^2\right]}\]
- erlab.analysis.fit.functions.general.lorentzian_wh(x, center=0.0, width=1.0, height=1.0)[source]¶
Lorentzian parametrized with FWHM and peak height.
\[L(x) = \frac{h}{1 + 4\left(\frac{x-x_0}{w}\right)^2}\]Note
\(\sigma=w/2\)
- erlab.analysis.fit.functions.general.sc_self_energy(x, gamma1=1e-5, gamma0=0.0, delta=0.0)[source]¶
General phenomenological self-energy for superconductors.
The function is given by [5]:
\[\Sigma(x) = -i \Gamma_1 + \frac{\Delta^2}{x + i \Gamma_0}\]where \(\Gamma_1\) is the single-particle scattering rate, \(\Gamma_0\) is the pair-breaking rate, and \(\Delta\) is the energy gap.
- Parameters:
x (
array-like) – The input array of energy in eV.gamma1 (default:
1e-5) – \(\Gamma_1\), the single-particle scattering rate.gamma0 (default:
0.0) – \(\Gamma_0\), the pair-breaking scattering rate.delta (default:
0.0) – The energy gap \(\Delta\).
- erlab.analysis.fit.functions.general.sc_spectral_function(x, amp=1.0, gamma1=1e-05, gamma0=0.0, delta=0.0, lin_bkg=0.0, const_bkg=0.0, resolution=0.01)[source]¶
Resolution-broadened superconducting spectral function.
The superconducting spectral function with a linear background is calculated as:
\[I(x) = \left[ A \cdot A_{sc}(x, \Sigma) + \left(m \cdot |x| + b \right) \right] \otimes \text{g}(\sigma)\]where \(A_{sc}(x, \Sigma)\) is the superconducting spectral function calculated using the self-energy \(\Sigma(x)\) given by
sc_self_energy(). \(\text{g}(\sigma)\) is a Gaussian kernel with standard deviation \(\sigma\). Note that the resolution parameter is the FWHM of the Gaussian kernel, not the standard deviation.- Parameters:
x (
array-like) – The input array of energy in eV.amp (
float, default:1.0) – The overall scale factor \(A\).gamma1 (
float, default:1e-05) – \(\Gamma_1\), the single-particle scattering rate.gamma0 (
float, default:0.0) – \(\Gamma_0\), the pair-breaking scattering rate.delta (
float, default:0.0) – The energy gap \(\Delta\).lin_bkg (
float, default:0.0) – The slope of the linear background \(m\).const_bkg (
float, default:0.0) – The constant background \(b\).resolution (
float, default:0.01) – The broadening in eV. Note that this is the FWHM of the Gaussian kernel, not the standard deviation.
- erlab.analysis.fit.functions.general.step_broad(x, center=0.0, sigma=1.0, amplitude=1.0)[source]¶
Step function convolved with a Gaussian.
The broadened step function is calculated as:
\[\frac{A}{2}\cdot\text{erfc}\left(\frac{x - x_0}{\sqrt{2\sigma^2}}\right)\]where \(\text{erfc}\) is the complementary error function.
- erlab.analysis.fit.functions.general.step_linbkg_broad(x, center, sigma, back0, back1, dos0, dos1)[source]¶
Resolution broadened step function with linear backgrounds.
- erlab.analysis.fit.functions.general.tll(x, amp=1.0, center=0.0, alpha=0.1, temp=10.0, resolution=0.01, const_bkg=0.0)[source]¶
Resolution-broadened Tomonaga-Luttinger liquid (TLL) spectral function.
The TLL spectral function is calculated as [6]:
\[I(x,T) = \left[A T^\alpha \cosh\left(\frac{\epsilon}{2}\right) \left|\Gamma\left(\frac{1 + \alpha}{2} + i \frac{\epsilon}{2\pi}\right)\right|^2 f(\epsilon,T)\right] \otimes \text{g}(\sigma) + B\]where \(\epsilon=(x - x_0)/k_B T\) is the temperature-normalized energy, \(\Gamma\) is the gamma function, \(f(\epsilon,T) = 1/(e^{\epsilon}+1)\) is the Fermi-Dirac distribution, \(\text{g}(\sigma)\) is a Gaussian kernel with standard deviation \(\sigma\), and \(B\) is a constant background.
Note that the resolution parameter is the FWHM of the Gaussian kernel, not the standard deviation.
- Parameters:
x (
ndarray[tuple[Any,...],dtype[float64]]) – The energy values at which to calculate the TLL spectral function.amp (
float, default:1.0) – The amplitude.center (
float, default:0.0) – The center.alpha (
float, default:0.1) – The power law exponent.temp (
float, default:10.0) – The temperature in K.resolution (
float, default:0.01) – The resolution of the Gaussian kernel in eV. Note that this is the FWHM of the Gaussian kernel, not the standard deviation.const_bkg (
float, default:0.0) – A constant background to add to the broadened TLL function.
- erlab.analysis.fit.functions.general.voigt(x, center=0.0, sigma=0.0, gamma=0.5, amplitude=1.0)[source]¶
Voigt profile.
The Voigt profile can be expressed as:
\[V(x) = A \frac{\text{Re}[w(z)]}{\sigma \sqrt{2\pi}}, \quad z = \frac{x - x_0 + i \gamma}{\sigma \sqrt{2}}\]where \(w(z)\) is the Faddeeva function. This implementation uses
scipy.special.voigt_profile()to compute the Voigt profile.