/EasyDiffractionLib

Diffraction data analysis library

Primary LanguageJupyter NotebookBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Unit Tests Release Downloads Lines of code Total lines Files License Binder

easydiffractionLib is a Python library which provides:

  • Scripting interface to simulate and analyse neutron diffraction patterns.
  • Multiple optimization algorithms to minimize models to experimental data: Lmfit, Bumps and DFO_LS.
  • Multiple calculation engines: CrysPy, CrysFML, GSAS-II.

easydiffractionLib is the foundation of easyDiffraction, an intuitive application which endeavors simplifying and accelerating the analysis of diffraction experiments.

Getting Started

Install easyDiffractionLib

Currently easyDiffractionLib is in alpha and has not been released on pypi. Please use the alternative method given below to install easyDiffractionLib from our custom Python Package Index.

  • Create and go to, e.g., easyDiffraction directory (optional)
    mkdir easyDiffraction && cd easyDiffraction
    
  • Create virtual environment and activate it (optional)
    python -m venv .venv
    source .venv/bin/activate
    
  • Upgrade pip (optional)
    pip install --upgrade pip
    
  • Install easyDiffractionLib
    pip install easyDiffraction --extra-index-url https://easyscience.github.io/pypi
    

Examples

Jupyter Notebook examples that use easyDiffractionLib

Locally

  • Install easyDiffractionLib as described above
  • Install Jupyter Notebook and visualization libraries, such as py3Dmol and bokeh (if not done already)
    pip install notebook py3Dmol bokeh
    
  • Download easyDiffractionLib Jupyter Notebook examples from GitHub, e.g., using svn (if not done already)
    svn export https://github.com/easyScience/easyDiffractionLib/branches/master/examples
    
  • Run Jupyter Notebook server
    jupyter notebook examples/
    
  • In webbrowser open
    http://localhost:8888/
    
  • Select one of the *.ipynb files

Via Binder (interactive)

Examples can also be run on the online service Binder. Click launch Binder and navigate to the examples folder to run one of the notebooks or create your own.

Via nbviewer (non-interactive preview)

Test

Testing is run via pytest, though it is not installed by default. Install it with:

pip install pytest

The installation can be verified by running the test suite:

python -m pytest

Contributing

We absolutely welcome contributions. easyDiffractionLib is maintained by the ESS and on a volunteer basis and thus we need to foster a community that can support user questions and develop new features to make this software a useful tool for all users while encouraging every member of the community to share their ideas.

License

easyDiffractionLib is licenced under the BSD-3-Clause license, DFO_LS is subject to the GPL license.