File tree Expand file tree Collapse file tree 8 files changed +14
-14
lines changed
Expand file tree Collapse file tree 8 files changed +14
-14
lines changed Original file line number Diff line number Diff line change 1818# package version
1919from diffpy .snmf .version import __version__
2020
21- # public API
22- from .snmf_class import SNMFOptimizer
23-
2421__all__ = ["__version__" , "SNMFOptimizer" ]
2522
2623# silence the pyflakes syntax checker
Original file line number Diff line number Diff line change 11import numpy as np
2- from snmf_class import SNMFOptimizer
2+
3+ from diffpy .snmf .snmf_class import SNMFOptimizer
34
45# Example input files (not provided)
5- init_components_file = np .loadtxt ("input /init_components.txt" , dtype = float )
6- source_matrix_file = np .loadtxt ("input /source_matrix.txt" , dtype = float )
7- init_stretch_file = np .loadtxt ("input /init_stretch.txt" , dtype = float )
8- init_weights_file = np .loadtxt ("input /init_weights.txt" , dtype = float )
6+ init_components_file = np .loadtxt ("inputs /init_components.txt" , dtype = float )
7+ source_matrix_file = np .loadtxt ("inputs /source_matrix.txt" , dtype = float )
8+ init_stretch_file = np .loadtxt ("inputs /init_stretch.txt" , dtype = float )
9+ init_weights_file = np .loadtxt ("inputs /init_weights.txt" , dtype = float )
910
1011my_model = SNMFOptimizer (
1112 source_matrix = source_matrix_file ,
Original file line number Diff line number Diff line change 33from scipy .optimize import minimize
44from scipy .sparse import coo_matrix , diags
55
6- from .plotter import SNMFPlotter
6+ from diffpy . snmf .plotter import SNMFPlotter
77
88
99class SNMFOptimizer :
@@ -626,7 +626,7 @@ def update_stretch(self):
626626 Updates matrix A using constrained optimization (equivalent to fmincon in MATLAB).
627627 """
628628
629- # Flatten A for compatibility with the optimizer (since SciPy expects 1D input )
629+ # Flatten A for compatibility with the optimizer (since SciPy expects 1D inputs )
630630 stretch_flat_initial = self .stretch .flatten ()
631631
632632 # Define the optimization function
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 33import numpy as np
44import pytest
55
6- from diffpy .snmf import SNMFOptimizer
6+ from diffpy .snmf . snmf_class import SNMFOptimizer
77
8- DATA_DIR = Path (__file__ ).parent / "input "
8+ DATA_DIR = Path (__file__ ).parent / "inputs "
99
10- # Skip the test entirely if any input file is missing
10+ # Skip the test entirely if any inputs file is missing
1111_required = [
1212 "init_components.txt" ,
1313 "source_matrix.txt" ,
@@ -39,8 +39,10 @@ def test_final_objective_below_threshold(inputs):
3939 rho = 1e12 ,
4040 eta = 610 ,
4141 random_state = 1 ,
42+ min_iter = 5 ,
43+ max_iter = 5 ,
4244 )
4345
4446 # Basic sanity check and the actual assertion
4547 assert np .isfinite (model .objective_function )
46- assert model .objective_function < 4e6
48+ assert model .objective_function < 5e6
You can’t perform that action at this time.
0 commit comments