From be9f0dd6f12526321d94d1d64f7200c2c8040134 Mon Sep 17 00:00:00 2001 From: stevenhua0320 Date: Thu, 9 Apr 2026 10:52:19 -0400 Subject: [PATCH 1/3] build: add bg-mpl-stylesheet to have better plot --- docs/examples/README.rst | 26 +++++++++++++------------- requirements/conda.txt | 1 + requirements/pip.txt | 1 + src/diffpy/srmise/applications/plot.py | 3 ++- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/docs/examples/README.rst b/docs/examples/README.rst index a656fb9..1a2900a 100644 --- a/docs/examples/README.rst +++ b/docs/examples/README.rst @@ -144,7 +144,7 @@ First, plot the data without performing peak extraction. The first argument must be either a PDF (as here) or a .srmise file (described later) saved by SrMise. :: - srmise data/Ag_nyquist_qmax30.gr --no-extract --plot + srmise docs/examples/data/Ag-nyquist-qmax30.gr --no-extract --plot This should result in an image very similar to the one below. The top shows the experimental data in blue. The bottom shows the difference curve, which is @@ -160,7 +160,7 @@ performing peak extraction from around 2 Å to 3.5 Å will be sufficient. To restrict peak extraction to this interval use the ``--range`` option, which accepts a pair of values. :: - srmise data/Ag_nyquist_qmax30.gr --no-extract --plot --range 2 3.5 + srmise docs/examples/data/Ag-nyquist-qmax30.gr --no-extract --plot --range 2 3.5 The PDF baseline of a crystal is linear, and a reasonable crystal baseline can often be automatically estimated. To estimate baseline parameters @@ -170,7 +170,7 @@ baseline for which SrMise provides automatic estimation. Since the results of peak extraction are conditioned on the baseline parameters, it is a good idea to see whether they are reasonable. :: - srmise data/Ag_nyquist_qmax30.gr --no-extract --plot --range 2 3.5 + srmise docs/examples/data/Ag-nyquist-qmax30.gr --no-extract --plot --range 2 3.5 --baseline "Polynomial(degree=1)" |images/extract_single_peak2.png| @@ -179,7 +179,7 @@ The estimated baseline looks reasonable, so it's time to perform peak extraction By default ``srmise`` performs extraction when run, so simply remove the ``--no-extract`` option. :: - srmise data/Ag_nyquist_qmax30.gr --plot --range 2 3.5 + srmise docs/examples/data/Ag-nyquist-qmax30.gr --plot --range 2 3.5 --baseline "Polynomial(degree=1)" |images/extract_single_peak3.png| @@ -206,7 +206,7 @@ options. The script gives results identical to the commands above, and also saves both a .srmise and .pwa file in the *output* directory. Verify this by running it. :: - python extract_single_peak.py + python extract-single-peak.py .. ~Example 2~ .. @@ -236,7 +236,7 @@ which sets SrMise parameters as part of the following pattern: :: Run and plot the results of this example with :: - python parameter_summary.py + python parameter-summary.py |images/parameter_summary1.png| @@ -296,7 +296,7 @@ follows: :: Run the following command to view this baseline. :: - srmise data/TiO2_fine_qmax26.gr --bpoly1 -0.65 0c --range 0 10 + srmise data/TiO2-fine-qmax26.gr --bpoly1 -0.65 0c --range 0 10 --no-extract --plot |images/parameter_summary2.png| @@ -634,14 +634,14 @@ First, visually check that the baseline obtained in the earlier silver example (set using the ``--bsrmise filename.srmise`` option) is reasonable over a larger range. :: - srmise data/Ag_nyquist_qmax30.gr --no-extract --plot --range 2 10 + srmise docs/examples/data/Ag-nyquist-qmax30.gr --no-extract --plot --range 2 10 --bsrmise output/query_results.srmise |images/query_results1.png| Next, run :: - python query_results.py + python query-results.py to perform peak extraction, the example analysis, and obtain the two plots below. @@ -764,8 +764,8 @@ Details of the multimodeling procedure are discussed in the comments of the extraction and analysis scripts. Run these, noting that the extraction script may take several minutes to complete. :: - python multimodel_known_dG1.py - python multimodel_known_dG2.py + python multimodel-known-dG1.py + python multimodel-known-dG2.py .. ~Example 6~ .. @@ -808,8 +808,8 @@ Details of the multimodeling procedure are discussed in the comments of the extraction and analysis scripts. Run these, noting that the extraction script may take several minutes to complete. :: - python multimodel_unknown_dG1.py - python multimodel_unknown_dG2.py + python multimodel-unknown-dG1.py + python multimodel-unknown-dG2.py .. ~PDF Info~ .. diff --git a/requirements/conda.txt b/requirements/conda.txt index 1b57b14..b2ad57c 100644 --- a/requirements/conda.txt +++ b/requirements/conda.txt @@ -1,3 +1,4 @@ numpy scipy matplotlib-base +bg-mpl-stylesheets diff --git a/requirements/pip.txt b/requirements/pip.txt index f23634b..2d3d118 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -1,3 +1,4 @@ numpy scipy matplotlib +bg-mpl-stylesheets diff --git a/src/diffpy/srmise/applications/plot.py b/src/diffpy/srmise/applications/plot.py index 7da23b7..2804fcc 100755 --- a/src/diffpy/srmise/applications/plot.py +++ b/src/diffpy/srmise/applications/plot.py @@ -19,12 +19,13 @@ import matplotlib.pyplot as plt import mpl_toolkits.axisartist as AA import numpy as np +from bg_mpl_stylesheets.styles import all_styles from matplotlib.ticker import MultipleLocator from mpl_toolkits.axes_grid1.inset_locator import inset_axes from diffpy.srmise.pdfpeakextraction import PDFPeakExtraction, resample from diffpy.srmise.peakstability import PeakStability - +plt.style.use(all_styles["bg-style"]) # For a given figure, returns a label of interest labeldict = {} From 593337a9240d235ef25422a4fb5b671127d06308 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 9 Apr 2026 14:54:56 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit hooks --- src/diffpy/srmise/applications/plot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/diffpy/srmise/applications/plot.py b/src/diffpy/srmise/applications/plot.py index 2804fcc..64703fa 100755 --- a/src/diffpy/srmise/applications/plot.py +++ b/src/diffpy/srmise/applications/plot.py @@ -25,6 +25,7 @@ from diffpy.srmise.pdfpeakextraction import PDFPeakExtraction, resample from diffpy.srmise.peakstability import PeakStability + plt.style.use(all_styles["bg-style"]) # For a given figure, returns a label of interest labeldict = {} From 70bbcf43e66760149e5eaec4b99028755175a29b Mon Sep 17 00:00:00 2001 From: stevenhua0320 Date: Thu, 9 Apr 2026 11:00:52 -0400 Subject: [PATCH 3/3] chore: add news item --- news/bg-mpl-stylesheet.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/bg-mpl-stylesheet.rst diff --git a/news/bg-mpl-stylesheet.rst b/news/bg-mpl-stylesheet.rst new file mode 100644 index 0000000..d175cee --- /dev/null +++ b/news/bg-mpl-stylesheet.rst @@ -0,0 +1,23 @@ +**Added:** + +* No News Added: Added `bg-mpl-stylesheet` as requirement to render better plot + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +*