Skip to content

Commit 27ea989

Browse files
john-halloranJohn Halloran
andauthored
style: convert variables to lowercase (#159)
* style: Convert variables to lowercase * chore: Add news item * style: lowercase remaining variables * style: fix indentation on docstrings * style: rename and make public certain attributes * style: update docstring defaults --------- Co-authored-by: John Halloran <[email protected]>
1 parent 768905f commit 27ea989

File tree

3 files changed

+398
-324
lines changed

3 files changed

+398
-324
lines changed

news/lowercasing.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* <news item>
4+
5+
**Changed:**
6+
7+
* <news item>
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* Conform variable names to PEP-8
20+
21+
**Security:**
22+
23+
* <news item>

src/diffpy/snmf/main.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
import numpy as np
22
from snmf_class import SNMFOptimizer
33

4-
X0 = np.loadtxt("input/X0.txt", dtype=float)
5-
MM = np.loadtxt("input/MM.txt", dtype=float)
6-
A0 = np.loadtxt("input/A0.txt", dtype=float)
7-
Y0 = np.loadtxt("input/W0.txt", dtype=float)
8-
N, M = MM.shape
4+
# 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)
9+
10+
my_model = SNMFOptimizer(
11+
source_matrix=source_matrix_file,
12+
init_weights=init_weights_file,
13+
init_components=init_components_file,
14+
init_stretch=init_stretch_file,
15+
)
916

10-
my_model = SNMFOptimizer(MM=MM, Y0=Y0, X0=X0, A0=A0)
1117
print("Done")
12-
np.savetxt("my_norm_X.txt", my_model.X, fmt="%.6g", delimiter=" ")
13-
np.savetxt("my_norm_Y.txt", my_model.Y, fmt="%.6g", delimiter=" ")
14-
np.savetxt("my_norm_A.txt", my_model.A, fmt="%.6g", delimiter=" ")
18+
np.savetxt("my_norm_components.txt", my_model.components, fmt="%.6g", delimiter=" ")
19+
np.savetxt("my_norm_weights.txt", my_model.weights, fmt="%.6g", delimiter=" ")
20+
np.savetxt("my_norm_stretch.txt", my_model.stretch, fmt="%.6g", delimiter=" ")

0 commit comments

Comments
 (0)