diff --git a/src/diffpy/__init__.py b/src/diffpy/__init__.py new file mode 100644 index 0000000..58c58be --- /dev/null +++ b/src/diffpy/__init__.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python +############################################################################## +# +# (c) 2024 The Trustees of Columbia University in the City of New York. +# All rights reserved. +# +# File coded by: Billinge Group members and community contributors. +# +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.nmf_mapping/graphs/contributors +# +# See LICENSE.rst for license information. +# +############################################################################## + +"""Blank namespace package for module diffpy.""" + + +from pkgutil import extend_path + +__path__ = extend_path(__path__, __name__) + +# End of file diff --git a/src/diffpy/nmf_mapping/__init__.py b/src/diffpy/nmf_mapping/__init__.py new file mode 100644 index 0000000..e39ac48 --- /dev/null +++ b/src/diffpy/nmf_mapping/__init__.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +############################################################################## +# +# (c) 2024 The Trustees of Columbia University in the City of New York. +# All rights reserved. +# +# File coded by: Billinge Group members and community contributors. +# +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.nmf_mapping/graphs/contributors +# +# See LICENSE.rst for license information. +# +############################################################################## + +"""Run NMF analysis on PDF and XRD data""" + +# package version +from diffpy.nmf_mapping.version import __version__ + +# silence the pyflakes syntax checker +assert __version__ or True + +# End of file diff --git a/diffpy/nmf_mapping/nmf_mapping/main.py b/src/diffpy/nmf_mapping/main.py similarity index 100% rename from diffpy/nmf_mapping/nmf_mapping/main.py rename to src/diffpy/nmf_mapping/main.py diff --git a/diffpy/nmf_mapping/nmf_mapping/nmf_mapping_code.py b/src/diffpy/nmf_mapping/nmf_mapping_code.py similarity index 99% rename from diffpy/nmf_mapping/nmf_mapping/nmf_mapping_code.py rename to src/diffpy/nmf_mapping/nmf_mapping_code.py index 4ad293a..1d9b496 100644 --- a/diffpy/nmf_mapping/nmf_mapping/nmf_mapping_code.py +++ b/src/diffpy/nmf_mapping/nmf_mapping_code.py @@ -11,11 +11,12 @@ import numpy as np import pandas as pd from bg_mpl_stylesheets.styles import all_styles -from diffpy.utils.parsers.loaddata import loadData from scipy import interpolate from sklearn.decomposition import NMF, PCA from sklearn.exceptions import ConvergenceWarning +from diffpy.utils.parsers.loaddata import loadData + plt.style.use(all_styles["bg_style"]) warnings.filterwarnings("ignore", category=FutureWarning) warnings.filterwarnings("ignore", category=ConvergenceWarning) diff --git a/src/diffpy/nmf_mapping/tests/__init__.py b/src/diffpy/nmf_mapping/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/diffpy/nmf_mapping/tests/conftest.py b/src/diffpy/nmf_mapping/tests/conftest.py new file mode 100644 index 0000000..e3b6313 --- /dev/null +++ b/src/diffpy/nmf_mapping/tests/conftest.py @@ -0,0 +1,19 @@ +import json +from pathlib import Path + +import pytest + + +@pytest.fixture +def user_filesystem(tmp_path): + base_dir = Path(tmp_path) + home_dir = base_dir / "home_dir" + home_dir.mkdir(parents=True, exist_ok=True) + cwd_dir = base_dir / "cwd_dir" + cwd_dir.mkdir(parents=True, exist_ok=True) + + home_config_data = {"username": "home_username", "email": "home@email.com"} + with open(home_dir / "diffpyconfig.json", "w") as f: + json.dump(home_config_data, f) + + yield tmp_path diff --git a/diffpy/nmf_mapping/tests/data/different_r_grid/DIPA-H2O_3mmglass_20190908-061431_e3086a_0001_dark_corrected_img.gr b/src/diffpy/nmf_mapping/tests/data/different_r_grid/DIPA-H2O_3mmglass_20190908-061431_e3086a_0001_dark_corrected_img.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/different_r_grid/DIPA-H2O_3mmglass_20190908-061431_e3086a_0001_dark_corrected_img.gr rename to src/diffpy/nmf_mapping/tests/data/different_r_grid/DIPA-H2O_3mmglass_20190908-061431_e3086a_0001_dark_corrected_img.gr diff --git a/diffpy/nmf_mapping/tests/data/different_r_grid/MgTi2O4_cryobraket_ly_20190524-200934_temperature_400,63_degK_33b844_0063_dark_corrected_img.gr b/src/diffpy/nmf_mapping/tests/data/different_r_grid/MgTi2O4_cryobraket_ly_20190524-200934_temperature_400,63_degK_33b844_0063_dark_corrected_img.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/different_r_grid/MgTi2O4_cryobraket_ly_20190524-200934_temperature_400,63_degK_33b844_0063_dark_corrected_img.gr rename to src/diffpy/nmf_mapping/tests/data/different_r_grid/MgTi2O4_cryobraket_ly_20190524-200934_temperature_400,63_degK_33b844_0063_dark_corrected_img.gr diff --git a/diffpy/nmf_mapping/tests/data/example_phases/LiO2.cif b/src/diffpy/nmf_mapping/tests/data/example_phases/LiO2.cif similarity index 100% rename from diffpy/nmf_mapping/tests/data/example_phases/LiO2.cif rename to src/diffpy/nmf_mapping/tests/data/example_phases/LiO2.cif diff --git a/diffpy/nmf_mapping/tests/data/example_phases/RuO2_tetragonal.cif b/src/diffpy/nmf_mapping/tests/data/example_phases/RuO2_tetragonal.cif similarity index 100% rename from diffpy/nmf_mapping/tests/data/example_phases/RuO2_tetragonal.cif rename to src/diffpy/nmf_mapping/tests/data/example_phases/RuO2_tetragonal.cif diff --git a/diffpy/nmf_mapping/tests/data/example_phases/Ru_mp-8639_conventional_standard.cif b/src/diffpy/nmf_mapping/tests/data/example_phases/Ru_mp-8639_conventional_standard.cif similarity index 100% rename from diffpy/nmf_mapping/tests/data/example_phases/Ru_mp-8639_conventional_standard.cif rename to src/diffpy/nmf_mapping/tests/data/example_phases/Ru_mp-8639_conventional_standard.cif diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic0.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic0.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic0.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic0.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic1.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic1.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic1.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic1.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic10.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic10.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic10.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic10.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic11.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic11.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic11.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic11.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic12.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic12.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic12.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic12.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic13.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic13.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic13.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic13.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic14.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic14.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic14.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic14.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic15.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic15.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic15.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic15.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic16.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic16.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic16.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic16.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic17.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic17.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic17.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic17.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic18.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic18.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic18.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic18.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic19.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic19.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic19.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic19.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic2.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic2.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic2.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic2.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic20.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic20.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic20.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic20.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic21.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic21.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic21.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic21.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic22.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic22.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic22.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic22.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic23.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic23.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic23.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic23.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic24.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic24.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic24.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic24.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic25.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic25.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic25.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic25.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic26.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic26.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic26.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic26.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic27.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic27.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic27.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic27.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic28.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic28.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic28.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic28.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic29.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic29.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic29.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic29.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic3.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic3.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic3.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic3.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic30.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic30.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic30.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic30.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic31.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic31.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic31.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic31.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic32.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic32.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic32.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic32.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic33.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic33.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic33.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic33.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic34.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic34.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic34.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic34.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic35.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic35.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic35.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic35.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic36.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic36.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic36.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic36.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic37.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic37.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic37.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic37.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic38.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic38.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic38.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic38.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic39.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic39.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic39.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic39.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic4.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic4.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic4.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic4.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic40.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic40.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic40.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic40.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic41.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic41.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic41.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic41.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic42.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic42.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic42.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic42.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic43.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic43.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic43.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic43.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic44.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic44.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic44.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic44.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic45.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic45.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic45.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic45.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic46.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic46.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic46.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic46.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic47.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic47.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic47.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic47.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic48.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic48.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic48.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic48.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic49.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic49.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic49.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic49.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic5.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic5.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic5.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic5.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic6.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic6.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic6.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic6.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic7.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic7.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic7.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic7.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic8.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic8.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic8.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic8.gr diff --git a/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic9.gr b/src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic9.gr similarity index 100% rename from diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic9.gr rename to src/diffpy/nmf_mapping/tests/data/synthetic_r_vs_gr/synthetic9.gr diff --git a/src/diffpy/nmf_mapping/tests/debug.py b/src/diffpy/nmf_mapping/tests/debug.py new file mode 100644 index 0000000..46dad2c --- /dev/null +++ b/src/diffpy/nmf_mapping/tests/debug.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +############################################################################## +# +# (c) 2024 The Trustees of Columbia University in the City of New York. +# All rights reserved. +# +# File coded by: Billinge Group members and community contributors. +# +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.nmf_mapping/graphs/contributors +# +# See LICENSE.rst for license information. +# +############################################################################## + +""" +Convenience module for debugging the unit tests using + +python -m diffpy.nmf_mapping.tests.debug + +Exceptions raised by failed tests or other errors are not caught. +""" + + +if __name__ == "__main__": + import sys + + from diffpy.nmf_mapping.tests import testsuite + + pattern = sys.argv[1] if len(sys.argv) > 1 else "" + suite = testsuite(pattern) + suite.debug() + + +# End of file diff --git a/diffpy/nmf_mapping/tests/output/output_1/component_index_vs_RE_value.json b/src/diffpy/nmf_mapping/tests/output/output_1/component_index_vs_RE_value.json similarity index 100% rename from diffpy/nmf_mapping/tests/output/output_1/component_index_vs_RE_value.json rename to src/diffpy/nmf_mapping/tests/output/output_1/component_index_vs_RE_value.json diff --git a/diffpy/nmf_mapping/tests/output/output_1/component_index_vs_pratio_col.json b/src/diffpy/nmf_mapping/tests/output/output_1/component_index_vs_pratio_col.json similarity index 100% rename from diffpy/nmf_mapping/tests/output/output_1/component_index_vs_pratio_col.json rename to src/diffpy/nmf_mapping/tests/output/output_1/component_index_vs_pratio_col.json diff --git a/diffpy/nmf_mapping/tests/output/output_1/x_index_vs_y_col_components.json b/src/diffpy/nmf_mapping/tests/output/output_1/x_index_vs_y_col_components.json similarity index 100% rename from diffpy/nmf_mapping/tests/output/output_1/x_index_vs_y_col_components.json rename to src/diffpy/nmf_mapping/tests/output/output_1/x_index_vs_y_col_components.json diff --git a/diffpy/nmf_mapping/tests/output/output_2/component_index_vs_RE_value.json b/src/diffpy/nmf_mapping/tests/output/output_2/component_index_vs_RE_value.json similarity index 100% rename from diffpy/nmf_mapping/tests/output/output_2/component_index_vs_RE_value.json rename to src/diffpy/nmf_mapping/tests/output/output_2/component_index_vs_RE_value.json diff --git a/diffpy/nmf_mapping/tests/output/output_2/component_index_vs_pratio_col.json b/src/diffpy/nmf_mapping/tests/output/output_2/component_index_vs_pratio_col.json similarity index 100% rename from diffpy/nmf_mapping/tests/output/output_2/component_index_vs_pratio_col.json rename to src/diffpy/nmf_mapping/tests/output/output_2/component_index_vs_pratio_col.json diff --git a/diffpy/nmf_mapping/tests/output/output_2/x_index_vs_y_col_components.json b/src/diffpy/nmf_mapping/tests/output/output_2/x_index_vs_y_col_components.json similarity index 100% rename from diffpy/nmf_mapping/tests/output/output_2/x_index_vs_y_col_components.json rename to src/diffpy/nmf_mapping/tests/output/output_2/x_index_vs_y_col_components.json diff --git a/diffpy/nmf_mapping/tests/output/output_3/component_index_vs_RE_value.json b/src/diffpy/nmf_mapping/tests/output/output_3/component_index_vs_RE_value.json similarity index 100% rename from diffpy/nmf_mapping/tests/output/output_3/component_index_vs_RE_value.json rename to src/diffpy/nmf_mapping/tests/output/output_3/component_index_vs_RE_value.json diff --git a/diffpy/nmf_mapping/tests/output/output_3/component_index_vs_pratio_col.json b/src/diffpy/nmf_mapping/tests/output/output_3/component_index_vs_pratio_col.json similarity index 100% rename from diffpy/nmf_mapping/tests/output/output_3/component_index_vs_pratio_col.json rename to src/diffpy/nmf_mapping/tests/output/output_3/component_index_vs_pratio_col.json diff --git a/diffpy/nmf_mapping/tests/output/output_3/x_index_vs_y_col_components.json b/src/diffpy/nmf_mapping/tests/output/output_3/x_index_vs_y_col_components.json similarity index 100% rename from diffpy/nmf_mapping/tests/output/output_3/x_index_vs_y_col_components.json rename to src/diffpy/nmf_mapping/tests/output/output_3/x_index_vs_y_col_components.json diff --git a/src/diffpy/nmf_mapping/tests/run.py b/src/diffpy/nmf_mapping/tests/run.py new file mode 100644 index 0000000..389c772 --- /dev/null +++ b/src/diffpy/nmf_mapping/tests/run.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +############################################################################## +# +# (c) 2024 The Trustees of Columbia University in the City of New York. +# All rights reserved. +# +# File coded by: Billinge Group members and community contributors. +# +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.nmf_mapping/graphs/contributors +# +# See LICENSE.rst for license information. +# +############################################################################## +"""Convenience module for executing all unit tests with +python -m \.tests.run +""" + +import sys + +import pytest + +if __name__ == "__main__": + # show output results from every test function + args = ["-v"] + # show the message output for skipped and expected failure tests + if len(sys.argv) > 1: + args.extend(sys.argv[1:]) + print("pytest arguments: {}".format(args)) + # call pytest and exit with the return code from pytest + exit_res = pytest.main(args) + sys.exit(exit_res) + +# End of file diff --git a/diffpy/nmf_mapping/tests/test_NMF_analysis_code.py b/src/diffpy/nmf_mapping/tests/test_NMF_analysis_code.py similarity index 100% rename from diffpy/nmf_mapping/tests/test_NMF_analysis_code.py rename to src/diffpy/nmf_mapping/tests/test_NMF_analysis_code.py diff --git a/diffpy/nmf_mapping/tests/test_load_data.py b/src/diffpy/nmf_mapping/tests/test_load_data.py similarity index 100% rename from diffpy/nmf_mapping/tests/test_load_data.py rename to src/diffpy/nmf_mapping/tests/test_load_data.py diff --git a/src/diffpy/nmf_mapping/version.py b/src/diffpy/nmf_mapping/version.py new file mode 100644 index 0000000..0991a0b --- /dev/null +++ b/src/diffpy/nmf_mapping/version.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +############################################################################## +# +# (c) 2024 The Trustees of Columbia University in the City of New York. +# All rights reserved. +# +# File coded by: Billinge Group members and community contributors. +# +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.nmf_mapping/graphs/contributors +# +# See LICENSE.rst for license information. +# +############################################################################## + +"""Definition of __version__.""" + +# We do not use the other three variables, but can be added back if needed. +# __all__ = ["__date__", "__git_commit__", "__timestamp__", "__version__"] + +# obtain version information +from importlib.metadata import version + +__version__ = version("diffpy.nmf_mapping") + +# End of file