Skip to content

Commit 8517d76

Browse files
authored
simon doing some syntax cleaning
1 parent 99cbc55 commit 8517d76

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

diffpy/snmf/subroutines.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ def construct_stretching_matrix(components, number_of_components, number_of_sign
6161
----------
6262
components: tuple of ComponentSignal objects
6363
The tuple containing the component signals in ComponentSignal objects.
64-
number_of_components: int
65-
The number of component signals in the NMF decomposition
6664
number_of_signals: int
6765
The number of signals in the data provided by the user.
6866
@@ -73,13 +71,16 @@ def construct_stretching_matrix(components, number_of_components, number_of_sign
7371
Has dimensions `component_signal` x `number_of_signals`
7472
7573
"""
76-
if (number_of_components <= 0) or (len(components)) == 0:
74+
if (len(components)) == 0:
7775
raise ValueError(f"Number of components = {number_of_components}. Number_of_components must be >= 1.")
76+
number_of_components = len(components)
77+
7878
if number_of_signals <= 0:
7979
raise ValueError(f"Number of signals = {number_of_signals}. Number_of_signals must be >= 1.")
80+
8081
stretching_factor_matrix = np.zeros((number_of_components, number_of_signals))
8182
for i, component in enumerate(components):
82-
stretching_factor_matrix[i, :] = component.stretching_factors
83+
stretching_factor_matrix[i] = component.stretching_factors
8384
return stretching_factor_matrix
8485

8586

0 commit comments

Comments
 (0)