Coder Social home page Coder Social logo

peterfpeterson / mantid_total_scattering Goto Github PK

View Code? Open in Web Editor NEW

This project forked from neutrons/mantid_total_scattering

0.0 3.0 0.0 755 KB

Implementing total neutron scattering data reduction using the Mantid Framework

License: GNU General Public License v3.0

Shell 0.71% Python 99.00% Dockerfile 0.30%

mantid_total_scattering's Introduction

DevOps
Build Status
codecov

Total Scattering Data Reduction using 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.

Structure factor S(Q) -> Pair Distribution Function G(r)

alt text

Installation

Mantid Framework Included

Anaconda (Recommended)

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}
conda activate mantidts_env

Install

conda install -c marshallmcdonnell mantid-total-scattering

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

Usage (CLI reduction tool)

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>

Mantid Framework Not Included (for development)

This is mainly for development if you want to use a local development build of Mantid Framework instead of one included.

PyPI (Recommended)

Install

pip install mantid-total-scattering

Anaconda

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

Development

Clone the repository to a local directory

git clone https://github.com/marshallmcdonnell/mantid_total_scattering.git
cd mantid_total_scattering

Pipenv

To setup the development environment with pipenv:

  1. Install pipenv: pip install --user pipenv or read this
  2. Setup virtualenv with dependencies and mantid_total_scattering installed: pipenv install -e .
  3. 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.

Tests

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"

mantid_total_scattering's People

Contributors

dannixon avatar elliotaoram avatar marshallmcdonnell avatar peterfpeterson avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.