Skip to main content

PyPI Forge PythonVersion PR

CI Codecov Black Tracking

A python package implementing the stretched NMF algorithm.

This algorithm is designed to do an NMF factorization on a set of signals ignoring any uniform stretching of the signal on the independent variable axis. For example, for powder diffraction data taken from samples containing multiple chemical phases where the measurements were done at different temperatures and the materials were undergoing thermal expansion.

For more information about the diffpy.stretched-nmf library, please consult our online documentation.

Citation

If you use diffpy.stretched-nmf in a scientific publication, we would like you to cite this package as

Ran Gu, Yevgeny Rakita, Ling Lan, Zach Thatcher, Gabrielle E. Kamm, Daniel O’Nolan, Brennan McBride, Allison Wustrow, James R. Neilson, Karena W. Chapman, Qiang Du, and Simon J. L. Billinge, Stretched Non-negative Matrix Factorization, npj Comput Mater 10, 193 (2024).

Installation

The preferred method is conda:

conda config --add channels conda-forge
conda create -n diffpy.stretched-nmf_env diffpy.stretched-nmf
conda activate diffpy.stretched-nmf_env

For interactive plotting with show_plots=True, use a GUI-capable desktop environment. Conda installs use matplotlib-base, which is sufficient for plotting but still depends on an available interactive Matplotlib backend.

Alternatively, install from PyPI with pip:

pip install diffpy.stretched-nmf

For source installs (after cloning the repo):

pip install .

Quick check:

snmf --version
python -c "import diffpy.stretched_nmf; print(diffpy.stretched_nmf.__version__)"

To view the basic usage and available commands, type

snmf -h

Getting Started

You may consult our online documentation for tutorials and API references.

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 diffpy.stretched-nmf 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.

  1. Install pre-commit in your working environment by running conda install pre-commit.

  2. 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.

Improvements and fixes are always appreciated.

Before contributing, please read our Code of Conduct.

Contact

For more information on diffpy.stretched-nmf please visit the project web-page or email Simon Billinge at sbillinge@ucsb.edu.

Acknowledgements

diffpy.stretched-nmf is built and maintained with scikit-package.

Metadata

Release files for diffpy.stretched-nmf 0.3.0

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

Source distribution (sdist)

Source distribution for diffpy.stretched-nmf 0.3.0
File Size Uploaded
diffpy_stretched_nmf-0.3.0.tar.gz 153.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for diffpy.stretched-nmf 0.3.0
File Interpreter ABI Platform
diffpy_stretched_nmf-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 174.3 kB

Release files / diffpy_stretched_nmf-0.3.0.tar.gz

Download URL diffpy_stretched_nmf-0.3.0.tar.gz
Size 153.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d5158dbe622add2e37bb627c3863a141004641063c831ef4dd449da40152c301
BLAKE2b-256 checksum
How to use checksums
3e0ec6e89f9d6a4898670d330cfb35cf58fd743f197c94a3fa90b6f4fb246179
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / diffpy_stretched_nmf-0.3.0-py3-none-any.whl

Download URL diffpy_stretched_nmf-0.3.0-py3-none-any.whl
Size 20.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca8d61e85c1e677be5b548920bb8dd7d631090f88d35db963084b6fd1793a867
BLAKE2b-256 checksum
How to use checksums
d50584ca08500b951b9818812ed259c539a5b138baf7841b16abdbcfbc9b84f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7
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