diff --git a/news/add-docformatter.rst b/news/add-docformatter.rst new file mode 100644 index 00000000..0df46db0 --- /dev/null +++ b/news/add-docformatter.rst @@ -0,0 +1,23 @@ +**Added:** + +* Add docformatter config block to the end of the pyproject.toml file. + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/pyproject.toml b/pyproject.toml index 6a914219..e30a9dea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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?$' diff --git a/src/diffpy/snmf/io.py b/src/diffpy/snmf/io.py index 62614d05..18c3ca39 100644 --- a/src/diffpy/snmf/io.py +++ b/src/diffpy/snmf/io.py @@ -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 ---------- @@ -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. diff --git a/src/diffpy/snmf/optimizers.py b/src/diffpy/snmf/optimizers.py index 81a1b6da..ea4ecff1 100644 --- a/src/diffpy/snmf/optimizers.py +++ b/src/diffpy/snmf/optimizers.py @@ -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. diff --git a/src/diffpy/snmf/subroutines.py b/src/diffpy/snmf/subroutines.py index 9d6a6562..19abc6d5 100644 --- a/src/diffpy/snmf/subroutines.py +++ b/src/diffpy/snmf/subroutines.py @@ -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 @@ -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. @@ -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