xrayutilities - 一个包含适用于 X 射线衍射物理学家的有用脚本的包
xrayutilities is a collection of scripts used to analyze and simulate x-ray diffraction data. It consists of a Python package and several routines coded in C. For analysis the package is especially useful for the reciprocal space conversion of diffraction data taken with linear and area detectors. For simulations code for X-ray reflectivity, kinematical and dynamical diffraction simulation of crystal truncation rods as well as fundamental parameters powder diffraction is included.
Copyright (C) 2009-2026 Dominik Kriegner
Copyright (C) 2009-2013 Eugen Wintersberger
To get in touch with us or report an issue please use the mailing list (https://sourceforge.net/p/xrayutilities/mailman/xrayutilities-users/) or the Github issue tracker (https://github.com/dkriegner/xrayutilities/issues). When you want to follow announcements of major changes or new releases its recommended to sign up for the mailing list
xrayutilities can be installed in several ways depending on your operating system and preference.
Using the python package manager pip you can install xrayutilities by executing
pip install xrayutilitiesNote that on recent Linux distributions
pip install outside of a virtual environment might fail with an
externally-managed-environment error. In this case, it is recommended to
use a virtual environment or one of the other installation methods below.
xrayutilities is available via the conda-forge channel:
conda install -c conda-forge xrayutilitiesOn Debian-based distributions (Debian, Ubuntu, Mint, ...) xrayutilities is available as a system package:
sudo apt install python3-xrayutilitiesInstalling xrayutilities from source is an easy process done by executing
pip install .By default the installation procedure enables OpenMP support (recommended). It fails if no OpenMP support is available. It can be disabled by using the the following custom meson option for the installation:
pip install . --config-settings=setup-args="-Duse_openmp=disabled"To allow to proceed with the installation without OpenMP but use it if available use:
pip install . --config-settings=setup-args="-Duse_openmp=auto"The following requirements are needed for installing and using xrayutilities:
Crystal.show_unitcell)When building from source you also might need:
refer to your operating system documentation to find out how to install those packages. On Microsoft Windows refer to the Documentation for the easiest way of the installation (Anaconda, Python(x,y), or WinPython).
The table below summarizes the Python versions supported by recent xrayutilities release intervals. For exact packaging details of older releases, refer to the corresponding release tag.
| xrayutilities version | Python support | Notes |
|---|---|---|
| current development | >= 3.10 | Current development and tests target Python 3.10 and newer. NumPy >= 2.1.0 is required. |
| 1.7.8 - 1.7.x | >= 3.7 | NumPy 2 support was added for PyPI wheels in 1.7.8. |
| 1.7.0 - 1.7.7 | >= 3.6 | Python 3.6 became required in 1.7.0 due to f-strings. |
| 1.6.x | Python 3 only | Python 2 code paths were removed in 1.6.0. |
| <= 1.5.4 | Python 2.7 and Python 3 | 1.5.4 was the final Python 2 compatible release. |
The following steps should only be necessary when using non-default installation locations to ensure the Python module is found by the Python interpreter. In this case the module is installed under /lib[64]/python?.?/site-packages on Unix systems and /Lib/site-packages on Windows systems.
If you have installed the Python package in a directory unknown to your Python distribution, you have to tell Python where to look for the Package. There are several ways how to do this:
add the directory where the package is installed to your PYTHONPATH environment variable.
add the path to sys.path in the .pythonrc file placed in your home directory
import sys
sys.path.append("path to the xrayutilities package")
simply apply the previous method in every script where you want to use the xrayutilities package before importing the package
import sys
sys.path.append("path to the xrayutilities package")
import xrayutilitiesThe sources are hosted on sourceforge in git repository. Use
git clone https://github.com/dkriegner/xrayutilities.gitto clone the git repository. If you would like to have commit rights contact one of the administrators.
If you installed xrayutilities via pip, you can update it by:
pip install -U xrayutilitiesIf you installed via conda:
conda update xrayutilitiesIf you installed via apt:
sudo apt update
sudo apt install python3-xrayutilitiesIf you installed from source, you can update it by navigating into its source folder and obtain the new sources by ::
git pullor download the new tarball from sourceforge (https://sf.net/projects/xrayutilities) if any code changed during the update you need to reinstall the Python package. Thats easiest achieved by
pip install .In case you are not certain about the installation location it can be determined by
python -c "import xrayutilities as xu; print(xu.__file__)"
/usr/local/lib64/python3.10/site-packages/xrayutilities/__init__.pyif the output is e.g.: /usr/local/lib64/python3.10/site-packages/xrayutilities/init.py you previously installed xrayutilities in /usr/local, which should be used again as install path. Use ::
pip install --prefix= .to install the updated package.
Documentation for xrayutilities is found on the webpage https://xrayutilities.sourceforge.io
The API-documentation can also be browsed by
pydoc -p PORTin any web-browser, after the installation is finished.
暂无开放 Issues,或尚未同步最近议题。