PyTorch-based implementation of pygidSIM package for calculating GIWAXS patterns
Project description
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.experiment import ExpParameters
from pygidsim_torch.giwaxs_sim import GIWAXS, Crystal
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)
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
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 Distribution
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 pygidsim_torch-0.1.1.tar.gz.
File metadata
- Download URL: pygidsim_torch-0.1.1.tar.gz
- Upload date:
- Size: 51.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db22eddabcf613b979009ae2cc31fbb7bcb74cef6788cc46a53610563d2440e3
|
|
| MD5 |
9955bb80bdf8a8f5d2b5b35994cef318
|
|
| BLAKE2b-256 |
498af88270b56c4572303e1a76ce585a106c7f057a347094715875a5ddedbf71
|
File details
Details for the file pygidsim_torch-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pygidsim_torch-0.1.1-py3-none-any.whl
- Upload date:
- Size: 39.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bd8960dbfefd6ffdae4734f130b4850dc4dcf914b0dd1de26c89ef59f4e870e
|
|
| MD5 |
20a8ba65ad070e3269bc985457988427
|
|
| BLAKE2b-256 |
bdc3763dca8773bcc76597902833a6704ac644e23578df89a48675e9b25a6bf9
|