Skip to content

Commit c2a5d7a

Browse files
authoredJan 14, 2025··
Merge pull request #129 from sbillinge/docs
doc: edited and cleaned docs for 1.5.0 release
2 parents f8ace0c + 4b0878c commit c2a5d7a

File tree

6 files changed

+108
-33
lines changed

6 files changed

+108
-33
lines changed
 

‎README.rst

+13-7
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,21 @@
3535
.. |Tracking| image:: https://img.shields.io/badge/issue_tracking-github-blue
3636
:target: https://github.com/diffpy/diffpy.pdffit2/issues
3737

38-
PDFfit2 - real space structure refinement to atomic pair distribution function
38+
PDFfit2 - real space structure refinement of the atomic pair distribution function
3939

40-
The diffpy.pdffit2 package provides functions for calculation and
41-
refinement of atomic Pair Distribution Function (PDF) from crystal
42-
structure model. It is used as a computational engine by PDFgui. All
43-
refinements possible in PDFgui can be done with diffpy.pdffit2,
40+
The diffpy.pdffit2 package provides functions for the calculation and
41+
refinement of atomic Pair Distribution Functions (PDF) from crystal
42+
structure models. It is used as a computational engine by PDFgui. All
43+
refinements possible in PDFgui can be done by writing python scripts
44+
directly with diffpy.pdffit2,
4445
although less conveniently and with a fair knowledge of Python.
45-
The package includes an extension for the interactive `IPython
46-
<http://ipython.org>`__ shell, which tries to mimic the old PDFFIT
46+
However, we recommend using `diffpy-cmi
47+
<https://www.diffpy.org/products/diffpycmi/index.html>`_ for carrying
48+
out more advanced, python-scripted refinements of nanostructure.
49+
50+
The PDFfit2 package includes an extension for the interactive `IPython
51+
<http://ipython.org>`_ shell, these days commonly used within
52+
Jupyter notebooks, which tries to mimic the old PDFFIT
4753
program. To start IPython with this extension and also with plotting
4854
functions enabled, use ::
4955

‎doc/source/examples.rst

+46-13
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,23 @@ Files needed:
1414
Example 1: Calculate PDF of FCC nickel
1515
======================================
1616

17-
The first example shows how to calculates the PDF for FCC nickel and saves the resulting data to a file and plot it using matplotlib.
17+
The first example shows how to calculate the PDF for FCC nickel and save the resulting data
18+
to a file and plot it using matplotlib.
1819

19-
1. Imports the PdfFit class from the diffpy.pdffit2 module::
20+
1. Import the ``PdfFit`` class from the ``diffpy.pdffit2`` module
21+
22+
.. code-block:: python
2023
2124
from diffpy.pdffit2 import PdfFit
2225
23-
2. Create a PDF calculator object and assigned to the variable ``P``. Make sure the ``Ni.stru`` file is in the same directory as the script and you've cd to the directory, load structure file. Then allocate and configure PDF calculation and run the calculation::
26+
2. Create a PDF calculator object and assign it to the variable ``P``.
27+
Make sure the ``Ni.stru`` file is in the same directory as the script (or specify
28+
the relative path to where it resides)
29+
and you are currently in this directory. Then use ``read_struct`` to read the structure
30+
file, ``alloc`` to configure the PDF
31+
calculation, and then use ``calc`` to carry out the the calculation.
32+
33+
.. code-block:: python
2434
2535
# create new PDF calculator object
2636
P = PdfFit()
@@ -39,11 +49,15 @@ The first example shows how to calculates the PDF for FCC nickel and saves the r
3949
P.alloc(radiation_type, qmax, qdamp, rmin, rmax, npts)
4050
P.calc()
4151
42-
3. Save the refined result::
52+
3. Save the calculated PDF.
53+
54+
.. code-block:: python
4355
4456
P.save_pdf(1, "Ni_calculation.cgr")
4557
46-
4. We can also plot it using matplotlib::
58+
4. We can also plot it using matplotlib
59+
60+
.. code-block:: python
4761
4862
import matplotlib.pyplot as plt
4963
@@ -59,19 +73,27 @@ The first example shows how to calculates the PDF for FCC nickel and saves the r
5973
# display plot window, this must be the last command in the script
6074
plt.show()
6175
62-
The scripts can be downloaded :download:`here <examples/Ni_calculation.py>`.
76+
The scripts used in this example can be
77+
downloaded :download:`here <examples/Ni_calculation.py>`.
6378

