From 14b729919cce6185a97327fe0fa69a9b26d8b44d Mon Sep 17 00:00:00 2001 From: yucongalicechen Date: Tue, 17 Dec 2024 17:51:47 -0500 Subject: [PATCH 1/3] initial commit --- .../parserdata.zip => example_data/parser_data.zip} | Bin doc/source/examples/examples.rst | 7 ++++--- .../{parsersexample.rst => parsers_example.rst} | 2 +- .../{resampleexample.rst => resample_example.rst} | 2 +- .../{toolsexample.rst => tools_example.rst} | 0 ...transformsexample.rst => transforms_example.rst} | 12 ++++++------ .../{parsersutility.rst => parsers_utility.rst} | 0 .../{resampleutility.rst => resample_utility.rst} | 2 +- .../{toolsutility.rst => tools_utility.rst} | 0 ...transformsutility.rst => transforms_utility.rst} | 0 doc/source/utilities/utilities.rst | 7 ++++--- 11 files changed, 17 insertions(+), 15 deletions(-) rename doc/source/examples/{exampledata/parserdata.zip => example_data/parser_data.zip} (100%) rename doc/source/examples/{parsersexample.rst => parsers_example.rst} (97%) rename doc/source/examples/{resampleexample.rst => resample_example.rst} (97%) rename doc/source/examples/{toolsexample.rst => tools_example.rst} (100%) rename doc/source/examples/{transformsexample.rst => transforms_example.rst} (82%) rename doc/source/utilities/{parsersutility.rst => parsers_utility.rst} (100%) rename doc/source/utilities/{resampleutility.rst => resample_utility.rst} (77%) rename doc/source/utilities/{toolsutility.rst => tools_utility.rst} (100%) rename doc/source/utilities/{transformsutility.rst => transforms_utility.rst} (100%) diff --git a/doc/source/examples/exampledata/parserdata.zip b/doc/source/examples/example_data/parser_data.zip similarity index 100% rename from doc/source/examples/exampledata/parserdata.zip rename to doc/source/examples/example_data/parser_data.zip diff --git a/doc/source/examples/examples.rst b/doc/source/examples/examples.rst index fefe843a..002a1e23 100644 --- a/doc/source/examples/examples.rst +++ b/doc/source/examples/examples.rst @@ -7,6 +7,7 @@ Examples Landing page for diffpy.utils examples. .. toctree:: - parsersexample - resampleexample - toolsexample + parsers_example + resample_example + tools_example + transforms_example diff --git a/doc/source/examples/parsersexample.rst b/doc/source/examples/parsers_example.rst similarity index 97% rename from doc/source/examples/parsersexample.rst rename to doc/source/examples/parsers_example.rst index b709de60..f9320885 100644 --- a/doc/source/examples/parsersexample.rst +++ b/doc/source/examples/parsers_example.rst @@ -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 diff --git a/doc/source/examples/resampleexample.rst b/doc/source/examples/resample_example.rst similarity index 97% rename from doc/source/examples/resampleexample.rst rename to doc/source/examples/resample_example.rst index 3166e42b..5e54fca1 100644 --- a/doc/source/examples/resampleexample.rst +++ b/doc/source/examples/resample_example.rst @@ -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 `_. :: diff --git a/doc/source/examples/toolsexample.rst b/doc/source/examples/tools_example.rst similarity index 100% rename from doc/source/examples/toolsexample.rst rename to doc/source/examples/tools_example.rst diff --git a/doc/source/examples/transformsexample.rst b/doc/source/examples/transforms_example.rst similarity index 82% rename from doc/source/examples/transformsexample.rst rename to doc/source/examples/transforms_example.rst index 7877f866..9a47aee0 100644 --- a/doc/source/examples/transformsexample.rst +++ b/doc/source/examples/transforms_example.rst @@ -13,13 +13,13 @@ This example will demonstrate how to use the functions in the to convert it to ``2theta`` or ``d``. :: # Example: convert q to 2theta - from diffpy.utils.transformers import q_to_tth + from diffpy.utils.transforms import q_to_tth 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) @@ -27,13 +27,13 @@ This example will demonstrate how to use the functions in the For a 1D ``2theta`` array, you can convert it to ``q`` or ``d`` in a similar way. :: # 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) @@ -42,12 +42,12 @@ This example will demonstrate how to use the functions in the For a 1D ``d`` array, you can convert it to ``q`` or ``2theta``. :: # Example: convert d to q - from diffpy.utils.transformers import tth_to_q + from diffpy.utils.transforms import tth_to_q 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) diff --git a/doc/source/utilities/parsersutility.rst b/doc/source/utilities/parsers_utility.rst similarity index 100% rename from doc/source/utilities/parsersutility.rst rename to doc/source/utilities/parsers_utility.rst diff --git a/doc/source/utilities/resampleutility.rst b/doc/source/utilities/resample_utility.rst similarity index 77% rename from doc/source/utilities/resampleutility.rst rename to doc/source/utilities/resample_utility.rst index 184cf22d..1631ca2b 100644 --- a/doc/source/utilities/resampleutility.rst +++ b/doc/source/utilities/resample_utility.rst @@ -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 `. diff --git a/doc/source/utilities/toolsutility.rst b/doc/source/utilities/tools_utility.rst similarity index 100% rename from doc/source/utilities/toolsutility.rst rename to doc/source/utilities/tools_utility.rst diff --git a/doc/source/utilities/transformsutility.rst b/doc/source/utilities/transforms_utility.rst similarity index 100% rename from doc/source/utilities/transformsutility.rst rename to doc/source/utilities/transforms_utility.rst diff --git a/doc/source/utilities/utilities.rst b/doc/source/utilities/utilities.rst index 5ec89656..147d7265 100644 --- a/doc/source/utilities/utilities.rst +++ b/doc/source/utilities/utilities.rst @@ -10,6 +10,7 @@ Check the :ref:`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 From 6606e6dae202844956d8c786035dcb475ccf1006 Mon Sep 17 00:00:00 2001 From: yucongalicechen Date: Tue, 17 Dec 2024 17:53:54 -0500 Subject: [PATCH 2/3] fix more typos --- doc/source/examples/transforms_example.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/examples/transforms_example.rst b/doc/source/examples/transforms_example.rst index 9a47aee0..63b2fef6 100644 --- a/doc/source/examples/transforms_example.rst +++ b/doc/source/examples/transforms_example.rst @@ -42,7 +42,7 @@ This example will demonstrate how to use the functions in the For a 1D ``d`` array, you can convert it to ``q`` or ``2theta``. :: # Example: convert d to q - from diffpy.utils.transforms import tth_to_q + from diffpy.utils.transforms import d_to_q d = np.array([1.0, 0.8, 0.6, 0.4, 0.2]) q = d_to_q(d) From c982502c696a52a61438337c02d2072af95918ae Mon Sep 17 00:00:00 2001 From: yucongalicechen Date: Tue, 17 Dec 2024 19:42:50 -0500 Subject: [PATCH 3/3] reformat transforms example --- doc/source/examples/transforms_example.rst | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/source/examples/transforms_example.rst b/doc/source/examples/transforms_example.rst index 63b2fef6..df7666b9 100644 --- a/doc/source/examples/transforms_example.rst +++ b/doc/source/examples/transforms_example.rst @@ -10,7 +10,9 @@ 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.transforms import q_to_tth @@ -24,7 +26,9 @@ This example will demonstrate how to use the functions in the 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.transforms import tth_to_q @@ -39,7 +43,9 @@ This example will demonstrate how to use the functions in the 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.transforms import d_to_q