multi_edge_fit_functions¶
MultiEdgeFit Functions
Based on VirtualBeamline by Mario Delgado Jaime
background_three_region(energy, m1, m2, m3, t1, t2, e_ref, intercept)
¶
Evaluate the three-region empirical background model.
MATLAB source: Background.m, MATLAB function Background(x, Type, varargin)
for Type == 1.
The original MATLAB code obtains y_ref by loading temp_VBL.mat and sampling the
active data set at ERef. This Python replacement removes the hidden file dependency:
callers pass y_ref explicitly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
energy
|
ArrayLike
|
energy array |
required |
m1
|
float
|
pre-l3-edge gradient |
required |
m2
|
float
|
mid-l3-l2-edge gradient |
required |
m3
|
float
|
post-l2-edge gradient |
required |
t1
|
float
|
l3 edge energy |
required |
t2
|
float
|
l2 edge energy |
required |
e_ref
|
float
|
energy shift |
required |
intercept
|
float
|
initial level of the background |
required |
Source code in mmg_toolbox/xas/multi_edge_fit_functions.py
double_l_edge(energy, intensity_l3, e0_l3, spin_orbit_2p, gaussian_fraction, width_l3, width_l2, l2_intensity_ratio=0.5, l2_energy_factor=1.5)
¶
Evaluate the double L3/L2 edge jump used by the VirtualBeamline model.
MATLAB source: expression strings in VBL.m and VirtualBL.m, composed from
Edge.m / MATLAB function Edge.
The MATLAB code repeatedly constructs expressions of the form::
Edge(x, Int1, E0, Gauss, L3) + Edge(x, Int1/2, E0 + 1.5*SOC, Gauss, L2)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
energy
|
ArrayLike
|
array of energies in eV |
required |
intensity_l3
|
float
|
edge jump at the L3 edge (typically ⅔ of total jump) |
required |
e0_l3
|
float
|
energy in eV of L3 edge |
required |
spin_orbit_2p
|
float
|
Spin-orbit coupling energy defining difference between L3 and L2 edge |
required |
gaussian_fraction
|
float
|
Fraction of pVoight edge step that is gaussian |
required |
width_l3
|
float
|
Width of edge step function at L3 edge |
required |
width_l2
|
float
|
Width of edge step function at L2 edge |
required |
l2_intensity_ratio
|
float
|
ratio L2 edge to L3 edge step |
0.5
|
l2_energy_factor
|
float
|
multiplier for SOC in energy difference for L2 edge |
1.5
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
array of double L edge function |
Source code in mmg_toolbox/xas/multi_edge_fit_functions.py
edge_step(x, intensity, centre, gaussian_fraction, width)
¶
Evaluate the empirical cumulative edge-step function.
MATLAB source: Edge.m, MATLAB function Edge(X, I1, O1, G1, W1).
The MATLAB function is::
E = I1*((1-G1)*(1/pi*atan((X-O1)/W1)+1/2) ...
+ G1/2*(1+erf((X-O1)/(W1/(sqrt(2*log(2)))*sqrt(2)))))
Parameters¶
x:
Energy axis.
intensity:
Edge intensity, corresponding to I1 in MATLAB.
centre:
Edge inflection/centre energy, corresponding to O1 in MATLAB.
gaussian_fraction:
Fraction of the cumulative Gaussian contribution, corresponding to G1.
A value of 0 gives the arctangent form; a value of 1 gives the error-function form.
width:
Half-width parameter, corresponding to W1 in MATLAB.
Returns¶
numpy.ndarray
Edge-step contribution evaluated on x.