6479
=======================================
6580
Example 2: Performing simple refinement
6681
=======================================
6782

68-
The second example shows how to perform simple refinement of Ni structure to the experimental x-ray PDF. The example uses the same data files as the first example.
83+
The second example shows how to perform a simple refinement of the Ni structure to
84+
the experimental x-ray PDF. The example uses the same data files as the first example.
85+
86+
1. Import the PdfFit class from the diffpy.pdffit2 module
6987

70-
1. Imports the PdfFit class from the diffpy.pdffit2 module::
88+
.. code-block:: python
7189
7290
from diffpy.pdffit2 import PdfFit
7391
74-
2. Create a PDF calculator object and assigned to the variable ``pf``. Load experimental x-ray PDF data and nickel structure file::
92+
2. Create a PDF calculator object and assign it to the variable ``pf``.
93+
Load the experimental x-ray PDF data using ``read_data`` and also load
94+
the nickel structure file.
95+
96+
.. code-block:: python
7597
7698
# Create new PDF calculator object.
7799
pf = PdfFit()
@@ -84,7 +106,13 @@ The second example shows how to perform simple refinement of Ni structure to the
84106
# Load nickel structure, must be in PDFFIT or DISCUS format
85107
pf.read_struct("Ni.stru")
86108
87-
3. Configure refinement and refine::
109+
3. Configure the refinement, assigning structural parameters to variables. For more
110+
information on how to do this correctly, please read the PDFgui documentation.
111+
Set initial values for the variables using ``setpar``.
112+
Finally, you can configure the range over which to refine (``pdfrange``) and
113+
run the refinement (``refine``).
114+
115+
.. code-block:: python
88116
89117
# Refine lattice parameters a, b, c.
90118
# Make them all equal to parameter @1.
@@ -118,13 +146,18 @@ The second example shows how to perform simple refinement of Ni structure to the
118146
pf.pdfrange(1, 1.5, 19.99)
119147
pf.refine()
120148
121-
4. Save the refined result::
149+
4. Save the refined result. ``save_struct`` saves the new, refined, structure to a
150+
``.stru`` format file. ``save_res`` saves the outputs in a structured text file.
151+
152+
.. code-block:: python
122153
123154
pf.save_pdf(1, "Ni_refinement.fgr")
124155
pf.save_struct(1, "Ni_refinement.rstr")
125156
pf.save_res("Ni_refinement.res")
126157
127-
5. We can also plot it using matplotlib::
158+
5. We can also plot it using matplotlib
159+
160+
.. code-block:: python
128161
129162
import matplotlib.pyplot as plt
130163
import numpy
@@ -149,4 +182,4 @@ The second example shows how to perform simple refinement of Ni structure to the
149182
# display plot window, this must be the last command in the script
150183
plt.show()
151184
152-
The scripts can be downloaded :download:`here <examples/Ni_refinement.py>`.
185+
The scripts can be downloaded from :download:`here <examples/Ni_refinement.py>`.

‎doc/source/index.rst

