1010# See LICENSE.txt for license information.
1111#
1212##############################################################################
13- """Example of peak extraction demonstrating non-default values for many extraction parameters.
13+ """Peak extraction with non-default values for many extraction parameters.
1414
1515This example shows how to extract peaks from a crystalline PDF with unreliable
1616uncertainties, and shows how various extraction variables may be set. In
17- particular, choosing a peak function and defining baseline parameters explicitly.
17+ particular, choosing a peak function and defining baseline parameters
18+ explicitly.
1819
1920This script is equivalent to running
20- srmise data/TiO2_fine_qmax26.gr --range 1.5 10. --dg 0.35 --qmax 26 --resolution .05 --bpoly1=-0.65 0c --save output/TiO2_parameterdetail.srmise --pwa output/TiO2_parameterdetail.pwa --plot
21+ srmise data/TiO2_fine_qmax26.gr --range 1.5 10. --dg 0.35 --qmax 26 \
22+ --resolution .05 --bpoly1=-0.65 0c \
23+ --save output/TiO2_parameterdetail.srmise \
24+ --pwa output/TiO2_parameterdetail.pwa --plot
2125at the command line.
2226"""
2327
2630from diffpy .srmise import PDFPeakExtraction
2731from diffpy .srmise .baselines import Polynomial
2832from diffpy .srmise .peaks import GaussianOverR
33+ from diffpy .srmise .applications .plot import makeplot
2934
3035def run (plot = True ):
3136
@@ -79,7 +84,8 @@ def run(plot=True):
7984 blfunc = Polynomial (degree = 1 )
8085 slope = - .65 # Play with this value!
8186 y_intercept = 0.
82- kwds ["baseline" ] = blfunc .actualize ([slope , y_intercept ], free = [True , False ])
87+ kwds ["baseline" ] = blfunc .actualize ([slope , y_intercept ],
88+ free = [True , False ])
8389
8490 # The pf (peakfunction) parameter allows setting the shape of peaks to be
8591 # extracted. Termination effects are added automatically to the peak
@@ -102,8 +108,8 @@ def run(plot=True):
102108 # If the PDF does not report qmax, diffpy.srmise attempts to estimate it
103109 # directly from the data. This estimate can also be used by setting qmax
104110 # to "automatic". An infinite qmax can be specified by setting qmax to 0,
105- # In that case the Nyquist rate is 0 (infinite resolution), and diffpy.srmise
106- # does not consider Nyquist sampling or termination effects.
111+ # In that case the Nyquist rate is 0 (infinite resolution), and
112+ # diffpy.srmise does not consider Nyquist sampling or termination effects.
107113 kwds ["qmax" ] = 26.0
108114
109115 # This parameter governs whether diffpy.srmise attempts to find a model
@@ -160,10 +166,8 @@ def run(plot=True):
160166 # Display plot of extracted peak. It is also possible to plot an existing
161167 # .srmise file from the command line using
162168 # srmise output/TiO2_parameterdetail.srmise --no-extract --plot
163- # or, for a somewhat prettier plot,
164- # srmiseplot output/TiO2_parameterdetail.srmise --show
165169 if plot :
166- ppe . plot ( )
170+ makeplot ( ppe )
167171 plt .show ()
168172
169173if __name__ == '__main__' :
0 commit comments