Skip to main content

Tools for diffraction simulation of s3dxrd type experiments.

Project description

https://github.com/AxelHenningsson/xrd_simulator/blob/main/docs/source/images/logo.png?raw=true https://img.shields.io/pypi/pyversions/xrd-simulator.svg? https://github.com/AxelHenningsson/xrd_simulator/actions/workflows/python-package-conda-linux-py38.yml/badge.svg? https://github.com/AxelHenningsson/xrd_simulator/actions/workflows/python-package-conda-macos-py38.yml/badge.svg? https://github.com/AxelHenningsson/xrd_simulator/actions/workflows/pages/pages-build-deployment/badge.svg? https://badge.fury.io/py/xrd-simulator.svg? https://anaconda.org/axiomel/xrd_simulator/badges/installer/conda.svg? https://anaconda.org/axiomel/xrd_simulator/badges/platforms.svg? https://anaconda.org/axiomel/xrd_simulator/badges/latest_release_relative_date.svg?

Simulate X-ray Diffraction from Polycrystals in 3D.

The X-R ay D iffraction SIMULATOR package defines polycrystals as a mesh of tetrahedral single crystals and simulates diffraction as collected by a 2D discretized detector array while the sample is rocked around an arbitrary rotation axis.

xrd_simulator was originally developed with the hope to answer questions about measurement optimization in scanning x-ray diffraction experiments. However, xrd_simulator can simulate a wide range of experimental diffraction setups. The essential idea is that the sample and beam topology can be arbitrarily specified, and their interaction simulated as the sample is rocked. This means that standard “non-powder” experiments such as scanning-3dxrd and full-field 3dxrd (or HEDM if you like) can be simulated as well as more advanced measurement sequences such as helical scans for instance. It is also possible to simulate powder like scenarios using orientation density functions as input.

Documentation

Before reading all the boring documentation (which is hosted here) let’s dive into some end to end examples to get us started on a good flavour.

The xrd_simulator is built around four python objects which reflect a diffraction experiment:

  • A beam of xrays (using the xrd_simulator.beam module)

  • A 2D area detector (using the xrd_simulator.detector module)

  • A 3D polycrystal sample (using the xrd_simulator.polycrystal module)

  • A rigid body sample motion (using the xrd_simulator.motion module)

Once these objects are defined the it is possible to let the detector collect scattering of the polycrystal as the sample undergoes the prescribed rigid body motion while being illuminated by the xray beam.

Let’s go ahead and build ourselves some x-rays:

<beam example goes here>

We will also need to define a detector:

<detector example goes here>

Next we go ahead and produce a sample:

<polycrystal example goes here>

And finally we define some motion of the sample over which to integrate the diffraction signal:

<motion example goes here>

Ok, so now we got ourselves an experimental setup, about time to collect some diffraction:

<diffract and rendering example goes here>

Installation

Anaconda installation

The preferred way to install the xrd_simulator package is via anaconda:

conda install -c conda-forge -c axiomel xrd_simulator

This is meant work across OS-systems and requires no prerequisites except, of course, that of Anaconda itself.

Pip Installation

Pip installation is possible, however, external dependencies of pygalmesh must the be preinstalled on your system. Installation of these will be OS dependent and documentation can be found elsewhere.:

pip install xrd-simulator

Source installation

Naturally one may also install from the sources:

git clone https://github.com/AxelHenningsson/xrd_simulator.git
cd xrd_simulator
python setup.py install

This will then again require the pygalmesh dependencies to be resolved beforehand.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xrd_simulator-0.2.4.tar.gz (72.6 kB view hashes)

Uploaded Source

Built Distribution

xrd_simulator-0.2.4-py3-none-any.whl (82.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page