Skip to content

Commit 1231d71

Browse files
authored
ci: add docformatter config to pyproject.toml and apply them to the files (#156)
* ci: add docformatter config block and run pre-commit to apply them to files * chore: add news file for this change
1 parent 3af38ad commit 1231d71

File tree

5 files changed

+40
-10
lines changed

5 files changed

+40
-10
lines changed

news/add-docformatter.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* Add docformatter config block to the end of the pyproject.toml file.
4+
5+
**Changed:**
6+
7+
* <news item>
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* <news item>
20+
21+
**Security:**
22+
23+
* <news item>

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ exclude-file = ".codespell/ignore_lines.txt"
5959
ignore-words = ".codespell/ignore_words.txt"
6060
skip = "*.cif,*.dat"
6161

62+
[tool.docformatter]
63+
recursive = true
64+
wrap-summaries = 72
65+
wrap-descriptions = 72
66+
6267
[tool.black]
6368
line-length = 115
6469
include = '\.pyi?$'

src/diffpy/snmf/io.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88

99
def initialize_variables(data_input, number_of_components, data_type, sparsity=1, smoothness=1e18):
10-
"""Determines the variables and initial values used in the SNMF algorithm.
10+
"""Determines the variables and initial values used in the SNMF
11+
algorithm.
1112
1213
Parameters
1314
----------
@@ -73,8 +74,8 @@ def initialize_variables(data_input, number_of_components, data_type, sparsity=1
7374

7475

7576
def load_input_signals(file_path=None):
76-
"""Processes a directory of a series of PDF/XRD patterns into a usable
77-
format.
77+
"""Processes a directory of a series of PDF/XRD patterns into a
78+
usable format.
7879
7980
Constructs a 2d array out of a directory of PDF/XRD patterns containing each files dependent variable
8081
column in a new column. Constructs a 1d array containing the grid values.

src/diffpy/snmf/optimizers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ def get_weights(
88
lower_bound,
99
upper_bound,
1010
):
11-
"""Finds the weights of stretched component signals under a two-sided
12-
constraint.
11+
"""Finds the weights of stretched component signals under a two-
12+
sided constraint.
1313
1414
Solves min J(y) = (linear_coefficient)' * y + (1/2) * y' * (quadratic coefficient) * y where
1515
lower_bound <= y <= upper_bound and stretched_component_gram_matrix is symmetric positive definite.

src/diffpy/snmf/subroutines.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ def reconstruct_signal(components, signal_idx):
211211

212212

213213
def initialize_arrays(number_of_components, number_of_moments, signal_length):
214-
"""Generates the initial guesses for the weight, stretching, and component
215-
matrices.
214+
"""Generates the initial guesses for the weight, stretching, and
215+
component matrices.
216216
217217
Calculates the initial guesses for the component matrix, stretching factor matrix, and weight matrix. The
218218
initial guess for the component matrix is a random (signal_length) x (number_of_components) matrix where
@@ -255,7 +255,8 @@ def objective_function(
255255
component_matrix,
256256
sparsity,
257257
):
258-
"""Defines the objective function of the algorithm and returns its value.
258+
"""Defines the objective function of the algorithm and returns its
259+
value.
259260
260261
Calculates the value of '(||residual_matrix||_F) ** 2 + smoothness * (||smoothness_term *
261262
stretching_factor_matrix.T||)**2 + sparsity * sum(component_matrix ** .5)' and returns its value.
@@ -437,8 +438,8 @@ def get_residual_matrix(
437438
component_amount,
438439
signal_length,
439440
):
440-
"""Obtains the residual matrix between the experimental data and calculated
441-
data.
441+
"""Obtains the residual matrix between the experimental data and
442+
calculated data.
442443
443444
Calculates the difference between the experimental data and the reconstructed experimental data created from
444445
the calculated components, weights, and stretching factors. For each experimental pattern, the stretched and

0 commit comments

Comments
 (0)