Skip to content

Rename doc files and fix typos #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions doc/source/examples/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Examples
Landing page for diffpy.utils examples.

.. toctree::
parsersexample
resampleexample
toolsexample
parsers_example
resample_example
tools_example
transforms_example
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Parsers Example
This example will demonstrate how diffpy.utils lets us easily process and serialize files.
Using the parsers module, we can load file data into simple and easy-to-work-with Python objects.

1) To begin, unzip :download:`parserdata<./exampledata/parserdata.zip>` and take a look at ``data.txt``.
1) To begin, unzip :download:`parser_data<./example_data/parser_data.zip>` and take a look at ``data.txt``.
Our goal will be to extract and serialize the data table as well as the parameters listed in the header of this file.

2) To get the data table, we will use the ``loadData`` function. The default behavior of this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Specifically, we will resample the grid of one function to match another for us
Then we will show how this resampling method lets us create a perfect reconstruction of certain functions
given enough datapoints.

1) To start, unzip :download:`parserdata<./exampledata/parserdata.zip>`. Then, load the data table from ``Nickel.gr``
1) To start, unzip :download:`parser_data<./example_data/parser_data.zip>`. Then, load the data table from ``Nickel.gr``
and ``NiTarget.gr``. These datasets are based on data from `Atomic Pair Distribution Function Analysis: A Primer
<https://global.oup.com/academic/product/atomic-pair-distribution-function-analysis-9780198885801?cc=us&lang=en&>`_.
::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,50 @@ This example will demonstrate how to use the functions in the

1) Converting from ``q`` to ``2theta`` or ``d``:
If you have a 1D ``q``-array, you can use the ``q_to_tth`` and ``q_to_d`` functions
to convert it to ``2theta`` or ``d``. ::
to convert it to ``2theta`` or ``d``.

.. code-block:: python

# Example: convert q to 2theta
from diffpy.utils.transformers import q_to_tth
from diffpy.utils.transforms import q_to_tth
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix typo

wavelength = 0.71
q = np.array([0, 0.2, 0.4, 0.6, 0.8, 1])
tth = q_to_tth(q, wavelength)

# Example: convert q to d
from diffpy.utils.transformers import q_to_d
from diffpy.utils.transforms import q_to_d
q = np.array([0, 0.2, 0.4, 0.6, 0.8, 1])
d = q_to_d(q)

(2) Converting from ``2theta`` to ``q`` or ``d``:
For a 1D ``2theta`` array, you can convert it to ``q`` or ``d`` in a similar way. ::
For a 1D ``2theta`` array, you can convert it to ``q`` or ``d`` in a similar way.

.. code-block:: python

# Example: convert 2theta to q
from diffpy.utils.transformers import tth_to_q
from diffpy.utils.transforms import tth_to_q
wavelength = 0.71
tth = np.array([0, 30, 60, 90, 120, 180])
q = tth_to_q(tth, wavelength)

# Example: convert 2theta to d
from diffpy.utils.transformers import tth_to_d
from diffpy.utils.transforms import tth_to_d
wavelength = 0.71
tth = np.array([0, 30, 60, 90, 120, 180])
d = tth_to_d(tth, wavelength)

(3) Converting from ``d`` to ``q`` or ``2theta``:
For a 1D ``d`` array, you can convert it to ``q`` or ``2theta``. ::
For a 1D ``d`` array, you can convert it to ``q`` or ``2theta``.

.. code-block:: python

# Example: convert d to q
from diffpy.utils.transformers import tth_to_q
from diffpy.utils.transforms import d_to_q
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

d = np.array([1.0, 0.8, 0.6, 0.4, 0.2])
q = d_to_q(d)

# Example: convert d to 2theta
from diffpy.utils.transformers import d_to_tth
from diffpy.utils.transforms import d_to_tth
wavelength = 0.71
d = np.array([1.0, 0.8, 0.6, 0.4, 0.2])
tth = d_to_tth(d, wavelength)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Resample Utility
================

- ``wsinterp()``: Allows users easily reample a PDF onto another grid.
- ``wsinterp()``: Allows users easily resample a PDF onto another grid.
This makes use of the Whittaker-Shannon interpolation formula.
To see the theory behind how this interpolation works and how to use
it in practice, click :ref:`here <Resample Example>`.
7 changes: 4 additions & 3 deletions doc/source/utilities/utilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Check the :ref:`examples<Examples>` provided for how to use these.
.. contents::
:depth: 2

.. include:: parsersutility.rst
.. include:: resampleutility.rst
.. include:: toolsutility.rst
.. include:: parsers_utility.rst
.. include:: resample_utility.rst
.. include:: tools_utility.rst
.. include:: transforms_utility.rst
Loading