Skip to main content

pygidSIM_torch

pygidSIM_torch calculates GIWAXS patterns from crystal structure descriptions. It is a PyTorch-based implementation of the pygidSIM package.

pygidSIM_torch

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

Download files

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

Source Distribution

pygidsim_torch-0.1.3.tar.gz (51.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygidsim_torch-0.1.3-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

Details for the file pygidsim_torch-0.1.3.tar.gz.

File metadata

  • Download URL: pygidsim_torch-0.1.3.tar.gz
  • Upload date:
  • Size: 51.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for pygidsim_torch-0.1.3.tar.gz
Algorithm Hash digest
SHA256 e1e8ec4f4fc0168f5e13a01309e1a66820a4a722483fb020b4f4a69815e5cf5f
MD5 3c3b85396c36b54c12832fcf9ee72ecb
BLAKE2b-256 6f93cc31b04db4bd0557c21f552245ca16057952dea8c30a26a3757887320852

See more details on using hashes here.

File details

Details for the file pygidsim_torch-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: pygidsim_torch-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 37.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for pygidsim_torch-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 608b9416586d77148c07c6e93a09fc9cedc30e6b65dc840aee1fbeef3f366cb1
MD5 6d65ce95652931abd79f4e7580262857
BLAKE2b-256 4df949b1745f4bed09b79c1f4c5dabfd8dfdc5faa4ffff8f57bfbf644b7c620f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page