Skip to content

Commit 8c9f749

Browse files
authored
Merge pull request #10 from bobleesj/cookierelease-src
Cookierelease: setup src folder structure
2 parents 5e2774b + 4534d17 commit 8c9f749

File tree

75 files changed

+163
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+163
-1
lines changed

src/diffpy/__init__.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python
2+
##############################################################################
3+
#
4+
# (c) 2024 The Trustees of Columbia University in the City of New York.
5+
# All rights reserved.
6+
#
7+
# File coded by: Billinge Group members and community contributors.
8+
#
9+
# See GitHub contributions for a more detailed list of contributors.
10+
# https://github.com/diffpy/diffpy.nmf_mapping/graphs/contributors
11+
#
12+
# See LICENSE.rst for license information.
13+
#
14+
##############################################################################
15+
16+
"""Blank namespace package for module diffpy."""
17+
18+
19+
from pkgutil import extend_path
20+
21+
__path__ = extend_path(__path__, __name__)
22+
23+
# End of file

src/diffpy/nmf_mapping/__init__.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env python
2+
##############################################################################
3+
#
4+
# (c) 2024 The Trustees of Columbia University in the City of New York.
5+
# All rights reserved.
6+
#
7+
# File coded by: Billinge Group members and community contributors.
8+
#
9+
# See GitHub contributions for a more detailed list of contributors.
10+
# https://github.com/diffpy/diffpy.nmf_mapping/graphs/contributors
11+
#
12+
# See LICENSE.rst for license information.
13+
#
14+
##############################################################################
15+
16+
"""Run NMF analysis on PDF and XRD data"""
17+
18+
# package version
19+
from diffpy.nmf_mapping.version import __version__
20+
21+
# silence the pyflakes syntax checker
22+
assert __version__ or True
23+
24+
# End of file

diffpy/nmf_mapping/nmf_mapping/nmf_mapping_code.py renamed to src/diffpy/nmf_mapping/nmf_mapping_code.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
import numpy as np
1212
import pandas as pd
1313
from bg_mpl_stylesheets.styles import all_styles
14-
from diffpy.utils.parsers.loaddata import loadData
1514
from scipy import interpolate
1615
from sklearn.decomposition import NMF, PCA
1716
from sklearn.exceptions import ConvergenceWarning
1817

18+
from diffpy.utils.parsers.loaddata import loadData
19+
1920
plt.style.use(all_styles["bg_style"])
2021
warnings.filterwarnings("ignore", category=FutureWarning)
2122
warnings.filterwarnings("ignore", category=ConvergenceWarning)

src/diffpy/nmf_mapping/tests/__init__.py

Whitespace-only changes.
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import json
2+
from pathlib import Path
3+
4+
import pytest
5+
6+
7+
@pytest.fixture
8+
def user_filesystem(tmp_path):
9+
base_dir = Path(tmp_path)
10+
home_dir = base_dir / "home_dir"
11+
home_dir.mkdir(parents=True, exist_ok=True)
12+
cwd_dir = base_dir / "cwd_dir"
13+
cwd_dir.mkdir(parents=True, exist_ok=True)
14+
15+
home_config_data = {"username": "home_username", "email": "[email protected]"}
16+
with open(home_dir / "diffpyconfig.json", "w") as f:
17+
json.dump(home_config_data, f)
18+
19+
yield tmp_path

src/diffpy/nmf_mapping/tests/debug.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env python
2+
##############################################################################
3+
#
4+
# (c) 2024 The Trustees of Columbia University in the City of New York.
5+
# All rights reserved.
6+
#
7+
# File coded by: Billinge Group members and community contributors.
8+
#
9+
# See GitHub contributions for a more detailed list of contributors.
10+
# https://github.com/diffpy/diffpy.nmf_mapping/graphs/contributors
11+
#
12+
# See LICENSE.rst for license information.
13+
#
14+
##############################################################################
15+
16+
"""
17+
Convenience module for debugging the unit tests using
18+
19+
python -m diffpy.nmf_mapping.tests.debug
20+
21+
Exceptions raised by failed tests or other errors are not caught.
22+
"""
23+
24+
25+
if __name__ == "__main__":
26+
import sys
27+
28+
from diffpy.nmf_mapping.tests import testsuite
29+
30+
pattern = sys.argv[1] if len(sys.argv) > 1 else ""
31+
suite = testsuite(pattern)
32+
suite.debug()
33+
34+
35+
# End of file

src/diffpy/nmf_mapping/tests/run.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env python
2+
##############################################################################
3+
#
4+
# (c) 2024 The Trustees of Columbia University in the City of New York.
5+
# All rights reserved.
6+
#
7+
# File coded by: Billinge Group members and community contributors.
8+
#
9+
# See GitHub contributions for a more detailed list of contributors.
10+
# https://github.com/diffpy/diffpy.nmf_mapping/graphs/contributors
11+
#
12+
# See LICENSE.rst for license information.
13+
#
14+
##############################################################################
15+
"""Convenience module for executing all unit tests with
16+
python -m \.tests.run
17+
"""
18+
19+
import sys
20+
21+
import pytest
22+
23+
if __name__ == "__main__":
24+
# show output results from every test function
25+
args = ["-v"]
26+
# show the message output for skipped and expected failure tests
27+
if len(sys.argv) > 1:
28+
args.extend(sys.argv[1:])
29+
print("pytest arguments: {}".format(args))
30+
# call pytest and exit with the return code from pytest
31+
exit_res = pytest.main(args)
32+
sys.exit(exit_res)
33+
34+
# End of file

src/diffpy/nmf_mapping/version.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python
2+
##############################################################################
3+
#
4+
# (c) 2024 The Trustees of Columbia University in the City of New York.
5+
# All rights reserved.
6+
#
7+
# File coded by: Billinge Group members and community contributors.
8+
#
9+
# See GitHub contributions for a more detailed list of contributors.
10+
# https://github.com/diffpy/diffpy.nmf_mapping/graphs/contributors
11+
#
12+
# See LICENSE.rst for license information.
13+
#
14+
##############################################################################
15+
16+
"""Definition of __version__."""
17+
18+
# We do not use the other three variables, but can be added back if needed.
19+
# __all__ = ["__date__", "__git_commit__", "__timestamp__", "__version__"]
20+
21+
# obtain version information
22+
from importlib.metadata import version
23+
24+
__version__ = version("diffpy.nmf_mapping")
25+
26+
# End of file

0 commit comments

Comments
 (0)