Skip to main content

Total Scattering Function Manipulator:

Health Release Other
Build Status PyPI version Binder
codecov Anaconda-Server Badge License: GPL v3
Documentation Status Project Status: Active – The project has reached a stable, usable state and is being actively developed.

From total scattering functions, we have reciprocal-space structure factors and real-space pair distribution functions that are related via a Fourier transform. PyStoG is a package that allows for:

  1. Converting between the various functions used by different "communities" (ie researchers who study crystalline versus amorphous or glass materials). Conversions are for either real-space or reciprocal-space.
  2. Perform the transform between the different available functions of choice
  3. Fourier filter to remove spurious artificats in the data (ie aphysical, sub-angstrom low-r peaks in G(r) from experiments)

alt text

The name PyStoG comes from the fact that this is a Pythonized version of StoG, a ~30 year old Fortran program that is part of the RMCProfile software suite. StoG means "S(Q) to G(r)" for the fact that it takes recirpocal-space S(Q) patterns from files and transforms them into a single G(r) pattern. The original StoG program has been developed, in reverse chronological order, by:

  • Matthew Tucker and Martin Dove (~2009)
  • Spencer Howells (~1989)
  • Jack Carpenter (prior to 1989)

A current state of the StoG program is kept in the fortran directory of this package.

This project was initially just a "sandbox" for taking the capabilities of StoG and migrating them over to the Mantid Framework. Yet, with more and more use cases, PyStoG was further developed as the stand-alone project it is now. Yet, migration to the Mantid Framework is still a goal since it feeds into the ADDIE project

Installation

Installation is available via pip:

pip install pystog

And conda:

conda install -c neutrons pystog

Getting started

Once installed, you can access the packages classes that perform the function manipulation.

import pystog
from pystog import Converter
from pystog import Transformer
from pystog import FourierFilter
from pystog import StoG

** WARNING: Testing of the CLI is still ongoing**

A CLI command is also included, which can be run with JSON input files. The script will be installed into the bin directory in your virtual environment directory. For example:

  • .pixi/envs/default/bin/
  • pystog/.venv/bin/
  • .../miniconda/envs/pystog/bin/

You can simply activate your virtual environment (pixi shell, . .venv/bin/activate, or conda activate pystog) and run pystog-cli:

pystog-cli --json <input json>

For a list of available options, run:

pystog-cli --help

An example JSON can be found here

Documentation

The official documentation is hosted on readthedocs.org: https://pystog.readthedocs.io/en/latest/

Also, a useful example reference is the PDFFourierTransform algorithm in the Mantid Framework that has similar yet limited capabilities.

Finally, tutorials in the form of Jupyter Notebooks can be launched via Binder by clicking the badge here Binder or at the top of the page.

Development

Pystog uses pixi to manage packaging and dependencies. To get started, install pixi, then install pystog by running:

cd pystog/
pixi install

Pixi will automatically create a virtual environment in pystog/.pixi/. A number of convenience "tasks" are available, and can be viewed within the pyproject.toml, or by running:

pixi task list

Testing

pytest is used to write and run the test suite.

To run the tests, simply run:

pixi run test

Any additional flags or options you desire may be passed, for example:

pixi run test some.specific:test
# or
pixi run test -vv

Formatting and Static analysis

pre-commit is used for style enforcement and static analysis. To install, after creating the environment run

pre-commit install

and it will run for every commit.

pre-commit run --all

will run it without committing.

Metadata

Release files for pystog 0.6.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pystog 0.6.7
File Size Uploaded
pystog-0.6.7.tar.gz 21.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pystog 0.6.7
File Interpreter ABI Platform
pystog-0.6.7-py3-none-any.whl Python 3 none any Details

Total release size: 21.8 MB

Release files / pystog-0.6.7.tar.gz

Download URL pystog-0.6.7.tar.gz
Size 21.8 MB
Tags Source
SHA-256 checksum
How to use checksums
588834261db77bdbccbdc5273fbed5ad8d0ed2346424b8166f284a747ee68738
BLAKE2b-256 checksum
How to use checksums
8bf365a22abe2e51ec5be26f1805ef2b957e526e8c66e0713ca268c23f9a8f91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2026.

Transparency log

Release files / pystog-0.6.7-py3-none-any.whl

Download URL pystog-0.6.7-py3-none-any.whl
Size 39.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c2ec13f7f416daf28adb17b47f3ff2197278f30db750bb95cc17cc18c740a5e
BLAKE2b-256 checksum
How to use checksums
e7ed5eec46a8762daf3411c97b5f0dcc2f8c53cb96f821843504619a39e56d7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2026.

Transparency log

Release history Release notifications | RSS feed

1.0.0

2 release files

This release

0.6.7 This release

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.7

2 release files

0.2.6

4 release files

0.2.5

4 release files

0.2.4

4 release files

0.2.3

4 release files

0.2.2

4 release files

0.2.1

4 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page