DevOps | 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.
Setup
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
Install (or Update)
conda install -c marshallmcdonnell mantid-total-scattering
Go here for how to delete an environment or use:
conda remove --name mantidts_env --all
Notes
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.
Install
pip install mantid-total-scattering
Setup
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
Install
conda install -c marshallmcdonnell mantid-total-scattering-python-wrapper
Clone the repository to a local directory
git clone https://github.com/marshallmcdonnell/mantid_total_scattering.git
cd mantid_total_scattering
To setup the development environment with pipenv:
- Install
pipenv
:pip install --user pipenv
or read this - Setup virtualenv with dependencies and
mantid_total_scattering
installed:pipenv install -e .
- Activate the environment to run interatively:
pipenv shell
NOTE: On Step 3, if you get something like
"Shell for UNKNOWN_VIRTUAL_ENVIRONMENT already activated.", the shell is already running from install.
Usually, do a deactivate
and then repeat Step 3.
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 . && docker run -t unit-test-env /bin/bash -c "mantidpython -m pytest"