Skip to content

Commit 27f433d

Browse files
authored
Merge pull request #254 from yucongalicechen/docs
fix diffraction objects docs typos
2 parents 2bc765f + 82677a4 commit 27f433d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

doc/source/examples/diffraction_objects_example.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ i.e.,
7272
data_on_d = my_do.on_xtype("d")
7373
plt.plot(data_on_d[0], data_on_d[1])
7474
75-
This makes it very easy to compare a diffractioh pattern that was measured or calculated
75+
This makes it very easy to compare a diffraction pattern that was measured or calculated
7676
on one ``xtype`` with one that was measured or calculated on another. E.g., suppose that you
7777
have a calculated powder pattern from a CIF file that was calculated on a d-spacing grid using
7878
some software package, and
@@ -85,7 +85,7 @@ You could simply load them both as diffraction objects and plot them together on
8585
measured = DiffractionObject(xmeas, ymeas, "tth", wavelength=0.717)
8686
plt.plot(calculated.on_q()[0], calculated.on_q()[1])
8787
plt.plot(measured.on_q()[0], measured.on_q()[1])
88-
plt.show
88+
plt.show()
8989
9090
Now, let's say that these two diffraction patterns were on very different scales. The measured one
9191
has a peak intensity of 10,000, but the calculated one only goes to 1.
@@ -100,8 +100,8 @@ we would replace the code above with
100100
.. code-block:: python
101101
102102
plt.plot(calculated.on_q()[0], calculated.on_q()[1])
103-
plt.plot(measured.on_q().scale_to(calculated, q=5.5)[0], measured.on_q().scale_to(calculated, q=5.5)[1])
104-
plt.show
103+
plt.plot(measured.scale_to(calculated, q=5.5).on_q()[0], measured.scale_to(calculated, q=5.5).on_q()[1])
104+
plt.show()
105105
106106
The ``scale_to()`` method returns a new ``DiffractionObject`` which we can assign to a new
107107
variable and make use of,
@@ -134,7 +134,7 @@ DiffractionObject convenience functions
134134
diff_object2 = diff_object1.copy()
135135
diff_object2 == diff_object1
136136
137-
will return ``True``
137+
will return ``True``.
138138

139139
3) make arithmetic operations on the intensities of diffraction objects. e.g.,
140140

@@ -149,7 +149,7 @@ DiffractionObject convenience functions
149149
.. code-block:: python
150150
151151
tth_ninety_index = diff_object1.get_array_index(90, xtype="tth")
152-
intensity_at_ninety = diff_object1.on_tth()[tth_ninety_index]
152+
intensity_at_ninety = diff_object1.on_tth()[1][tth_ninety_index]
153153
154154
If you do not specify an ``xtype``, it will default to the ``xtype`` used when creating the ``DiffractionObject``.
155155
For example, if you have created a ``DiffractionObject`` called ``do`` with ``xtype="q"``,
@@ -168,6 +168,7 @@ in ``diffpy.utils.parsers``).
168168
You can choose which of the data axes (``q``, ``tth``, or ``d``) to export, with ``q`` as the default.
169169

170170
.. code-block:: python
171+
171172
# Assume you have created a Diffraction Object do
172173
file = "diffraction_data.chi"
173174
do.dump(file, xtype="q")

0 commit comments

Comments
 (0)