Garnet (Single Crystal Graphical Advanced Reduction Neutron Event Toolkit) is a Python framework for data reduction and analysis of single-crystal neutron diffraction experiments.
It provides:
- Automated reduction workflows for time-of-flight Laue instruments.
- Normalization, parametrization, and peak-integration workflows.
- An interactive experiment browser for navigating IPTS data.
- Support for TOPAZ and other SNS single-crystal instruments.
The project uses Mantid for neutron data processing and includes Python APIs, command-line workflows, plotting utilities, and a graphical application.
Garnet uses Conda for its development and runtime environment. After cloning the repository, create the environment and install Garnet in editable mode:
git clone https://github.com/neutrons/garnet-tools.git
cd garnet-tools
conda env create -f environment.yml
conda activate garnet
python -m pip install -e .If the garnet environment already exists, update it with:
conda env update -f environment.yml --prune
conda activate garnet
python -m pip install -e .Launch the graphical application with:
garnetReduction workflows can also be run directly. For example:
python src/garnet/workflow.py <reduction-plan.yaml> norm 4See the documentation and the tutorial guides for workflow configuration and instrument-specific examples.
With the garnet environment active, run the test suite with:
pytestThe GitHub Actions test job installs the package in editable mode and runs the same test command on every push.
Build the API documentation locally with:
sphinx-apidoc -o docs/source src/garnet
sphinx-build -b html docs docs/_build/htmlOpen docs/_build/html/index.html after the build completes. The source
documentation is organized into:
Documentation deployment is configured in
.github/workflows/gh-pages.yml.
The Conda workflow in
.github/workflows/python-package-conda.yml
has three responsibilities:
- Install the development environment and run the test suite.
- Build a noarch Conda package, install it into a clean test environment, and verify that its Conda and Python versions match.
- Publish packages to the
neutronsAnaconda organization when the workflow runs formainor a version tag.
The release labels are:
- Pushes to
mainpublish to thedevlabel. - Version tags such as
v1.2.3publish to themainlabel. - The
devcleanup job retains the five newest package versions.
Publishing requires the repository or organization GitHub Actions secret
ANACONDA_TOKEN. Reusable Conda package actions are provided by
neutrons/gh-actions.
See CONTRIBUTING.md for environment setup, pre-commit, style, testing, and pull-request guidance.
Garnet is distributed under the GPL-3.0-only license. See LICENSE for the full license text.