erlab.analysis.fit.functions¶
Various functions used in fitting.
Modules¶
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 above and below EF. |
|
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. |
|
Step function convolved with a Gaussian. |
|
Resolution broadened step function with linear backgrounds. |
Classes
|
|
|
Multiple peaks with optional Fermi-Dirac distribution and background. |
|
A callable class for a arbitrary degree polynomial. |
- class erlab.analysis.fit.functions.FermiEdge2dFunction(degree=1)[source]¶
Bases:
DynamicFunction
- class erlab.analysis.fit.functions.MultiPeakFunction(npeaks, peak_shapes=None, *, fd=True, background='linear', degree=2, convolve=True, segmented=False)[source]¶
Bases:
DynamicFunctionMultiple peaks with optional Fermi-Dirac distribution and background.
- Parameters:
npeaks (
int) – The number of peaks to fit.peak_shapes (
list[str] |str|None, default:None) – The shape(s) of the peaks in the model. If a list of strings is provided, each string represents the shape of a peak. If a single string is provided, it will be split by spaces to create a list of peak shapes. If not provided, the default peak shape will be used for all peaks.fd (
bool, default:True) – Flag indicating whether the model should be multiplied by the Fermi-Dirac distribution. This adds three parameters to the model:efermi,temp, andoffset, each corresponding to the Fermi level, temperature in K, and constant background.background (
Literal['constant','linear','polynomial','none'], default:"linear") –The type of background to include in the model. Possible values are:
Value
Additional parameters
’none’
None
’constant’
const_bkg’linear’
lin_bkg,const_bkg’polynomial’
c0,c1, … depending ondegreedegree (
int, default:2) – The degree of the polynomial background. Only used ifbackgroundis'polynomial'. Default is 2.convolve (
bool, default:True) – Flag indicating whether the model should be convolved with a gaussian kernel. IfTrue, adds aresolutionparameter to the model, corresponding to the FWHM of the gaussian kernel.segmented (
bool, default:False) – Flag indicating whether to convolve the model in segments. IfTrue, the model will be convolved in segments of uniform spacing. This must be set toTruewhen fitting data with large gaps or discontinuities in the x-axis.
- class erlab.analysis.fit.functions.PolynomialFunction(degree=1)[source]¶
Bases:
DynamicFunctionA callable class for a arbitrary degree polynomial.
- Parameters:
degree (
int, default:1) – The degree of the polynomial.
- erlab.analysis.fit.functions.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.do_convolve(x, func, resolution, pad=5, **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:5) – Multiples of the standard deviation \(\sigma\) to pad with.**kwargs – Additional keyword arguments to
func.
- erlab.analysis.fit.functions.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.fermi_dirac(x, center, temp)[source]¶
Fermi-dirac distribution.
\[\frac{1}{1 + e^{(x-x_0)/k_B T}}\]
- erlab.analysis.fit.functions.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.fermi_dirac_linbkg(x, center, temp, back0, back1, dos0, dos1)[source]¶
Fermi-dirac edge with linear backgrounds above and below the fermi level.
- 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.fermi_dirac_linbkg_broad(x, center, temp, resolution, back0, back1, dos0, dos1)[source]¶
Resolution-broadened Fermi edge with linear backgrounds above and below EF.
- erlab.analysis.fit.functions.gaussian(x, center, sigma, amplitude)[source]¶
Gaussian parametrized with standard deviation and amplitude.
\[\frac{A}{\sqrt{2\pi\sigma^2}} \exp\left[-\frac{(x-x_0)^2}{2\sigma^2}\right]\]
- erlab.analysis.fit.functions.gaussian_wh(x, center, width, height)[source]¶
Gaussian parametrized with FWHM and peak height.
Note
\(\sigma=\frac{w}{2\sqrt{2\log{2}}}\)
- erlab.analysis.fit.functions.lorentzian(x, center, sigma, amplitude)[source]¶
Lorentzian parametrized with HWHM and amplitude.
\[\frac{A}{\pi\sigma\left[1 + \left(\frac{x-x_0}{\sigma}\right)^2\right]}\]
- erlab.analysis.fit.functions.lorentzian_wh(x, center, width, height)[source]¶
Lorentzian parametrized with FWHM and peak height.
Note
\(\sigma=w/2\)
- erlab.analysis.fit.functions.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.