Skip to content

Cookierelease: setup src folder structure #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 23 additions & 0 deletions src/diffpy/__init__.py
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions src/diffpy/nmf_mapping/__init__.py
Original file line number Diff line number Diff line change
@@ -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__
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nmf_mapping used.


# silence the pyflakes syntax checker
assert __version__ or True

# End of file
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done by pre-commit


plt.style.use(all_styles["bg_style"])
warnings.filterwarnings("ignore", category=FutureWarning)
warnings.filterwarnings("ignore", category=ConvergenceWarning)
Expand Down
Empty file.
19 changes: 19 additions & 0 deletions src/diffpy/nmf_mapping/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -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": "[email protected]"}
with open(home_dir / "diffpyconfig.json", "w") as f:
json.dump(home_config_data, f)

yield tmp_path
35 changes: 35 additions & 0 deletions src/diffpy/nmf_mapping/tests/debug.py
Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions src/diffpy/nmf_mapping/tests/run.py
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions src/diffpy/nmf_mapping/version.py
Original file line number Diff line number Diff line change
@@ -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")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nmf_mapping


# End of file
Loading