File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,6 +69,10 @@ The preferred method is conda::
6969 conda create -n diffpy.stretched-nmf_env diffpy.stretched-nmf
7070 conda activate diffpy.stretched-nmf_env
7171
72+ For interactive plotting with ``show_plots=True ``, use a GUI-capable desktop
73+ environment. Conda installs use ``matplotlib-base ``, which is sufficient for
74+ plotting but still depends on an available interactive Matplotlib backend.
75+
7276Alternatively, install from PyPI with pip::
7377
7478 pip install diffpy.stretched-nmf
@@ -79,13 +83,13 @@ For source installs (after cloning the repo)::
7983
8084Quick check::
8185
82- diffpy.stretched-nmf --version
86+ snmf --version
8387 python -c "import diffpy.stretched_nmf; print(diffpy.stretched_nmf.__version__)"
8488
8589
8690To view the basic usage and available commands, type ::
8791
88- diffpy.stretched-nmf -h
92+ snmf -h
8993
9094Getting Started
9195---------------
Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ The preferred method is conda:
1717 conda create -n diffpy.stretched-nmf_env diffpy.stretched-nmf
1818 conda activate diffpy.stretched-nmf_env
1919
20+ For interactive plotting with ``show_plots=True ``, use a GUI-capable desktop
21+ environment. Conda installs use ``matplotlib-base ``, which is sufficient for
22+ plotting but still depends on an available interactive Matplotlib backend.
23+
2024Alternatively, install from PyPI with pip:
2125
2226.. code-block :: bash
@@ -36,7 +40,7 @@ Verify the CLI and Python import:
3640
3741.. code-block :: bash
3842
39- diffpy.stretched-nmf --version
43+ snmf --version
4044 python -c " import diffpy.stretched_nmf; print(diffpy.stretched_nmf.__version__)"
4145
4246 Basic usage
Original file line number Diff line number Diff line change 1+ **Added: **
2+
3+ * <news item>
4+
5+ **Changed: **
6+
7+ * Rename cli entrypoint to 'snmf' from 'diffpy.stretched-nmf'
8+
9+ **Deprecated: **
10+
11+ * <news item>
12+
13+ **Removed: **
14+
15+ * <news item>
16+
17+ **Fixed: **
18+
19+ * Produce an error if test files are missing
20+ * Use matplotlib-base when installing with conda-forge
21+
22+ **Security: **
23+
24+ * <news item>
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ exclude = [] # exclude packages matching these glob patterns (empty by default)
4949namespaces = false # to disable scanning PEP 420 namespaces (true by default)
5050
5151[project .scripts ]
52- "diffpy.stretched-nmf " = " diffpy.stretched_nmf.snmf_app:main"
52+ "snmf " = " diffpy.stretched_nmf.snmf_app:main"
5353
5454[tool .setuptools .dynamic ]
5555dependencies = {file = [" requirements/pip.txt" ]}
Original file line number Diff line number Diff line change 11numpy
2- matplotlib
2+ matplotlib-base
33scipy
44cvxpy
55diffpy.utils
Original file line number Diff line number Diff line change 55
66def main ():
77 parser = argparse .ArgumentParser (
8- prog = "diffpy.stretched-nmf " ,
8+ prog = "snmf " ,
99 description = (
1010 "A python package implementing the stretched NMF algorithm.\n \n "
11+ "Currently, this project is used by importing "
12+ "`SNMFOptimizer` in Python rather than through a command-line "
13+ "workflow.\n \n "
1114 "For more information, visit: "
1215 "https://github.com/diffpy/diffpy.stretched-nmf/"
1316 ),
@@ -23,7 +26,7 @@ def main():
2326 args = parser .parse_args ()
2427
2528 if args .version :
26- print (f"diffpy.stretched-nmf { __version__ } " )
29+ print (f"snmf { __version__ } " )
2730 else :
2831 # Default behavior when no arguments are given
2932 parser .print_help ()
Original file line number Diff line number Diff line change 55
66from diffpy .stretched_nmf .snmf_class import SNMFOptimizer
77
8- DATA_DIR = Path (__file__ ).parent / "inputs/test_snmf_optimizer"
8+ DATA_DIR = (
9+ Path (__file__ ).resolve ().parents [1 ]
10+ / "docs/examples/data/XRD-MgMnO-YCl-real"
11+ )
912
10- # Skip the test entirely if any inputs file is missing
1113_required = [
1214 "init-components.txt" ,
1315 "source-matrix.txt" ,
1416 "init-stretch.txt" ,
1517 "init-weights.txt" ,
1618]
1719_missing = [f for f in _required if not (DATA_DIR / f ).exists ()]
18- pytestmark = pytest .mark .skipif (
19- _missing , reason = f"Missing test data files: { _missing } "
20- )
2120
2221
2322@pytest .fixture (scope = "module" )
2423def inputs ():
24+ if _missing :
25+ pytest .fail (
26+ f"Missing required test data files in { DATA_DIR } : { _missing } "
27+ )
2528 return {
2629 "components" : np .loadtxt (
2730 DATA_DIR / "init-components.txt" , dtype = float
2831 ),
29- "source" : np .loadtxt (DATA_DIR / "source-matrix.txt" , dtype = float ),
32+ "source" : np .loadtxt (
33+ DATA_DIR / "source-matrix.txt" , dtype = float , skiprows = 4
34+ ),
3035 "stretch" : np .loadtxt (DATA_DIR / "init-stretch.txt" , dtype = float ),
3136 "weights" : np .loadtxt (DATA_DIR / "init-weights.txt" , dtype = float ),
3237 }
You can’t perform that action at this time.
0 commit comments