pygidSIM_torch
pygidSIM_torch calculates GIWAXS patterns from crystal structure descriptions. It is a PyTorch-based implementation of the pygidSIM package.
Installation
Install from PyPI
pip install pygidsim_torch
Install from source
First, clone the repository:
git clone https://github.com/MishaRomodin/pygidSIM_torch.git
Then, to install all required modules, navigate to the cloned directory and execute:
cd pygidSIM_torch
pip install -e .
Development Installation
For development and testing, install with development dependencies:
pip install -e .[dev]
Testing
The project uses pytest for testing. To run the test suite:
# Run all tests
pytest
# Run tests with coverage report
pytest --cov=pygidsim_torch --cov-report=html
# Run tests in parallel
pytest -n auto
Usage
From CIF
Not implemented yet.
Crystal description
To calculate a GIWAXS pattern from your own description, use the following example:
import torch
from pygidsim_torch import Crystal, ExpParameters, GIWAXS
from pygidsim_torch.directions import get_mi
params = ExpParameters(
q_xy_range=torch.tensor([0, 2.7]),
q_z_range=torch.tensor([0, 3.5]),
en=18000
) # experimental parameters
# lattice parameters [a, b, c, α, β, γ]
lat_par = torch.tensor([6.3026, 6.3026, 6.3026, 90., 90., 90.], dtype=torch.float32)
mi = get_mi(min_index=-6, max_index=6) # Miller indices
cr = Crystal(lat_par, deg=True)
el = GIWAXS(cr, params, mi)
q_2d, q_mask = el.giwaxs_sim()
To add crystal rotation, use the argument orientation with the value "random" or a Tensor containing the
corresponding
Miller indices [hkl]:
q_2d, q_mask = el.giwaxs_sim(orientation='random')
q_2d, q_mask = el.giwaxs_sim(orientation=torch.tensor([2., 0., 1.]))
For multiple structures, the lattice parameters tensor should have shape (n_structures, 6).
The orientation tensor should have shape (n_structures, 3) or (3,) in case of same orientations for all samples.
Citation
If you use this package in your research, please cite it as follows:
Romodin, M., Starostin, V., Lapkin, D., Hinderhofer, A., & Schreiber, F. (2025).
mlgid-project/pygidSIM: v0.1.1. Zenodo. https://doi.org/10.5281/zenodo.17609569
Metadata
Release files for pygidsim-torch 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pygidsim_torch-0.1.3.tar.gz | 51.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pygidsim_torch-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 88.6 kB
Release files / pygidsim_torch-0.1.3.tar.gz
| Download URL | pygidsim_torch-0.1.3.tar.gz |
|---|---|
| Size | 51.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e1e8ec4f4fc0168f5e13a01309e1a66820a4a722483fb020b4f4a69815e5cf5f
|
|
BLAKE2b-256 checksum How to use checksums |
6f93cc31b04db4bd0557c21f552245ca16057952dea8c30a26a3757887320852
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.9
|
Release files / pygidsim_torch-0.1.3-py3-none-any.whl
| Download URL | pygidsim_torch-0.1.3-py3-none-any.whl |
|---|---|
| Size | 37.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
608b9416586d77148c07c6e93a09fc9cedc30e6b65dc840aee1fbeef3f366cb1
|
|
BLAKE2b-256 checksum How to use checksums |
4df949b1745f4bed09b79c1f4c5dabfd8dfdc5faa4ffff8f57bfbf644b7c620f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.9
|