Skip to content

Documentation update #169

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
Nov 11, 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
14 changes: 3 additions & 11 deletions doc/source/api/diffpy.utils.parsers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ diffpy.utils.parsers package
Submodules
----------

diffpy.utils.parsers.resample module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diffpy.utils.parsers.serialization module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automodule:: diffpy.utils.parsers.resample
.. automodule:: diffpy.utils.parsers.serialization
:members:
:undoc-members:
:show-inheritance:
Expand All @@ -34,11 +34,3 @@ diffpy.utils.parsers.custom_exceptions module
:members:
:undoc-members:
:show-inheritance:

diffpy.utils.parsers.serialization module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automodule:: diffpy.utils.parsers.serialization
:members:
:undoc-members:
:show-inheritance:
8 changes: 8 additions & 0 deletions doc/source/api/diffpy.utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@ diffpy.utils.tools module
:members:
:undoc-members:
:show-inheritance:

diffpy.utils.resampler module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automodule:: diffpy.utils.resampler
:members:
:undoc-members:
:show-inheritance:
12 changes: 6 additions & 6 deletions doc/source/api/diffpy.utils.scattering_objects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ diffpy.utils.scattering_objects package
Submodules
----------

diffpy.utils.scattering_objects.user_config module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diffpy.utils.scattering_objects.diffraction_objects module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automodule:: diffpy.utils.scattering_objects.user_config
.. automodule:: diffpy.utils.scattering_objects.diffraction_objects
:members:
:undoc-members:
:show-inheritance:

diffpy.utils.scattering_objects.diffraction_objects module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diffpy.utils.scattering_objects.user_config module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automodule:: diffpy.utils.scattering_objects.diffraction_objects
.. automodule:: diffpy.utils.scattering_objects.user_config
:members:
:undoc-members:
:show-inheritance:
6 changes: 3 additions & 3 deletions doc/source/examples/parsersexample.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Using the parsers module, we can load file data into simple and easy-to-work-wit
2) To get the data table, we will use the ``loadData`` function. The default behavior of this
function is to find and extract a data table from a file.::

from diffpy.utils.parsers import loadData
from diffpy.utils.parsers.loaddata import loadData
data_table = loadData('<PATH to data.txt>')

While this will work with most datasets, on our ``data.txt`` file, we got a ``ValueError``. The reason for this is
Expand Down Expand Up @@ -53,7 +53,7 @@ Using the parsers module, we can load file data into simple and easy-to-work-wit
4) Rather than working with separate ``data_table`` and ``hdata`` objects, it may be easier to combine them into a single
dictionary. We can do so using the ``serialize_data`` function. ::

from diffpy.utils.parsers import serialize_data
from diffpy.utils.parsers.loaddata import serialize_data
file_data = serialize_data('<PATH to data.txt', hdata, data_table)
# File data is a dictionary with a single key
# The key is the file name (in our case, 'data.txt')
Expand Down Expand Up @@ -84,7 +84,7 @@ Using the parsers module, we can load file data into simple and easy-to-work-wit
The returned value, ``parsed_file_data``, is the dictionary we just added to ``serialfile.json``.
To extract the data from the serial file, we use ``deserialize_data``. ::

from diffpy.utils.parsers import deserialize_data
from diffpy.utils.parsers.serialization import deserialize_data
parsed_file_data = deserialize_data('<PATH to serialdata.json>')

6) Finally, ``serialize_data`` allows us to store data from multiple text file in a single serial file. For one last bit
Expand Down
6 changes: 3 additions & 3 deletions doc/source/examples/resampleexample.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ given enough datapoints.
<https://global.oup.com/academic/product/atomic-pair-distribution-function-analysis-9780198885801?cc=us&lang=en&>`_.
::

from diffpy.utils.parsers import loadData
from diffpy.utils.parsers.loaddata import loadData
nickel_datatable = loadData('<PATH to Nickel.gr>')
nitarget_datatable = loadData('<PATH to NiTarget.gr>')

Each data table has two columns: first is the grid and second is the function value.
To extract the columns, we can utilize the serialize function ... ::

from diffpy.utils.parsers import serialize_data
from diffpy.utils.parsers.serialization import serialize_data
nickel_data = serialize_data('Nickel.gr', {}, nickel_datatable, dt_colnames=['grid', 'func'])
nickel_grid = nickel_data['Nickel.gr']['grid']
nickel_func = nickel_data['Nickel.gr']['func']
Expand Down Expand Up @@ -54,7 +54,7 @@ given enough datapoints.

... and use the diffpy.utils ``wsinterp`` function to resample on this grid.::

from diffpy.utils.parsers import wsinterp
from diffpy.utils.resampler import wsinterp
nickel_resample = wsinterp(grid, nickel_grid, nickel_func)
target_resample = wsinterp(grid, target_grid, target_func)

Expand Down
6 changes: 3 additions & 3 deletions doc/source/utilities/parsersutility.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Parsers Utility

The ``diffpy.utils.parsers`` module allows users to easily and robustly load file data into a Python project.

- ``loadData()``: Find and load a data table/block from a text file. This seems to work for most datafiles
- ``loaddata.loadData()``: Find and load a data table/block from a text file. This seems to work for most datafiles
including those generated by diffpy programs. Running only ``numpy.loadtxt`` will result in errors
for most these files as there is often excess data or parameters stored above the data block.
Users can instead choose to load all the parameters of the form ``<param_name> = <param_value>`` into a dictionary
Expand All @@ -14,10 +14,10 @@ The ``diffpy.utils.parsers`` module allows users to easily and robustly load fil
The program identifies data blocks as the first matrix block with a constant number of columns.
A user can tune the minimum number of rows this matrix block must have.

- ``deserialize_data()``: Load data from a serial file format into a Python dictionary. Currently, the only supported
- ``serialization.deserialize_data()``: Load data from a serial file format into a Python dictionary. Currently, the only supported
serial format is ``.json``.

- ``serialize_data()``: Serialize the data generated by ``loadData()`` into a serial file format. Currently, the only
- ``serialization.serialize_data()``: Serialize the data generated by ``loadData()`` into a serial file format. Currently, the only
supported serial format is ``.json``.

For a more in-depth tutorial for how to use these parser utilities, click :ref:`here <Parsers Example>`.
23 changes: 23 additions & 0 deletions news/doc-update.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* Paths in our documentation reflect changes made in code.

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
Loading