Health | Main Release (w/ Mantid Framework) | Dev Release (w/o Mantid Framework) |
---|---|---|
This project is trying to implement total scattering data reduction for neutron time-of-flight diffractometers using the algorithms currently available in the Mantid framework
This entails taking raw neutron counts from detectors in the diffraction experiment and turning them into the reciprocal-space structure factor patterns, F(Q) or S(Q), and applying a Fourier Transform to real-space to give the pair distribution fuction, PDF.
This is the future backend for the ADDIE project and hopes to support multiple diffractometers performing total scattering measurements.
The following commands can get you setup (on Linux machine) to get conda
installed (as miniconda):
CONDA_PYTHON=3
MINICONDA_URL="https://repo.continuum.io/miniconda";
MINICONDA_FILE="Miniconda${CONDA_PYTHON}-latest-Linux-x86_64.sh";
wget "${MINICONDA_URL}/${MINICONDA_FILE}";
bash ${MINICONDA_FILE} -b -p $HOME/miniconda;
export PATH="$HOME/miniconda/bin:$PATH";
NOTE: You can change the python version number via the CONDA_PYTHON
variable
You will have to excute the last command on every new bash session (export PATH...
).
Adding this last line to your ~/.bashrc
will automatically add it on every bash session startup.
Add channels with dependencies, create a conda environment with python_version
set to either 2.7.14
or 3.6
, and activate the environment
conda config --add channels conda-forge --add channels mantid --add channels mantid/label/nightly
conda create -n mantidts_env python=${python_version}
source activate mantidts_env
NOTE: Mamba is still in "beta".
python_version=3.6
conda config --add channels conda-forge --add channels mantid --add channels mantid/label/nightly
conda install mamba -c conda-forge
mamba update mamba -c conda-forge
mamba create -n mantidts_env python=${python_version}
source activate mantidts_env
Simply replace conda
-> mamba
in "Install" instruction commands
conda install -c neutrons mantid-total-scattering
Go here for how to delete an environment or use:
conda remove --name mantidts_env --all
If you have an error (see below for example) related to the libGL
library, you may not have it installed for the Mantid Framework to work. See instructions here for installing the necessary libraries for different OS
Example error:
ImportError: First import of "._api" failed with "libGL.so.1: cannot open shared object file...
If you have an error that another version of Mantid is installed on the machine and being imported via PYTHONPATH
, you can use the following as a workaround for CLI tool:
PYTHONPATH="" mantidtotalscattering
To launch the total scattering script, complete the input JSON file (found in examples
directory), and run:
mantidtotalscattering examples/sns/nomad_simple.json
If you need to specify the path to Mantid build, use:
MANTIDPATH=/path/to/mantid/build/bin PATH=$MANTIDPATH:$PATH PYTHONPATH=$MANTIDPATH:$PATH mantidtotalscattering <json input>
This is mainly for development if you want to use a local development build of Mantid Framework instead of one included.
pip install mantid-total-scattering
Add channels with dependencies, create a conda environment with python_version
set to either 2.7
or 3.6
, and activate the environment
conda config --add channels conda-forge
conda create -n mantidts_env python=${python_version}
conda activate mantidts_env
conda install -c neutrons mantid-total-scattering-python-wrapper
Clone the repository to a local directory
git clone https://github.com/neutrons/mantid_total_scattering.git
cd mantid_total_scattering
To build and run the tests via pytest, use:
/path/to/mantid/build/bin/mantidpython setup.py test
To build and run tests via Docker, use:
docker build -t unit-test-env -f .ci/Dockerfile.nightly_ubuntu16.04_python3 . && docker run -t unit-test-env /bin/bash -c "mantidpython -m pytest"
Mantid Total Scattering uses versioneer. These are the instructions to create a new version, working on a local clone
git branch --track main origin/main # create a local main branch set to follow remote main
git checkout main
git fetch -p -t # fetch all changes from the remote repo
git rebase -v origin/main # sync with remote main branch
git merge --ff-only origin/next # merge in all of the changes in branch next
git tag v.0.2.13 # create the tag in the format that versioneer has been configured
git push --tags origin main # push the tag to remote to kick off the deploy step