+23-10
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@ diffpy.pdffit2 - PDFfit2 - real space structure refinement program.
99
| Software version |release|.
1010
| Last updated |today|.
1111
12-
The diffpy.pdffit2 package provides functions for calculation and
13-
refinement of atomic Pair Distribution Function (PDF) from crystal
14-
structure model. It is used as a computational engine by PDFgui. All
15-
refinements possible in PDFgui can be done with diffpy.pdffit2,
12+
The diffpy.pdffit2 package provides functions for the calculation and
13+
refinement of atomic Pair Distribution Functions (PDF) from crystal
14+
structure models. It is used as a computational engine by PDFgui. All
15+
refinements possible in PDFgui can be done by writing python scripts
16+
directly with diffpy.pdffit2,
1617
although less conveniently and with a fair knowledge of Python.
17-
The package includes an extension for the interactive `IPython
18-
<http://ipython.org>`_ shell, which tries to mimic the old PDFFIT
18+
However, we recommend using `diffpy-cmi
19+
<https://www.diffpy.org/products/diffpycmi/index.html>`_ for carrying
20+
out more advanced, python-scripted refinements of nanostructure.
21+
22+
The PDFfit2 package includes an extension for the interactive `IPython
23+
<http://ipython.org>`_ shell, these days commonly used within
24+
Jupyter notebooks, which tries to mimic the old PDFFIT
1925
program. To start IPython with this extension and also with plotting
2026
functions enabled, use ::
2127

@@ -30,19 +36,26 @@ statements.
3036
Authors
3137
=======
3238

33-
This code was derived from the first PDFFIT program by Thomas Proffen.
39+
This code was derived from the first `PDFFIT
40+
<https://doi.org/10.1107/S0021889899003532>`_ program written by Thomas Proffen
41+
and Simon Billinge, which was a FORTRAN implementation of the original
42+
"Real-space Rietveld" code
43+
written by Simon Billinge (Billinge, S. J. L. “Real-space Rietveld: full profile structure refinement of the atomic pair distribution
44+
function”. In: Local Structure from Diffraction. Ed. by S. J. L. Billinge and M. F. Thorpe. New York:
45+
Plenum, 1998, p. 137).
3446
The sources were converted to C++ by Jacques Bloch and then extensively hacked,
3547
extended and purged from most glaring bugs by Chris Farrow and Pavol Juhas.
3648
This code is currently maintained as part of the DiffPy project to create
3749
python modules for structure investigations from diffraction data.
3850

3951
The DiffPy team is located in the Billinge-group at the Applied Physics
4052
and Applied Mathematics Department of the Columbia University in New York.
41-
Previous significant contributors to this code were
53+
Previous significant contributors to this code were made by
4254

4355
Pavol Juhas, Chris Farrow, Jacques Bloch, Wenduo Zhou
4456

45-
For a detailed list of contributors see
57+
with more recent contributions from Billinge-group members.
58+
For a more detailed list of contributors see
4659
https://github.com/diffpy/diffpy.pdffit2/graphs/contributors.
4760

4861

@@ -62,7 +75,7 @@ in your publication:
6275
Installation
6376
============
6477

65-
See the `README <https://github.com/diffpy/diffpy.pdffit2#installation>`_
78+
Please see the `README <https://github.com/diffpy/diffpy.pdffit2#installation>`_
6679
file included with the distribution.
6780

6881
=================

‎doc/source/license.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ the following paper in your publication:
1717
in crystals (https://stacks.iop.org/0953-8984/19/335219), *J. Phys.: Condens. Matter*, 19, 335219 (2007)
1818

1919
Copyright 2006-2007, Board of Trustees of Michigan State University,
20-
Copyright 2008-2024, Board of Trustees of Columbia University in the
20+
Copyright 2008-|year|, Board of Trustees of Columbia University in the
2121
city of New York. (Copyright holder indicated in each source file).
2222

2323
For more information please visit the project web-page:

‎news/docs.rst

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* <news item>
4+
5+
**Changed:**
6+
7+
* Documentation brought up to date
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* <news item>
20+
21+
**Security:**
22+
23+
* <news item>

‎src/diffpy/pdffit2/pdffit.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See LICENSE.txt for license information.
1313
#
1414
##############################################################################
15-
"""PdfFit class for fitting pdf data to a model."""
15+
"""PdfFit class for fitting a structural model to PDF data."""
1616

1717
from __future__ import print_function
1818

@@ -104,7 +104,7 @@ def _convertCallable(var):
104104

105105

106106
class PdfFit(object):
107-
"""Class for PdfFit.
107+
"""Class for handling PdfFit calculations and refinements.
108108
109109
Attributes
110110
----------

0 commit comments

Comments
 (0)
Please sign in to comment.