Skip to content

ci: add docformatter config to pyproject.toml and apply them to the files #156

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 2 commits into from
Jun 18, 2025
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 news/add-docformatter.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* Add docformatter config block to the end of the pyproject.toml file.

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ exclude-file = ".codespell/ignore_lines.txt"
ignore-words = ".codespell/ignore_words.txt"
skip = "*.cif,*.dat"

[tool.docformatter]
recursive = true
wrap-summaries = 72
wrap-descriptions = 72

[tool.black]
line-length = 115
include = '\.pyi?$'
Expand Down
7 changes: 4 additions & 3 deletions src/diffpy/snmf/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@


def initialize_variables(data_input, number_of_components, data_type, sparsity=1, smoothness=1e18):
"""Determines the variables and initial values used in the SNMF algorithm.
"""Determines the variables and initial values used in the SNMF
algorithm.

Parameters
----------
Expand Down Expand Up @@ -73,8 +74,8 @@ def initialize_variables(data_input, number_of_components, data_type, sparsity=1


def load_input_signals(file_path=None):
"""Processes a directory of a series of PDF/XRD patterns into a usable
format.
"""Processes a directory of a series of PDF/XRD patterns into a
usable format.

Constructs a 2d array out of a directory of PDF/XRD patterns containing each files dependent variable
column in a new column. Constructs a 1d array containing the grid values.
Expand Down
4 changes: 2 additions & 2 deletions src/diffpy/snmf/optimizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ def get_weights(
lower_bound,
upper_bound,
):
"""Finds the weights of stretched component signals under a two-sided
constraint.
"""Finds the weights of stretched component signals under a two-
sided constraint.

Solves min J(y) = (linear_coefficient)' * y + (1/2) * y' * (quadratic coefficient) * y where
lower_bound <= y <= upper_bound and stretched_component_gram_matrix is symmetric positive definite.
Expand Down
11 changes: 6 additions & 5 deletions src/diffpy/snmf/subroutines.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ def reconstruct_signal(components, signal_idx):


def initialize_arrays(number_of_components, number_of_moments, signal_length):
"""Generates the initial guesses for the weight, stretching, and component
matrices.
"""Generates the initial guesses for the weight, stretching, and
component matrices.

Calculates the initial guesses for the component matrix, stretching factor matrix, and weight matrix. The
initial guess for the component matrix is a random (signal_length) x (number_of_components) matrix where
Expand Down Expand Up @@ -255,7 +255,8 @@ def objective_function(
component_matrix,
sparsity,
):
"""Defines the objective function of the algorithm and returns its value.
"""Defines the objective function of the algorithm and returns its
value.

Calculates the value of '(||residual_matrix||_F) ** 2 + smoothness * (||smoothness_term *
stretching_factor_matrix.T||)**2 + sparsity * sum(component_matrix ** .5)' and returns its value.
Expand Down Expand Up @@ -437,8 +438,8 @@ def get_residual_matrix(
component_amount,
signal_length,
):
"""Obtains the residual matrix between the experimental data and calculated
data.
"""Obtains the residual matrix between the experimental data and
calculated data.

Calculates the difference between the experimental data and the reconstructed experimental data created from
the calculated components, weights, and stretching factors. For each experimental pattern, the stretched and
Expand Down
Loading