1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//! Fit EXAFS spectra with sums of theoretical scattering paths.
//!
//! Start with [`FeffFit`], [`FeffFitDataset`], and [`Param`]. Inputs are already
//! background-subtracted χ(k), with k in Å⁻¹; this module does not normalize
//! raw absorption automatically. A path carries fixed FEFF amplitudes/phases
//! and adjustable amplitude, energy, distance, and disorder terms. A fit
//! evaluates expressions, sums enabled paths, transforms data and model into
//! the selected [`FitSpace`], and minimizes their scaled squared discrepancy.
//!
//! [`FeffFitTransform`] documents numerical defaults; choose measured k and
//! physically justified R ranges instead of assuming those defaults suit every
//! sample. Joint fits share named variables across datasets; independent fits
//! start each dataset from the same copied initial variables. Repeated k-weights
//! and zero padding do not add independent information.
//!
//! [`FeffFitResult`] reports local covariance and numerical termination, not
//! proof that a structural model is unique. See the
//! [fit-statistics guide](https://rexafs.com/docs/science/fitting-statistics/)
//! for the implemented scaling and assumptions. For scattering theory see
//! [Rehr and Albers (2000)](https://doi.org/10.1103/RevModPhys.72.621);
//! [Larch's path reference](https://xraypy.github.io/xraylarch/xafs_feffpaths.html)
//! explains the related path-parameter convention.
/// Convenience builder for prepared spectra, paths, and shared fit parameters.
/// Typed errors from model evaluation, fitting, files, and scattering backends.
/// Mathematical expressions used to constrain path and fit parameters.
/// Parsing of supported FEFF path columns, metadata, and atom geometry.
/// Backend execution and collection of generated scattering-path files.
/// Joint and independent nonlinear least-squares fits and result statistics.
/// Weighted k/R/q representations, noise divisors, and fit residuals.
/// Configuration, path-parameter, backend, and fit-result data structures.
/// Named variable resolution, parameter vectors, and expression dependencies.
use DVector;
pub use FeffFit;
pub use FittingError;
pub use FF2ChiOutput;
pub use ;
pub use ;
pub use ;
use crate;
/// Read a FEFF85L-format path file into owned arrays and geometry.
///
/// Use [`FeffFlavor::Feff85L`] for compatible files, including those produced
/// by the bundled FEFF10/ReFEFF runners. The `Feff10` parser flavor is currently
/// unsupported. File I/O, malformed data, or unsupported flavors return an error.
/// Read a path with file degeneracy, S₀² = 1, and all other corrections zero.
/// The returned model owns its data; see [`parse_feff_path_file`] for format errors.
/// Evaluate one path as dimensionless χ(k) on the supplied k grid in Å⁻¹.
///
/// Resolves variable expressions without modifying the path or variables.
/// Requires at least three finite k samples and valid FEFF arrays. Unresolved
/// expressions and invalid path data return an error. See [`path_model`] for
/// interpolation, low-k guards, and the first-sample extrapolation convention.
/// Sum enabled paths, returning total and individual dimensionless χ(k) arrays.
///
/// Uses the supplied grid in Å⁻¹ without applying k-weights or windows. Returns
/// an error when no paths are enabled or any enabled path fails evaluation.
/// Fit all datasets jointly with shared variable names and default solver options.
/// Inputs are borrowed and remain unchanged; the result owns fitted values/arrays.
/// See [`feffit_joint_with_options`] for interpretation and errors.
/// Minimize the concatenated, noise-scaled residuals of all datasets.
///
/// Variables with the same name are shared; use distinct names for local values.
/// Missing noise settings mean εk = 1, not automatic noise estimation. Invalid
/// data, transforms, expressions, paths, or unavailable solvers return errors.
/// An `Ok` result can still report nonconvergence: inspect `solver_report`.
/// Fit each dataset separately from copied initial variables and solver options.
/// Returns one success or failure per input dataset in input order. Parallel
/// execution changes scheduling, not parameter sharing or initialization.
/// Resolve backend commands without running a calculation.
/// Unsupported features or missing executables return an error.
/// Run the requested scattering backend in its workspace and collect output paths.
/// This writes input/output/log files and can launch external processes. Inspect
/// [`FeffRunRequest`] for backend, timeout, and artifact-retention settings.
/// Run a scattering calculation, then parse its path files into owned models.
/// Use [`FeffFlavor::Feff85L`] for the compatible files emitted by current runners.
/// Calculation, file I/O, or path-parse failures return an error.