TAS-AI is a Python framework for autonomous neutron scattering experiments on triple-axis spectrometers. It combines Bayesian inference, physics-informed models, and active learning to optimize measurement strategies in real-time.
Developed at the NIST Center for Neutron Research (NCNR).
Traditional neutron scattering experiments require scientists to manually decide each measurement pointโa slow, labor-intensive process. TAS-AI automates this by:
- Learning from each measurement to decide what to measure next
- Using physics models to focus on informative regions
- Accounting for motor motion to minimize dead time
- Providing real-time visualization of the experiment
Result: 2-5ร faster experiments with fewer measurements.
- ๐ฏ Physics-Informed Acquisition: Uses spin wave models to guide measurements
- ๐ Model Discrimination: Bayesian comparison of competing Hamiltonians (e.g., NN vs J1-J2)
- ๐ Real-Time Dashboard: Live web visualization built with Dash
- โก Motor Motion Optimization: Minimizes dead time with intelligent path planning
- ๐งฎ MCMC Inference: Full Bayesian parameter estimation with BUMPS/emcee
- ๐ฌ Sunny-Inspired Models: Fast Python spin wave calculations
- ๐ Benchmark Suite: Compare against gpCAM, Log-GP, and grid methods
Mamba is significantly faster than conda for dependency resolution:
# Clone repository
git clone https://github.com/usnistgov/tasai.git
cd tasai
# Create environment with mamba (fast)
mamba env create -f environment.yml
mamba activate tasai
# Or with conda (slower)
conda env create -f environment.yml
conda activate tasaigit clone https://github.com/usnistgov/tasai.git
cd tasai
pip install -e ".[all]"Spin-wave dependency note: The optional
pyspinwbackend depends on SciPy's legacy Fortran wrappers that were removed in version 1.23. We therefore pinscipy>=1.8,<1.23in the core requirements. If your existing environment already pulled in a newer SciPy, create a fresh virtual environment before installing thespinwaveextra so the TAS-AI benchmark can exercise the SpinW backend instead of falling back to the analytic Sunny model.
# Build image
docker build -t tasai .
# Run dashboard (accessible at http://localhost:8050)
docker run -p 8050:8050 tasai micromamba run -n tasai python -m tasai.dashboard.app --host 0.0.0.0
# Run examples
docker run tasai micromamba run -n tasai python -m tasai.examples.example_parameter_determinationpython -c "import tasai; print('TAS-AI installed successfully!')"# Run dashboard demo (or use `tasai-dashboard`)
python -m tasai.dashboard.app --port 8050 --debug
# Run parameter estimation example
python -m tasai.examples.example_parameter_determination
# Run model discrimination example
python -m tasai.examples.example_model_discrimination
# Run order parameter example
python -m tasai.examples.order_parameter_simulationโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ TAS-AI Framework โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Dashboard โ โ Physics โ โ Inference โ โ
โ โ (Dash UI) โ โ Models โ โ (MCMC/Bayes) โ โ
โ โโโโโโโโฌโโโโโโโ โโโโโโโโฌโโโโโโโ โโโโโโโโโโโโฌโโโโโโโโโโโ โ
โ โ โ โ โ
โ โโโโโโโโผโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโ
โ โ Acquisition Function โโ
โ โ score = info_gain^ฮท / (count + move) โโ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ Instrument Interface โโ
โ โ (Simulator / HTTP Proxy / Direct Control) โโ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- User Manual - Complete guide for users
- Dashboard Guide - Dashboard features and controls
- Benchmarks - Performance comparisons
- Sunny Integration - Spin wave calculations
- API Reference - Developer documentation
| Example | Description |
|---|---|
tasai/examples/example_parameter_determination.py |
Determine J1, J2, D from spin wave data |
tasai/examples/example_model_discrimination.py |
Test if J2 interactions are needed |
tasai/examples/example_with_motor_motion.py |
Include motor motion in optimization |
tasai/examples/order_parameter_simulation.py |
Phase transition (Tc, ฮฒ) measurement |
tasai/examples/benchmark_jcns.py |
Compare against JCNS Log-GP method |
The closed-loop drivers that produce the manuscript figures (Figure 9 hybrid handoff, Figure 10 LLM-audited run, and the Section 5 audit ablations) live in the companion paper-tasai repository, not in this library. The library provides the physics backends (tasai.physics.SquareLatticeAFM, tasai.physics.SquareFMBilayer), acquisition, resolution, and MCTS modules that those drivers import. Follow the reproducibility guide in the paper repository for the exact invocations used to generate each figure.
| Feature | TAS-AI | gpCAM (ILL) | Log-GP (JCNS) | ANDiE (ORNL) |
|---|---|---|---|---|
| Physics-informed | โ | โ | โ | โ |
| Model discrimination | โ | โ | โ | โ |
| Motor motion | โ | โ | โ | โ |
| Log-space GP | โ | โ | โ | โ |
| Real-time dashboard | โ | โ | โ | โ |
- Python 3.9+
- NumPy, SciPy, Matplotlib
- Dash, dash-bootstrap-components, plotly, pandas (for dashboard)
- Optional: scikit-learn (for GP), emcee/bumps (for MCMC)
- Optional: Julia + Sunny.jl (for advanced spin wave calculations)
If you use TAS-AI in your research, please cite:
@software{tasai2024,
title = {TAS-AI: Autonomous Triple-Axis Spectrometer Control},
author = {NIST Center for Neutron Research},
year = {2024},
url = {https://github.com/usnistgov/tasai}
}- ANDiE - Autonomous Neutron Diffraction Explorer
- gpCAM - Gaussian Process Campaign
- AutoREFL - Autonomous Reflectometry
- SpinW - Spin Wave Calculation Library
- Sunny.jl - Modern Spin Dynamics
This repository uses the NIST software statement in LICENSE. In the United States, software developed by NIST employees is not subject to copyright protection under 17 U.S.C. 105; foreign rights may still apply.
Contributions welcome! Please see CONTRIBUTING.md for guidelines.