Skip to content
Closed
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
8 changes: 0 additions & 8 deletions doc/source/api/diffpy.utils.parsers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ diffpy.utils.parsers package
Submodules
----------

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

.. automodule:: diffpy.utils.parsers.resample
:members:
:undoc-members:
:show-inheritance:

diffpy.utils.parsers.loaddata module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
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:
2 changes: 1 addition & 1 deletion doc/source/api/diffpy.utils.scattering_objects.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:tocdepth: -1

diffpy.utils.scattering_objects package
diffpy.utils.scattering-objects package
=======================================

.. automodule:: diffpy.utils.scattering_objects
Expand Down
4 changes: 4 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
from importlib.metadata import version
from pathlib import Path

autodoc_mock_imports = [
"diffpy.utils.wx",
Copy link
Contributor

@bobleesj bobleesj Nov 11, 2024

Choose a reason for hiding this comment

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

why was this added?

Copy link
Author

Choose a reason for hiding this comment

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

sphinx gave an error WARNING: autodoc: failed to import module 'gridutils' from module 'diffpy.utils.wx'; the following exception was raised: No module named 'wx' [autodoc.import_object]
So I followed the cookiecutter instructions for that error

]

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use Path().resolve() to make it absolute, like shown here.
Expand Down
2 changes: 1 addition & 1 deletion doc/source/examples/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Landing page for diffpy.utils examples.

.. toctree::
parsersexample
resampleexample
resamplerexample
toolsexample
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.serialization 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
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:**

* Updated documentation for resampler relocation and removed relative path imports

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
Loading