Skip to content

Commit fb15602

Browse files
committed
skpkg: migrate src folder
1 parent 542b1d6 commit fb15602

File tree

5 files changed

+54
-23
lines changed

5 files changed

+54
-23
lines changed

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,17 @@ repos:
5050
- id: codespell
5151
additional_dependencies:
5252
- tomli
53+
# prettier - multi formatter for .json, .yml, and .md files
54+
- repo: https://github.com/pre-commit/mirrors-prettier
55+
rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8
56+
hooks:
57+
- id: prettier
58+
additional_dependencies:
59+
- "prettier@^3.2.4"
60+
# docformatter - PEP 257 compliant docstring formatter
61+
- repo: https://github.com/s-weigand/docformatter
62+
rev: 5757c5190d95e5449f102ace83df92e7d3b06c6c
63+
hooks:
64+
- id: docformatter
65+
additional_dependencies: [tomli]
66+
args: [--in-place, --config, ./pyproject.toml]

src/diffpy/__init__.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
11
#!/usr/bin/env python
22
##############################################################################
33
#
4-
# (c) 2024 The Trustees of Columbia University in the City of New York.
4+
# (c) 2025 The Trustees of Columbia University in the City of New York.
55
# All rights reserved.
66
#
77
# File coded by: Billinge Group members and community contributors.
88
#
99
# See GitHub contributions for a more detailed list of contributors.
10-
# https://github.com/diffpy/diffpy.pdfmorph/graphs/contributors
10+
# https://github.com/diffpy/diffpy.morph/graphs/contributors
1111
#
1212
# See LICENSE.rst for license information.
1313
#
1414
##############################################################################
15-
"""morph - tools for manipulating and comparing PDF data.
16-
17-
"""
18-
19-
20-
from pkgutil import extend_path
21-
22-
__path__ = extend_path(__path__, __name__)
23-
24-
# End of file

src/diffpy/morph/__init__.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
#!/usr/bin/env python
22
##############################################################################
33
#
4-
# (c) 2024 The Trustees of Columbia University in the City of New York.
4+
# (c) 2025 The Trustees of Columbia University in the City of New York.
55
# All rights reserved.
66
#
7-
# File coded by: Billinge Group members and community contributors.
7+
# File coded by: Sangjoon Lee, Simon Billinge, Billinge Group members.
88
#
99
# See GitHub contributions for a more detailed list of contributors.
1010
# https://github.com/diffpy/diffpy.morph/graphs/contributors
1111
#
1212
# See LICENSE.rst for license information.
1313
#
1414
##############################################################################
15-
"""Tools for manipulating and comparing PDF profiles."""
16-
17-
# key used when saving multiple morphs
18-
__save_morph_as__ = "save_morph_as"
15+
"""Python package for manipulating and comparing PDF profiles."""
1916

2017
# package version
21-
from diffpy.morph.version import __version__
18+
from diffpy.morph.version import __version__ # noqa
2219

2320
# silence the pyflakes syntax checker
2421
assert __version__ or True
2522

26-
2723
# End of file

src/diffpy/morph/functions.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import numpy as np
2+
3+
4+
def dot_product(a, b):
5+
"""Compute the dot product of two vectors of any size.
6+
7+
Ensure that the inputs, a and b, are of the same size.
8+
The supported types are "array_like" objects, which can
9+
be converted to a NumPy array. Examples include lists and tuples.
10+
11+
Parameters
12+
----------
13+
a : array_like
14+
The first input vector.
15+
b : array_like
16+
The second input vector.
17+
18+
Returns
19+
-------
20+
float
21+
The dot product of the two vectors.
22+
23+
Examples
24+
--------
25+
Compute the dot product of two lists:
26+
>>> a = [1, 2, 3]
27+
>>> b = [4, 5, 6]
28+
>>> dot_product(a, b)
29+
32.0
30+
"""
31+
return float(np.dot(a, b))

src/diffpy/morph/version.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env python
22
##############################################################################
33
#
4-
# (c) 2024 The Trustees of Columbia University in the City of New York.
4+
# (c) 2025 The Trustees of Columbia University in the City of New York.
55
# All rights reserved.
66
#
7-
# File coded by: Billinge Group members and community contributors.
7+
# File coded by: Sangjoon Lee, Simon Billinge, Billinge Group members.
88
#
99
# See GitHub contributions for a more detailed list of contributors.
10-
# https://github.com/diffpy/diffpy.pdfmorph/graphs/contributors
10+
# https://github.com/diffpy/diffpy.morph/graphs/contributors # noqa: E501
1111
#
1212
# See LICENSE.rst for license information.
1313
#

0 commit comments

Comments
 (0)