Deborah.Miriam.Interpolation
Deborah.Miriam.Interpolation.abs_soft — Methodabs_soft(s; eps=1e-12) -> typeof(s)Compute a stabilized absolute value of s using a soft approximation.
Arguments
s: Input scalar value.eps::Real=1e-12: Small positive constant added to maintain smoothness and avoid non-differentiability at $s = 0$.
Returns
Float64: Approximate absolute value, defined as $\sqrt{s^2 + \varepsilon^2}$.
Notes
- Useful in skewness folding or optimization contexts where a differentiable approximation to $\left|s\right|$ is required.
Deborah.Miriam.Interpolation.argmin_by_distance_to_center — Methodargmin_by_distance_to_center(
x::AbstractVector,
idxs::Vector{Int}
) -> IntPick the index from idxs whose $x$-coordinate is closest to the midpoint of the overall domain.
Arguments
x::AbstractVector: Monotonic $x$-coordinate values.idxs::Vector{Int}: Candidate indices.
Returns
Int: Index fromidxsthat minimizes $\left| x_i - x_{\text{center}} \right|$.
Deborah.Miriam.Interpolation.find_transition_cumulants — Methodfind_transition_cumulants(
cumulants_all::Vector{Vector{Vector{T}}},
kappa::Vector{T},
target_index::Int, # 2: sus, 3: skew, 4: kurt
avg_win_L::Int, avg_win_R::Int, # hard guard window from pre-probe
avg_ext_cand::Int, # seed index from pre-probe
jobid::Union{Nothing,String}=nothing
) where T -> Vector{Vector{T}}Refine the transition point per bootstrap resample using only the region within the provided guard window [avg_win_L, avg_win_R] and scanning outward from the seed avg_ext_cand:
- For each resample
b, build the target curve for the chosen observable (target_index:2=susp,3=skew,4=kurt). - Scan left from the seed up to
avg_win_Land right up toavg_win_R, stopping at the first encountered local extremum that matches the mode. (Skewness uses a local minimum ofabs(y).) - Choose one of the found extremes (prefer near the seed), and perform a 3-point local quadratic fit using its immediate neighbors
(i-1,i,i+1). - Extract $\kappa_T$:
- skewness: the nearest real root of the quadratic to the center point
- susceptibility/kurtosis: vertex $\kappa^{\ast} = - \dfrac{c_1}{2 \, c_2}$
- Interpolate all five observables at $\kappa_T$ via their own local quadratic fits re-using the same $\kappa$-triplet.
- If a valid 3-point neighborhood cannot be formed (e.g., candidate at boundary), try the other side candidate; if still impossible, mark this resample as boundary failure and return
NaNs for it.
Returns
vec_valids::Vector{Vector{T}}of length 6:[κ_T, cond(κ_T), sus(κ_T), skew(κ_T), kurt(κ_T), binder(κ_T)], each with NaNs removed across resamples.
Deborah.Miriam.Interpolation.first_extremum_from_seed — Methodfirst_extremum_from_seed(
y::AbstractVector,
mode::Symbol,
seed::Int,
L::Int,
R::Int,
dir::Int
) -> Union{Int,Nothing}Scan from seed toward dir (dir = -1 for left, +1 for right) within the hard-guard window [L, R], and return the first index i that matches the shape required by mode:
- :susp → local maximum (
is_local_max) - :skew → local minimum of $\left|y\right|$ (
is_local_min_abs) - :kurt → local minimum (
is_local_min)
If no such interior index exists in the scan range, return nothing.
Notes
- Index must have neighbors:
2$\le$i$\le$length(y)-1. - The scan never steps outside
[L, R].
Deborah.Miriam.Interpolation.is_local_max — Methodis_local_max(y, i) -> BoolCheck if the element at index i is a strict local maximum.
Arguments
y: Vector of numerical values.i: Index to test (must satisfy2$\le$i$\le$length(y)-1).
Returns
Bool:trueify[i]is strictly greater than both neighbors, otherwisefalse.
Deborah.Miriam.Interpolation.is_local_min — Methodis_local_min(y, i) -> BoolCheck if the element at index i is a strict local minimum.
Arguments
y: Vector of numerical values.i: Index to test (must satisfy2$\le$i$\le$length(y)-1).
Returns
Bool:trueify[i]is strictly smaller than both neighbors, otherwisefalse.
Deborah.Miriam.Interpolation.is_local_min_abs — Methodis_local_min_abs(y, i) -> BoolCheck whether the element at index i is a strict local minimum with respect to the soft absolute values of its neighbors.
Arguments
y: Vector of numerical values.i: Index to test (must satisfy2$\le$i$\le$length(y)-1).
Returns
Bool:trueif|y[i]|(softened) is strictly smaller than both neighbors, otherwisefalse.
Notes
- Uses
abs_softto stabilize near-zero values. - Primarily used in skewness detection, where folding is applied.
Deborah.Miriam.Interpolation.pick_best_candidate — Methodpick_best_candidate(
iLcand::Union{Int,Nothing},
iRcand::Union{Int,Nothing},
x::AbstractVector,
seed::Int;
prefer::String="near",
mode::Symbol=:susp,
y::Union{Nothing,AbstractVector}=nothing,
lambda::Real=0.0
) -> Union{Int, Nothing}Choose between left/right candidate indices.
prefer="near": pick the one closer (in $x$) to the seed.prefer="objective"::susp→ larger $y$ is better:skew→ smaller $\left|y\right|$ is better:kurt→ smaller $y$ is better
prefer="hybrid": combine objective with distance penalty controlled bylambda::susp→ maximize $y_i - \lambda \, \left| x_i - x_{\text{seed}} \right|$:skew→ minimize $\left|y_i\right| + \lambda \, \left| x_i - x_{\text{seed}} \right|$:kurt→ minimize $y_i + \lambda \, \left| x_i - x_{\text{seed}} \right|$
Returns nothing if both inputs are nothing.
Deborah.Miriam.Interpolation.preprobe_discrete — Methodpreprobe_discrete(
x::AbstractVector,
y::AbstractVector;
mode::String,
seed_strategy::Symbol=:center
) -> (Int, Int, Int)Perform a pre-probing step using average values.
Modes
"susp"→ susceptibility: choose a discrete maximum."skew"→ skewness: choose a discrete minimum of $\left|y\right|$."kurt"→ kurtosis: choose a discrete minimum.
Seed strategies
:center(default): choose the local extremum closest to the center of $x$.:global: ignore local structure and directly choose the global extremum (global $\max$ for"susp", global $\min \, \left|y\right|$ for"skew", global $\min$ for"kurt").
Arguments
x::AbstractVector: $\kappa$ grid (trajectory points).y::AbstractVector: target values on $x$ (one cumulant curve).mode::String:"susp" | "skew" | "kurt".seed_strategy::Symbol::centeror:global.
Returns
(L, R, i_star):L::Int: Left guard index (nearest extremum to the left ofi_star, or1if none).R::Int: Right guard index (nearest extremum to the right ofi_star, ornif none).i_star::Int: Seed index chosen according to the mode and strategy.
Deborah.Miriam.Interpolation.preprobe_discrete_from_bundle — Methodpreprobe_discrete_from_bundle(
x::AbstractVector,
cumulants_avg::Vector{<:AbstractVector};
mode::Symbol
) -> (Int, Int, Int, Int)Dispatch pre-probing to the appropriate cumulant component based on mode, assuming the bundle layout:
- $j=1$: chiral condensate,
- $j=2$: susceptibility,
- $j=3$: skewness,
- $j=4$: kurtosis,
- $j=5$: Binder.
Arguments
x: $\kappa$ grid.cumulants_avg: length-5 vector of average-only curves (eachlength = length(x)).mode::susp|:skew|:kurt.
Returns
(L, R, i_star, j_used):L, R, i_staras inpreprobe_discrete.j_usedis the selected component index (2for:susp,3for:skew,4for:kurt).
Deborah.Miriam.Interpolation.seed_extremum_if_ok — Methodseed_extremum_if_ok(
y::AbstractVector,
mode::Symbol,
seed::Int,
L::Int,
R::Int
) -> Union{Int, Nothing}Check whether the candidate index seed is a valid local extremum within the specified range and return it if so.
Arguments
y::AbstractVector: Sequence of numerical values.mode::Symbol: Extremum type to check. Accepted values::susp→ local maximum (susceptibility peak),:skew→ local minimum of folded absolute values (skewness),- otherwise → local minimum.
seed::Int: Candidate index to test.L::Int: Left boundary (inclusive).R::Int: Right boundary (inclusive).
Returns
Int:seedindex if it is a valid extremum.Nothing: if the check fails or the index is out of range.
Notes
- Index must satisfy
2$\le$seed$\le$length(y)-1to allow left/right neighbor checks.
Deborah.Miriam.Interpolation.solve_quad — Methodsolve_quad(
x::NTuple{3,T},
y::NTuple{3,T}
) -> NTuple{3,T}Solve for quadratic coefficients c = (c0,c1,c2) such that $y \approx c_0 + c_1 \, x + c_2 \, x^2$ through the 3 points (k[i], y[i]).
Notes:
- Caller is responsible for ensuring $x$ are distinct and well-conditioned.