XASproc JavaScript Library
- XASproc is a web-based JavaScript library for performing X-ray absorption spectroscopy analysis, offering routines for normalization, background subtraction, and EXAFS extraction.
- The library leverages advanced mathematical algorithms like polynomial fitting and Fourier transforms to ensure precise, interactive spectral processing.
- Its integration with the XASVue viewer on XASDB promotes FAIR data principles by standardizing protocols and facilitating collaborative research.
The XASproc JavaScript Library is a web-based module developed as a core analytical engine for the XASDB platform. Designed to process X-ray absorption spectroscopy (XAS) data entirely within the browser, XASproc delivers advanced routines previously reserved for specialized desktop environments. The library is tightly integrated with the XASVue viewer on the Canadian Light Source’s XASDB, enabling normalization, background subtraction, extended X-ray absorption fine structure (EXAFS) extraction, and preliminary spectral analysis, with immediate graphical feedback and broad accessibility. By implementing rigorous mathematical algorithms and adhering to standardized analytical protocols, XASproc serves both collaborative research and educational initiatives, promoting FAIR (Findable, Accessible, Interoperable, Reusable) data principles within the synchrotron user community (Spasyuk, 16 Sep 2025).
1. Functional Overview
XASproc automates the core tasks required for XAS spectrum pre-processing and EXAFS analysis:
- Data Ingestion: The library identifies and reads relevant intensity channels (I₀ for incident, Iₜ for transmitted, I_f for fluorescence) based on the measurement mode, enabling universal support across transmission, fluorescence, and total electron yield (TEY) datasets.
- Normalization: For transmission measurements, XASproc applies the Beer–Lambert law,
where is sample thickness. In fluorescence mode, the proportionality is used. Pre-edge fitting (linear function ), edge-step determination (), and post-edge background (polynomial or spline ) yield a normalized attenuation coefficient:
- Background Subtraction: Two methods are implemented: cubic smoothing spline, with the number of control points , and adaptive weighted polynomial fitting, both applied for optimal isolation of oscillatory EXAFS signal.
- EXAFS Extraction: After background correction, the EXAFS function is calculated as
with energy-axis transformation to wavevector and k-weighting (e.g., ) for enhanced signal selection.
- Fourier Transform and Windowing: Numerical Fourier transform (Riemann sum) from -space to -space,
is supported; Hanning and Kaiser window functions are available for artifact minimization, including cosine tapering and modified Bessel weighting.
Quality control is provided via the Background Quality Score (BQS), itself a composite of weighted k³ mean offset, slope, symmetry, and variance metrics.
2. Analytical Algorithms and Mathematical Formulation
The library’s major computational routines are implemented in Vanilla JavaScript, eschewing third-party frameworks for performance and portability. Key routines include:
- Polynomial and Spline Fitting: Used for pre/post-edge baseline correction and background removal, with user-adjustable parameters through the graphical interface. Spline control-point estimation is governed by the modified Newville expression for , balancing overfitting and underfitting in EXAFS extraction.
- Savitzky–Golay Smoothing: Applied for enhanced signal-to-noise ratio prior to further transformation.
- Energy-Wavevector Conversion: Nonlinear transformation supports the requirements of EXAFS theory.
- Fourier Transformation: Performed numerically with explicit windowing for R-space signal analysis.
- Window Functions: Hanning window
for , and Kaiser window (modified Bessel form) for optimal k-space selection.
Each algorithm and parameterization is presented to the user within XASVue, with direct plotting of normalized spectra, background fits, , and for interactive review.
3. Comparison to Traditional Desktop Tools
Historically, XAS data processing has required specialized desktop environments including Athena, Larch, and EXAFSPAK, with separate utilities for data conversion and spectral visualization. XASproc introduces several key differences:
Feature | Traditional Desktop | XASproc Browser-based |
---|---|---|
Installation | Required | None (runs in browser) |
OS Compatibility | Limited | Universal (via JS) |
User Interactivity | Moderate | Real-time, interactive GUI |
Visualization | External tools needed | Integrated (XASVue) |
Data Accessibility | Local only | Web, database-integrated |
A plausible implication is that XASproc democratizes access to high-quality analytical routines and broadens the user base beyond institutions with pre-existing infrastructure (Spasyuk, 16 Sep 2025).
4. Integration and Modular Design
XASproc’s architecture supports seamless integration with the XASDB platform and the XASVue viewer:
- Automated Workflow: Spectra loaded in XASVue are processed through XASproc analytics, with immediate overlays of background, normalized, and extracted EXAFS signals.
- Export Capabilities: Data can be exported in native beamline formats as well as the XDI (X-ray Data Interchange) standard, supporting downstream use in linear combination fitting (LCF), machine learning workflows, and educational settings.
- Parameter Control: Users can tune polynomial orders, spline knot counts, window ranges, and weighting factors dynamically, with all changes reflected in real-time spectral plots.
This modular approach strengthens collaborative research, as analysis protocols and output are standardized across users and sites.
5. Impact on FAIR Data Principles and Collaborative Research
XASproc contributes to the dissemination of FAIR data practices by:
- Findability and Accessibility: As part of XASDB, all processed data, provenance information, and metadata are inherently discoverable and accessible online.
- Interoperability: Data conform to XDI and open-access licensing (CC BY 4.0), permitting cross-platform and cross-software compatibility.
- Reusability: The standardized protocols and export routines facilitate wide reuse for further analysis, educational modules, and machine learning efforts.
- Collaborative Engagement: Browser-based, installation-free access allows global user groups to analyze and share XAS data immediately, eliminating barriers related to platform dependence or software licensing. This suggests a measurable improvement in reproducibility and protocol harmonization for the synchrotron community (Spasyuk, 16 Sep 2025).
6. Significance and Limitations
The XASproc JavaScript library encapsulates robust and well-established XAS analysis methodologies within a format accessible to a broad technical audience. Its integration within XASVue provides real-time, interactive exploration of normalization, background subtraction, and EXAFS analysis, offering parity with traditional desktop tools in a web environment. By adhering to open data principles, it fosters collaborative research and participation in data-driven material science, chemistry, environmental research, and biology.
This suggests that while XASproc rivals desktop software in functionality, limits imposed by client-side execution, simplified physical models, and finite Hilbert space representations may constrain ultra-high-precision applications. Nevertheless, its modular, transparent workflow and standardized output support reproducible research and pedagogical utility across domains.