Skip to content

Commit 150a416

Browse files
committed
import nmf_mapping_code as nmf
1 parent 257824a commit 150a416

File tree

4 files changed

+3
-67
lines changed

4 files changed

+3
-67
lines changed

Diff for: README.rst

-64
Original file line numberDiff line numberDiff line change
@@ -105,70 +105,6 @@ and run the following ::
105105
Getting Started
106106
---------------
107107

108-
Input:
109-
- directory: path to the directory containing the diffraction files that are to be analyzed
110-
- format: string (filepath)
111-
- eg: '/Users/zthatcher/Desktop/Data/nmf_mapping/time_data/' or . for cwd
112-
113-
- save-files (optional): boolean as to whether or not you would like to save the dataframes, plots, and
114-
components (note: pdf data saves as .cgr and xrd data saves as .xy)
115-
- format: boolean
116-
- eg: --save-files False
117-
- default: True
118-
119-
- threshold (optional and mut-exc to other thresholds): a threshold for the number of structural phases graphed (NMF components returned)
120-
- format as: integer
121-
- eg: --threshold 2
122-
- default: 10
123-
124-
- improve-thresh (optional and mut-exc to other thresholds): a threshold (between 0 and 1) for the relative improvement ratio necessary to
125-
add an additional component. Default is 0.001. 0.1 Recommended for real data.
126-
- format: float
127-
- eg: --improve-thresh 0.1
128-
- default = 0.001
129-
130-
- pca-thresh (optional and mut-exc to other thresholds): explained variance threshold for PCA component counting cutoff
131-
- format: float
132-
- eg: --pca-thresh 0.95
133-
- default = None
134-
135-
- n-iter (optional): total number of iterations to run NMF algo. Defaults to 1000. 10000 typical to publish.
136-
- format: int
137-
- eg: --n-iter 10000
138-
- default: 1000
139-
140-
- x-range (optional): the active x-range over which to run the NMF analysis (must be between shortest and
141-
longest range in the set of files)
142-
- format: pair of integers representing the lower r bound and the upper r bound with a comma between
143-
the lower and upper bound
144-
- eg: --xrange 5,10 12,15
145-
- default: entire range
146-
147-
- xrd (optional): set this option if the directory contains xy or xye files rather than gr.
148-
- format: boolean
149-
- eg: --xrd True
150-
- default: False
151-
152-
- x_units (required if xrd): set this as either twotheta or q if working with xrd data.
153-
- format: enum[str]
154-
- eg: --x_units twotheta
155-
- default: None (since --xrd defaults to False)
156-
157-
- show graphs (optional): whether you or not you would like display the images
158-
- format: boolean
159-
- eg: --show False
160-
- default: True
161-
162-
Returns:
163-
- Figure One: PDF or XRD pattern of structural phase components contributing to the NMF reconstruction
164-
- Figure Two: Weights of the phase components plotted in Figure One
165-
- Figure Three: Reconstruction error as a function of components
166-
- (Optional) Figure Four: Explained Variance plot as a function of components for PCA thresholding
167-
168-
Example:
169-
170-
nmf_mapping . --threshold 3 --xrange 5,10 --show True
171-
172108

173109
You may consult our `online documentation <https://diffpy.github.io/diffpy.nmf_mapping>`_ for tutorials and API references.
174110

Diff for: src/diffpy/nmf_mapping/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import numpy as np
88

9-
from diffpy.nmf_mapping import nmf
9+
import diffpy.nmf_mapping.nmf_mapping_code as nmf
1010

1111

1212
def boolean_string(s):

Diff for: src/diffpy/nmf_mapping/nmf_mapping_code.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from sklearn.decomposition import NMF, PCA
1717
from sklearn.exceptions import ConvergenceWarning
1818

19-
plt.style.use(all_styles["bg_style"])
19+
plt.style.use(all_styles["bg-style"])
2020
warnings.filterwarnings("ignore", category=FutureWarning)
2121
warnings.filterwarnings("ignore", category=ConvergenceWarning)
2222

Diff for: tests/test_load_data.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import numpy as np
55

6-
from diffpy.nmf_mapping import nmf
6+
import diffpy.nmf_mapping.nmf_mapping_code as nmf
77

88
dir = pathlib.Path(__file__).parent.resolve()
99

0 commit comments

Comments
 (0)