Python bindings to the ObjCryst++ library.
Project description
Python bindings to ObjCryst++, the Object-Oriented Crystallographic Library.
For more information about the pyobjcryst library, please consult our online documentation.
pyobjcryst is an open-source software package originally developed as a part of the DiffPy-CMI complex modeling initiative which originated in the DANSE project at Columbia University. It was further developed at Brookhaven National Laboratory, and Columbia University and the European Synchrotron Radiation Source (ESRF) and is now maintained at Columbia and ESRF. The pyobjcryst sources are hosted at https://github.com/diffpy/pyobjcryst.
Citation
If you use diffpy.srfit in a scientific publication, we would like you to cite this package as
P. Juhás, C. L. Farrow, X. Yang, K. R. Knox and S. J. L. Billinge, Complex modeling: a strategy and software program for combining multiple information sources to solve ill posed structure and nanostructure inverse problems, Acta Crystallogr. A 71, 562-568 (2015).
and
V. Favre-Nicolin and R. Cerný, FOX, ‘free objects for crystallography’: a modular approach to ab initio structure determination from powder diffraction, J. Appl. Cryst. 35, 734-743 (2002)
The second paper describes the c++ crystallographic objects in ObjCryst++ that are wrapped by pyobjcryst
Installation
The latest release of pyobjcryst runs in python versions 3.11, 3.12 and 3.13. You may specify an earlier release if you need it to run in an earlier version of Python.
The preferred method is to use Miniconda Python or mamba and install from the “conda-forge” channel of Conda packages. mamba works in the same way as conda but has the advantage of being much faster when resolving dependencies during installation. It also uses by default the conda-forge repository, which is what almost all users would want.
To add “conda-forge” to the conda channels, run the following in a terminal.
conda config --add channels conda-forge
We want to install our packages in a suitable conda environment. The following creates and activates a new environment named pyobjcryst_env
conda create -n pyobjcryst_env pyobjcryst conda activate pyobjcryst_env
To confirm that the installation was successful, type
python -c "import pyobjcryst; print(pyobjcryst.__version__)"
The output should print the latest version displayed on the badges above.
To use mamba, replace conda with mamba in the commands above.
pyobjcryst is also included in the diffpy.cmi collection of packages for structure analysis and so can be installed by
conda install -c conda-forge diffpy.cmi
Optional graphical dependencies for jupyter notebooks
Some of the classes can produce graphical outputs, which can be displayed in a jupyter notebook:
a Crystal structure can be displayed in 3D: this requires the py3dmol and ipywidgets modules. See the notebook docs/examples/cystal_3d_widget.ipynb
a PowderPattern can be displayed (and live-updated) if matplotlib and ipympl are installed. See the notebook docs/examples/structure-solution-powder-cimetidine.ipynb
Getting Started
You may consult our online documentation for tutorials and API references.
Alternative methods of installation
These approaches are not recommended but reproduced here for advanced users. You can use pip to download and install the latest release from Python Package Index. To install using pip into your pyobjcryst_env environment, type
pip install pyobjcryst
If you prefer to install from sources, after installing the dependencies, obtain the source archive from GitHub. Once installed, cd into your pyobjcryst directory and run the following
pip install .
An alternative way of installing pyobjcryst is to use the SCons tool, which can speed up the process by compiling C++ files in several parallel jobs (-j4):
conda install scons conda install --file requirements/conda.txt scons -j4 dev
See scons -h for description of build targets and options.
Alternatively, on Ubuntu Linux the required software can be installed using
sudo apt-get install \
python-setuptools python-numpy scons \
build-essential python-dev libboost-all-dev
If this doesn’t work, please see the requirements/conda.txt file for the latest list of requirements.
The libobjcryst library can also be installed as per the instructions at https://github.com/diffpy/libobjcryst. Make sure other required software are also in place and then run from the pyobjcryst directory
pip install .
You may need to use sudo with system Python so the process is allowed to copy files to system directories, unless you are installing into a conda environment. If administrator (root) access is not available, see the usage information from python setup.py install –help for options to install to a user-writable location.
Testing your installation
The installation integrity can be verified by executing the included tests with
First install test dependencies then type pytest:
conda install --file requirements/tests.txt pytest
Support and Contribute
If you see a bug or want to request a feature, please report it as an issue and/or submit a fix as a PR.
Feel free to fork the project and contribute. To install pyobjcryst in a development mode, with its sources being directly used by Python rather than copied to a package directory, use the following in the root directory
pip install -e .
To ensure code quality and to prevent accidental commits into the default branch, please set up the use of our pre-commit hooks.
Install pre-commit in your working environment by running conda install pre-commit.
Initialize pre-commit (one time only) pre-commit install.
Thereafter your code will be linted by black and isort and checked against flake8 before you can commit. If it fails by black or isort, just rerun and it should pass (black and isort will modify the files so should pass after they are modified). If the flake8 test fails please see the error messages and fix them manually before trying to commit again.
When developing it is preferable to compile the C++ files with SCons using the build=debug option, which compiles the extension module with debug information and C-assertions checks
scons -j4 build=debug dev
Improvements and fixes are always appreciated.
Before contributing, please read our Code of Conduct.
Contact
For more information on pyobjcryst please visit the project web-page or email Simon Billinge at sb2896@columbia.edu.
You can also contact Vincent Favre-Nicolin (favre@esrf.fr) if you are using pyobjcryst outside diffpy, e.g. to display structures in a notebook, refine powder patterns or solve structures using the global optimisation algorithms, etc..
Acknowledgements
This package bundles the following IUCr data files for bona fide research use:
cpd-1a.prn: Powder diffraction dataset from the IUCr CPD Round Robin on Quantitative Phase Analysis.
Source: https://www.iucr.org/__data/iucr/powder/QARR/col/cpd-1a.prn
Round Robin on Quantitative Phase Analysis: Madsen, I. (1997) ‘Round Robin on Quantitative Phase Analysis’, Powder Diffraction, 12(1), pp. 1–2. Available at: https://doi.org/10.1017/S0885715600020212.
pyobjcryst is built and maintained with scikit-package.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyobjcryst-2025.1.0.tar.gz.
File metadata
- Download URL: pyobjcryst-2025.1.0.tar.gz
- Upload date:
- Size: 158.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
782c776de91d815cf74aff865fe002db99eff83a786c684dc9324460cd5fed5f
|
|
| MD5 |
01a674537e4e1d1fc6a25e702bb12568
|
|
| BLAKE2b-256 |
56321118c2650e3cc129153b25705e9792d7ffa2409283b52b2089e3fd05618f
|
File details
Details for the file pyobjcryst-2025.1.0-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: pyobjcryst-2025.1.0-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f283dee87bf21573e7c4ee6733d482f2a9c19730242870b802f53973e48c1fe6
|
|
| MD5 |
788b4b90a9dfd8107c6098e6c4aea66c
|
|
| BLAKE2b-256 |
3a9b74294c9b87528519288dedfbc5a493f1164aae9fa03e2388b1a8e143dc4e
|
File details
Details for the file pyobjcryst-2025.1.0-cp313-cp313-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: pyobjcryst-2025.1.0-cp313-cp313-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.13, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d130bb14a75e81a36fcce41c182594e4ebb981c51dcc6608be3533d937f92e8
|
|
| MD5 |
f8771ebce78b623e3bd49295fec7214b
|
|
| BLAKE2b-256 |
b81aa69221e711e55552f1a01cfc62b4b4f0c454c368e7af38e6586decbee6c2
|
File details
Details for the file pyobjcryst-2025.1.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyobjcryst-2025.1.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8455aebbb28724a0282a487f608a37a1dd8a5577b027b83781d4ab6ef8cfaa54
|
|
| MD5 |
e419928cf3889470daf1a7abc7e5c5e1
|
|
| BLAKE2b-256 |
d13e03b703b4ad693e1d732922be139c63aff06aa5bd451b04df9eeb75df6b9e
|
File details
Details for the file pyobjcryst-2025.1.0-cp313-cp313-macosx_10_13_x86_64.whl.
File metadata
- Download URL: pyobjcryst-2025.1.0-cp313-cp313-macosx_10_13_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.13, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a6f25a5d311c480ce6dff469e4f5cff8f2e7d64c0edc2e24a35a739dfb569eb
|
|
| MD5 |
3b1aa5605c9eaae24aa63e40685f3766
|
|
| BLAKE2b-256 |
6d1dda0848e5c51a396ad7f9a93b06aecb27de1923fa8679ef9c05289ebd11d2
|
File details
Details for the file pyobjcryst-2025.1.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: pyobjcryst-2025.1.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f70a231b91b3157d16dc4ea95b5f3173bbf7cb8031675055b23abaa09ef442ea
|
|
| MD5 |
675b20539c9688a1fb72f14b517e2a2a
|
|
| BLAKE2b-256 |
0127b86d3fedc29c01ebd9a681cb64a5672042f27f1a70f0454281057f099442
|
File details
Details for the file pyobjcryst-2025.1.0-cp312-cp312-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: pyobjcryst-2025.1.0-cp312-cp312-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.12, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d261f2f97c205b018f941d1677105e74fb206698f81acbaff1799dc7fc4ee830
|
|
| MD5 |
c5045d59c628ab802acde055eb6f2ee2
|
|
| BLAKE2b-256 |
c897c4749284368941f99389566daad039583c05de7eb67855b10a17c79571a6
|
File details
Details for the file pyobjcryst-2025.1.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyobjcryst-2025.1.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
285c5377f34b62f4ab451dd05db365068360cf24a07d7aa75bcbd0319aa1be71
|
|
| MD5 |
994db3ae8be95a70e5a011f122f89992
|
|
| BLAKE2b-256 |
10d1058f07aef7e7706e1415e93da5887fea39a2d822c321a26e175c70e12287
|
File details
Details for the file pyobjcryst-2025.1.0-cp312-cp312-macosx_10_13_x86_64.whl.
File metadata
- Download URL: pyobjcryst-2025.1.0-cp312-cp312-macosx_10_13_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.12, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
136e7c55256d6063f0e5c4fea8668663fbcb0fff27c403151840b8b086d31218
|
|
| MD5 |
e1f704b61bf9fc4bb2315563071e6e4e
|
|
| BLAKE2b-256 |
58c8f4abd4dff5fa97ab21e18635466d4956b3155e4a0f5464dd2a8e059d81d9
|
File details
Details for the file pyobjcryst-2025.1.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: pyobjcryst-2025.1.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bb1e74d38d1731913e4ca5044a2ebb9485cf5e24a056bce1e65bce98687e160
|
|
| MD5 |
f4c4ad5cdebee3c1cd383275d7953317
|
|
| BLAKE2b-256 |
06adc1511bfb0387038adcacdb21e2654d3ce2241d64ebbf8703604f9215933b
|
File details
Details for the file pyobjcryst-2025.1.0-cp311-cp311-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: pyobjcryst-2025.1.0-cp311-cp311-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.11, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d134e6fd180cb8107a9ebf7a42faa00d42485a42e8758d6967a8e86f5027deb2
|
|
| MD5 |
2492b0219dbe03b315f2ae5002c64fcb
|
|
| BLAKE2b-256 |
67665d94ac43163dc022d105757a84b1d237c1b2a6d324397310fbc3c058ed54
|
File details
Details for the file pyobjcryst-2025.1.0-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyobjcryst-2025.1.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b15cda161ab9c26225f5b4eb125a775dbda4f3123cba2abe6a2df69d7fdc3c71
|
|
| MD5 |
5fa936dd2d1f26d36479068e99c0e61c
|
|
| BLAKE2b-256 |
5a90b34907944755b8ae98d8ddd4622a20be0cad97199eb047a9711aaa4f01fd
|
File details
Details for the file pyobjcryst-2025.1.0-cp311-cp311-macosx_10_13_x86_64.whl.
File metadata
- Download URL: pyobjcryst-2025.1.0-cp311-cp311-macosx_10_13_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.11, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e9e89e53cf7825d34ec794942e585da91637cd77dc6dbda959ca8af37ff38bf
|
|
| MD5 |
d773222f1237a80d7cd2d8394fb8e1da
|
|
| BLAKE2b-256 |
061b9cd493a835751e6080f86b957054cd71033833bde98edc2faed7ff4bbc8c
|