xraytsubaki is a Rust-based program that implements the core functionalities of xraylarch. The primary aim of this project is to expedite the processing of extensive XAS data sets. The project's name, xraytsubaki, draws inspiration from tsubaki.
Currently the main source code is placed under ./crates/xraytsubaki/.
The desktop app lives in xraytsubaki-app/.
Recommended dev flow:
cd xraytsubaki-app
bun install
bun run tauri:devNotes:
- The Tauri/Vite dev server uses
http://localhost:1420with strict port binding. - If port
1420is already used, stop the previous dev process before rerunning.
npm fallback (if Bun is unavailable):
cd xraytsubaki-app
npm install
npm run tauri -- devThe inception of this project was triggered when I needed to process over 1000 spectra from in-situ measurements. The data loading and processing in xraylarch were too time-consuming, not to mention also for demeter. The goal was to develop a tool capable of processing data within a reasonable timeframe. While this project does not seek to replace xraylarch, it does aim to provide a phenomenally fast core API for xraylarch's backend to augment its capacity.
Additionally, this project seeks to leverage Rust's ecosystem to create a generalized library compatible with other languages such as Python and Javascript. This will facilitate a shift away from exclusive Python-based analysis. Essentially, this library can be integrated into native GUI applications using modern frameworks like tauri.
- Standard EXAFS analysis (find_e0, preedge postedge normalization, AUTOBK, FFT, IFFT)
- Parallel processing using Rayon. (For example, M1 Macbook Pro with 10 cores can process 10000 spectra in 7.5 seconds, which is ~x10 enhancement without parallelization. Numpy + xraylarch takes 145 seconds.)
- Optimization on AUTOBK. The AUTOBK process were optimized with providing an analytical Jacobian to speed up the minimization process by Leverberg-Marquardt algorithm.
- EXAFS helper funtions (rebinning and more)
- Develop a Python wrapper for the library. (TODO: py-xraytsubaki)
- Create a GUI application using Dioxus. (TODO: xraytsubaki-gui)
- Develop a web assembly version of the library for web application usage.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
xraytsubaki now supports feature-gated core plotting via ruviz.
cargo run -p xraytsubaki --features plotting --example plot_demoplot_demo output path:
crates/xraytsubaki/target/plot_demo
Current demo inputs:
- FEFF calculation materials (
feff.inp):Co,FeO_withPb,MnO2,ZnSe - Fit materials (
FeffFit::fit()):Cu,ZnSe
Regenerate the Cu/ZnSe XrayLarch fit references:
uv run --with xraylarch python crates/xraytsubaki/scripts/generate_larch_fit_references.pyPlotting APIs use a mutable entrypoint (plot(&mut self)) so missing intermediates can be auto-computed and cached (normalize, calc_background, fft) when panel selection requires them.
Current defaults:
mu()renders flattenedmu(E)(auto-normalized).k()applies symmetric y-limits and k-weight-aware units in the y-axis label.FeffFitResult::plot().k()uses the fit/datasetkweightby default.r()usesxlim(0.0, 6.0)by default.- Plot text is rendered with
typst(true)for scientific notation-friendly output. r()plots magnitude by default; use.real()/.imag()for components, and.mag().real().imag()for all traces.- Window overlays are off by default.
window(true)onk()is an alias that enables bothwindow_fn(true)andwindow_box(true).window_fn(...)is k-space only;window_box(...)supports k-space and fit r-space and draws two range lines (min/max).
For this phase, multi-panel export is PNG-focused.