Skip to content

Commit cdb3269

Browse files
author
John Halloran
committed
style: rename apply_interpolation_matrix() to compute_stretched_components()
1 parent 52ab77c commit cdb3269

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/diffpy/snmf/snmf_class.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def get_objective_function(self, residuals=None, stretch=None):
370370
function = residual_term + regularization_term + sparsity_term
371371
return function
372372

373-
def apply_interpolation_matrix(self, components=None, weights=None, stretch=None):
373+
def compute_stretched_components(self, components=None, weights=None, stretch=None):
374374
"""
375375
Interpolates each component along its sample axis according to per-(component, signal)
376376
stretch factors, then applies per-(component, signal) weights. Also computes the
@@ -563,7 +563,7 @@ def update_components(self):
563563
Updates `components` using gradient-based optimization with adaptive step size.
564564
"""
565565
# Compute stretched components using the interpolation function
566-
stretched_components, _, _ = self.apply_interpolation_matrix() # Discard the derivatives
566+
stretched_components, _, _ = self.compute_stretched_components() # Discard the derivatives
567567
# Compute reshaped_stretched_components and component_residuals
568568
intermediate_reshaped = stretched_components.flatten(order="F").reshape(
569569
(self.signal_length * self.n_signals, self.n_components), order="F"
@@ -651,7 +651,9 @@ def regularize_function(self, stretch=None):
651651
if stretch is None:
652652
stretch = self.stretch_
653653

654-
stretched_components, d_stretch_comps, dd_stretch_comps = self.apply_interpolation_matrix(stretch=stretch)
654+
stretched_components, d_stretch_comps, dd_stretch_comps = self.compute_stretched_components(
655+
stretch=stretch
656+
)
655657
intermediate = stretched_components.flatten(order="F").reshape(
656658
(self.signal_length * self.n_signals, self.n_components), order="F"
657659
)
@@ -754,8 +756,8 @@ def reconstruct_matrix(components, weights, stretch):
754756
"""
755757

756758
signal_len = components.shape[0]
757-
n_signals = weights.shape[1]
758759
n_components = components.shape[1]
760+
n_signals = weights.shape[1]
759761

760762
reconstructed_matrix = np.zeros((signal_len, n_signals))
761763
sample_indices = np.arange(signal_len)

0 commit comments

Comments
 (0)