Skip to content

Commit d481253

Browse files
edits on docs
1 parent 490486c commit d481253

File tree

2 files changed

+18
-28
lines changed

2 files changed

+18
-28
lines changed

Diff for: doc/source/examples/diffractionobjectsexample.rst

+16-23
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,27 @@ Diffraction Objects Example
88
This example will demonstrate how to use the ``DiffractionObject`` class in the
99
``diffpy.utils.scattering_objects.diffraction_objects`` module to process and analyze diffraction data.
1010

11-
1) We have the function ``q_to_tth`` to convert q to two theta values in degrees, and ``tth_to_q`` to do the reverse.
12-
You can use these functions with a pre-defined ``DiffractionObject``. ::
11+
1) Assuming we have created a ``DiffractionObject`` called my_diffraction_pattern from a measured diffraction pattern,
12+
and we have specified the wavelength (see Section ??, to be added),
13+
we can use the ``q_to_tth`` and ``tth_to_q`` functions to convert between q and two-theta. ::
1314

14-
# convert q to tth
15-
from diffpy.utils.scattering_objects.diffraction_objects import DiffractionObject
16-
test = DiffractionObject(wavelength=1.54)
17-
test.on_q = [[0, 0.2, 0.4, 0.6, 0.8, 1], [1, 2, 3, 4, 5, 6]]
18-
test.q_to_tth()
15+
# Example: convert q to tth
16+
my_diffraction_pattern.on_q = [[0, 0.2, 0.4, 0.6, 0.8, 1], [1, 2, 3, 4, 5, 6]]
17+
my_diffraction_pattern.q_to_tth()
1918

2019
This function will convert your provided q array and return a two theta array in degrees.
21-
To load the converted array, you can either call ``test.q_to_tth()`` or ``test.on_q[0]``.
22-
23-
Similarly, use the function ``tth_to_q`` to convert two theta values in degrees to q values. ::
20+
To load the converted array, you can either call ``test.q_to_tth()`` or ``test.on_q[0]``. ::
2421

25-
# convert tth to q
22+
# Example: convert tth to q
2623
from diffpy.utils.scattering_objects.diffraction_objects import DiffractionObject
27-
test = DiffractionObject(wavelength=1.54)
28-
test.on_tth = [[0, 30, 60, 90, 120, 180], [1, 2, 3, 4, 5, 6]]
29-
test.tth_to_q()
24+
my_diffraction_pattern.on_tth = [[0, 30, 60, 90, 120, 180], [1, 2, 3, 4, 5, 6]]
25+
my_diffraction_pattern.tth_to_q()
3026

31-
To load the converted array, you can either call ``test.tth_to_q()`` or ``test.on_tth[0]``.
27+
Similarly, to load the converted array, you can either call ``test.tth_to_q()`` or ``test.on_tth[0]``.
3228

33-
2) You can use these functions without specifying a wavelength. However, if so, the function will return an empty array,
34-
so we strongly encourage you to specify a wavelength when using these functions. ::
35-
36-
from diffpy.utils.scattering_objects.diffraction_objects import DiffractionObject
37-
test = DiffractionObject()
38-
test.on_q = [[0, 0.2, 0.4, 0.6, 0.8, 1], [1, 2, 3, 4, 5, 6]]
39-
test.q_to_tth()
29+
2) Both functions require a wavelength to perform conversions. Without a wavelength, they will return empty arrays.
30+
Therefore, we strongly encourage you to specify a wavelength when using these functions. ::
4031

41-
In this case, the function will return an empty array on two theta.
32+
# Example: without wavelength specified
33+
my_diffraction_pattern.on_q = [[0, 0.2, 0.4, 0.6, 0.8, 1], [1, 2, 3, 4, 5, 6]]
34+
my_diffraction_pattern.q_to_tth() # returns an empty array

Diff for: doc/source/utilities/diffractionobjectsutility.rst

+2-5
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ The ``diffpy.utils.scattering_objects.diffraction_objects`` module provides func
77
for managing and analyzing diffraction data, including angle-space conversions
88
and interactions between diffraction data.
99

10-
- ``q_to_tth()``: Converts an array of q values to their corresponding two theta values, based on specified wavelength.
11-
- ``tth_to_q()``: Converts an array of two theta values to their corresponding q values, based on specified wavelength.
12-
13-
These functions help developers standardize diffraction data and update the arrays
14-
in the associated ``DiffractionObject``, enabling easier analysis and further processing.
10+
These functions help developers standardize diffraction data and update the arrays
11+
in the associated ``DiffractionObject``, enabling easier analysis and further processing.
1512

1613
For a more in-depth tutorial for how to use these functions, click :ref:`here <Diffraction Objects Example>`.

0 commit comments

Comments
 (0)