Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
56f89a1
Initial commit of John refactor of SNMF (#140)
john-halloran Apr 1, 2025
36d2c90
fix stop condition and add Y/A normalization (#141)
john-halloran Apr 9, 2025
156511e
Added x normalization (#143)
john-halloran Apr 14, 2025
8613ea0
Loop cleanup and scikit-learn style parameters (#146)
john-halloran Apr 30, 2025
373da11
feat: Add random state feature. (#150)
john-halloran Jun 15, 2025
768905f
refactor: Remove old tests and source files (#160)
john-halloran Jun 19, 2025
27ea989
style: convert variables to lowercase (#159)
john-halloran Jun 21, 2025
d194af5
Fixes to class attributes and style (#163)
john-halloran Jul 22, 2025
1b49701
Restored functionality to working state (#165)
john-halloran Aug 12, 2025
0bf62a8
feat: add live plotting of updates (#166)
john-halloran Aug 12, 2025
dae2f8e
test: add initial test of optimizer (#167)
john-halloran Aug 13, 2025
9cbd801
Replace 1D apply_interpolation with np.interp (#168)
john-halloran Aug 14, 2025
de54a43
refactor: reconstruct separate from residuals (#169)
john-halloran Aug 20, 2025
3c54016
refactor: move optimization out of init and into fit (#170)
john-halloran Aug 24, 2025
d83619e
refactor: apply_interpolation_matrix() is now compute_stretched_compo…
john-halloran Aug 25, 2025
9b0c509
refactor: change get_objective_function into a static method and gett…
john-halloran Nov 26, 2025
026538c
skpkg: apply black to all files in the project directory (#176)
john-halloran Jan 29, 2026
d18b930
chore: update package to latest scikit-package version (#178)
john-halloran Jan 31, 2026
f10029a
feat: skip updating stretch if stretching factor is zero (#181)
john-halloran Feb 8, 2026
cd09796
docs: revamp documentation (#182)
john-halloran Feb 10, 2026
25a3b39
refactor: change references of snmf to stretched-nmf (#185)
john-halloran Feb 18, 2026
f7f2129
Merge upstream/main into john-development (prefer rewrite on conflicts)
Feb 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .codespell/ignore_words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ mater

;; Frobenius norm used in np.linalg.norm
fro

;; alternative spelling of socioeconomic used in code of conduct
socio-economic
4 changes: 2 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ exclude =
__pycache__,
build,
dist,
doc/source/conf.py
max-line-length = 115
docs/source/conf.py
max-line-length = 79
# Ignore some style 'errors' produced while formatting by 'black'
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#labels-why-pycodestyle-warnings
extend-ignore = E203
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/release_checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Please let the maintainer know that all checks are done and the package is ready
<!-- After the maintainer releases the PyPI package, please check the following when creating a PR for conda-forge release.-->

- [ ] Ensure that the full release has appeared on PyPI successfully.
- [ ] New package dependencies listed in `conda.txt` and `test.txt` are added to `meta.yaml` in the feedstock.
- [ ] New package dependencies listed in `conda.txt` and `tests.txt` are added to `meta.yaml` in the feedstock.
- [ ] Close any open issues on the feedstock. Reach out to the maintainer if you have questions.
- [ ] Tag the maintainer for conda-forge release.

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-wheel-release-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ on:
- "*" # Trigger on all tags initially, but tag and release privilege are verified in _build-wheel-release-upload.yml

jobs:
release:
build-release:
uses: scikit-package/release-scripts/.github/workflows/_build-wheel-release-upload.yml@v0
with:
project: diffpy.snmf
project: diffpy.stretched-nmf
c_extension: false
maintainer_GITHUB_username: sbillinge
secrets:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-news-item.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ jobs:
check-news-item:
uses: scikit-package/release-scripts/.github/workflows/_check-news-item.yml@v0
with:
project: diffpy.snmf
project: diffpy.stretched-nmf
2 changes: 1 addition & 1 deletion .github/workflows/matrix-and-codecov-on-merge-to-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
matrix-coverage:
uses: scikit-package/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0
with:
project: diffpy.snmf
project: diffpy.stretched-nmf
c_extension: false
headless: false
secrets:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-docs-on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ jobs:
docs:
uses: scikit-package/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0
with:
project: diffpy.snmf
project: diffpy.stretched-nmf
c_extension: false
headless: false
2 changes: 1 addition & 1 deletion .github/workflows/tests-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
tests-on-pr:
uses: scikit-package/release-scripts/.github/workflows/_tests-on-pr.yml@v0
with:
project: diffpy.snmf
project: diffpy.stretched-nmf
c_extension: false
headless: false
secrets:
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ python:
- requirements: requirements/docs.txt

sphinx:
configuration: doc/source/conf.py
configuration: docs/source/conf.py
2 changes: 1 addition & 1 deletion AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Authors
=======

Billinge Group and community contributors.
Simon Billinge, John Halloran, Billinge Group members

Contributors
------------
Expand Down
2 changes: 0 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
Release notes
=============

.. current developments

0.1.3
=====

Expand Down
133 changes: 133 additions & 0 deletions CODE-OF-CONDUCT.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
=====================================
Contributor Covenant Code of Conduct
=====================================

Our Pledge
----------

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socioeconomic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

Our Standards
-------------

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

Enforcement Responsibilities
----------------------------

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

Scope
-----

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

Enforcement
-----------

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
sb2896@columbia.edu. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

Enforcement Guidelines
----------------------

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

1. Correction
****************

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

2. Warning
*************

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

3. Temporary Ban
******************

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

4. Permanent Ban
******************

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

Attribution
-----------

This Code of Conduct is adapted from the `Contributor Covenant <https://www.contributor-covenant.org/version/2/1/code_of_conduct.html>`_.

Community Impact Guidelines were inspired by `Mozilla's code of conduct enforcement ladder <https://github.com/mozilla/inclusion>`_.

For answers to common questions about this code of conduct, see the `FAQ <https://www.contributor-covenant.org/faq>`_. `Translations are available <https://www.contributor-covenant.org/translations>`_
2 changes: 1 addition & 1 deletion LICENSE.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2023-2025, The Trustees of Columbia University in the City of New York.
Copyright (c) 2026, The Trustees of Columbia University in the City of New York.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
83 changes: 43 additions & 40 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
|Icon| |title|_
===============

.. |title| replace:: diffpy.snmf
.. _title: https://diffpy.github.io/diffpy.snmf
.. |title| replace:: diffpy.stretched-nmf
.. _title: https://diffpy.github.io/diffpy.stretched-nmf

.. |Icon| image:: https://avatars.githubusercontent.com/diffpy
:target: https://diffpy.github.io/diffpy.snmf
:target: https://diffpy.github.io/diffpy.stretched-nmf
:height: 100px

|PyPI| |Forge| |PythonVersion| |PR|
Expand All @@ -15,46 +15,42 @@
.. |Black| image:: https://img.shields.io/badge/code_style-black-black
:target: https://github.com/psf/black

.. |CI| image:: https://github.com/diffpy/diffpy.snmf/actions/workflows/matrix-and-codecov-on-merge-to-main.yml/badge.svg
:target: https://github.com/diffpy/diffpy.snmf/actions/workflows/matrix-and-codecov-on-merge-to-main.yml
.. |CI| image:: https://github.com/diffpy/diffpy.stretched-nmf/actions/workflows/matrix-and-codecov-on-merge-to-main.yml/badge.svg
:target: https://github.com/diffpy/diffpy.stretched-nmf/actions/workflows/matrix-and-codecov-on-merge-to-main.yml

.. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.snmf/branch/main/graph/badge.svg
:target: https://codecov.io/gh/diffpy/diffpy.snmf
.. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.stretched-nmf/branch/main/graph/badge.svg
:target: https://codecov.io/gh/diffpy/diffpy.stretched-nmf

.. |Forge| image:: https://img.shields.io/conda/vn/conda-forge/diffpy.snmf
:target: https://anaconda.org/conda-forge/diffpy.snmf
.. |Forge| image:: https://img.shields.io/conda/vn/conda-forge/diffpy.stretched-nmf
:target: https://anaconda.org/conda-forge/diffpy.stretched-nmf

.. |PR| image:: https://img.shields.io/badge/PR-Welcome-29ab47ff
:target: https://github.com/diffpy/diffpy.stretched-nmf/pulls

.. |PyPI| image:: https://img.shields.io/pypi/v/diffpy.snmf
:target: https://pypi.org/project/diffpy.snmf/
.. |PyPI| image:: https://img.shields.io/pypi/v/diffpy.stretched-nmf
:target: https://pypi.org/project/diffpy.stretched-nmf/

.. |PythonVersion| image:: https://img.shields.io/pypi/pyversions/diffpy.snmf
:target: https://pypi.org/project/diffpy.snmf/
.. |PythonVersion| image:: https://img.shields.io/pypi/pyversions/diffpy.stretched-nmf
:target: https://pypi.org/project/diffpy.stretched-nmf/

.. |Tracking| image:: https://img.shields.io/badge/issue_tracking-github-blue
:target: https://github.com/diffpy/diffpy.snmf/issues
:target: https://github.com/diffpy/diffpy.stretched-nmf/issues

A python package implementing the stretched NMF algorithm.

``diffpy.snmf`` implements the stretched non negative matrix factorization (sNMF) and sparse stretched NMF
(ssNMF) algorithms.

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.snmf library, please consult our `online documentation <https://diffpy.github.io/diffpy.snmf>`_.
For more information about the diffpy.stretched-nmf library, please consult our `online documentation <https://diffpy.github.io/diffpy.stretched-nmf>`_.

Citation
--------

If you use this program for a scientific research that leads
to publication, we ask that you acknowledge use of the program
by citing the following paper in your publication:
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,
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
<https://doi.org/10.1038/s41524-024-01377-5>`__,
*npj Comput Mater* **10**, 193 (2024).
Expand All @@ -71,42 +67,49 @@ To add "conda-forge" to the conda channels, run the following in a terminal. ::
conda config --add channels conda-forge

We want to install our packages in a suitable conda environment.
The following creates and activates a new environment named ``diffpy.snmf_env`` ::

conda create -n diffpy.snmf_env diffpy.snmf
conda activate diffpy.snmf_env

To confirm that the installation was successful, type ::
The following creates and activates a new environment named ``diffpy.stretched-nmf_env`` ::

python -c "import diffpy.snmf; print(diffpy.snmf.__version__)"
conda create -n diffpy.stretched-nmf_env diffpy.stretched-nmf
conda activate diffpy.stretched-nmf_env

The output should print the latest version displayed on the badges above.

If the above does not work, you can use ``pip`` to download and install the latest release from
`Python Package Index <https://pypi.python.org>`_.
To install using ``pip`` into your ``diffpy.snmf_env`` environment, type ::
To install using ``pip`` into your ``diffpy.stretched-nmf_env`` environment, type ::

pip install diffpy.snmf
pip install diffpy.stretched-nmf

If you prefer to install from sources, after installing the dependencies, obtain the source archive from
`GitHub <https://github.com/diffpy/diffpy.snmf/>`_. Once installed, ``cd`` into your ``diffpy.snmf`` directory
`GitHub <https://github.com/diffpy/diffpy.stretched-nmf/>`_. Once installed, ``cd`` into your ``diffpy.stretched-nmf`` directory
and run the following ::

pip install .

This package also provides command-line utilities. To check the software has been installed correctly, type ::

diffpy.stretched-nmf --version

You can also type the following command to verify the installation. ::

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


To view the basic usage and available commands, type ::

diffpy.stretched-nmf -h

Getting Started
---------------

You may consult our `online documentation <https://diffpy.github.io/diffpy.snmf>`_ for tutorials and API references.
You may consult our `online documentation <https://diffpy.github.io/diffpy.stretched-nmf>`_ for tutorials and API references.

Support and Contribute
----------------------

`Diffpy user group <https://groups.google.com/g/diffpy-users>`_ is the discussion forum for general questions and discussions about the use of diffpy.snmf. Please join the diffpy.snmf users community by joining the Google group. The diffpy.snmf project welcomes your expertise and enthusiasm!

If you see a bug or want to request a feature, please `report it as an issue <https://github.com/diffpy/diffpy.snmf/issues>`_ and/or `submit a fix as a PR <https://github.com/diffpy/diffpy.snmf/pulls>`_. You can also post it to the `Diffpy user group <https://groups.google.com/g/diffpy-users>`_.
If you see a bug or want to request a feature, please `report it as an issue <https://github.com/diffpy/diffpy.stretched-nmf/issues>`_ and/or `submit a fix as a PR <https://github.com/diffpy/diffpy.stretched-nmf/pulls>`_.

Feel free to fork the project and contribute. To install diffpy.snmf
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 ::
Expand All @@ -127,14 +130,14 @@ trying to commit again.

Improvements and fixes are always appreciated.

Before contributing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.snmf/blob/main/CODE_OF_CONDUCT.rst>`_.
Before contributing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.stretched-nmf/blob/main/CODE-OF-CONDUCT.rst>`_.

Contact
-------

For more information on diffpy.snmf please visit the project `web-page <https://diffpy.github.io/>`_ or email Simon J.L. Billinge group at sb2896@columbia.edu.
For more information on diffpy.stretched-nmf please visit the project `web-page <https://diffpy.github.io/>`_ or email Simon Billinge at sb2896@columbia.edu.

Acknowledgements
----------------

``diffpy.snmf`` is built and maintained with `scikit-package <https://scikit-package.github.io/scikit-package/>`_.
``diffpy.stretched-nmf`` is built and maintained with `scikit-package <https://scikit-package.github.io/scikit-package/>`_.
Loading
Loading