Skip to content

Commit

Permalink
DOC: Update Python documentation with improved navigation (#895)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson authored Mar 28, 2024
1 parent 8f1a45d commit c59e375
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 33 deletions.
5 changes: 5 additions & 0 deletions src/simplnx/Core/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ std::vector<Uuid> Application::getSimplUuid(const Uuid& simplnxUuid)

void Application::loadPlugins(const std::filesystem::path& pluginDir, bool verbose)
{
if(!std::filesystem::exists(pluginDir) && verbose)
{
fmt::print("Plugin Directory {} does not exist. Skipping", pluginDir.string());
return;
}
if(verbose)
{
fmt::print("Loading Plugins from {}\n", pluginDir.string());
Expand Down
4 changes: 2 additions & 2 deletions wrapping/python/docs/generate_sphinx_docs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace
std::map<nx::core::Uuid, std::string> s_ParameterMap;

const std::string k_WebServerAddress = "http://www.dream3d.io/nx_reference_manual";
const std::string k_WebServerFilterFolder = "Filters";
const std::string k_WebServerFilterFolder = "html";
} // namespace

#define ADD_PARAMETER_TRAIT(thing1, thing2) \
Expand Down Expand Up @@ -748,7 +748,7 @@ void GeneratePythonRstFiles()
rstStream << " " << rstDescription << "\n\n";

// Tack on the link to the web address for the full documentation
const std::string webAddress = fmt::format("{}/{}/{}", k_WebServerAddress, k_WebServerFilterFolder, filterClassName);
const std::string webAddress = fmt::format("{}/{}/{}/{}.html", k_WebServerAddress, k_WebServerFilterFolder, plugName, filterClassName);
rstStream << " `Link to the full online documentation for " << filterClassName << " <" << webAddress << ">`_ \n\n";

const auto& parameters = filter->parameters();
Expand Down
33 changes: 27 additions & 6 deletions wrapping/python/docs/index_template.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
DREAM3D-NX Python Docs
=======================

Latest Version: 1.2.6
Latest Version: 1.2.7
---------------------

The *simplnx* library can be installed through an Anaconda packages from the *BlueQuartzSoftware* channel. This can be achieved
Expand All @@ -21,24 +21,45 @@ by creating a new virtual environment
.. toctree::
:maxdepth: 3
:caption: Contents:
:caption: Conceptual

Installation
Overview
DataObjects
Geometry
User_API
Developer_API

.. toctree::
:maxdepth: 3
:caption: Using SIMPLNX

Python_Introduction
Writing_A_New_Python_Filter
User_API
Reference_Frame_Notes

.. toctree::
:maxdepth: 3
:caption: Filter Writers

Writing_A_New_Python_Filter
Developer_API

.. toctree::
:maxdepth: 1
:caption: Filter API/Docs

@PLUGIN_LIST@

.. toctree::
:maxdepth: 1
:caption: Release Notes

ReleaseNotes_110
ReleaseNotes_120
ReleaseNotes_121
ReleaseNotes_123
ReleaseNotes_124
ReleaseNotes_126
@PLUGIN_LIST@
ReleaseNotes_127

Indices and tables
==================
Expand Down
4 changes: 2 additions & 2 deletions wrapping/python/docs/source/Developer_API.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
API for Developers
===================
SIMPLNX Filter Writing API
==========================

General Parameters
------------------
Expand Down
29 changes: 27 additions & 2 deletions wrapping/python/docs/source/Installation.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
Installation
============

Latest Version: 1.2.6
Latest Version: 1.2.7
---------------------

The *simplnx* library can be installed through an Anaconda packages from the *BlueQuartzSoftware* channel. This can be achieved
by creating a new virtual environment
by creating a new virtual environment and installing SIMPLNX into that environment.


SIMPLNX Installation
^^^^^^^^^^^^^^^^^^^^

.. attention::

This kind of installation will allow you to utilize the SIMPLNX library through python.

.. code:: shell
Expand All @@ -15,3 +23,20 @@ by creating a new virtual environment
conda activate nxpython
conda install -c bluequartzsoftware simplnx
Full DREAM3D-NX Installation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. attention::

This kind of installation will allow you to utilize the full DREAM3D-NX application

.. code:: shell
conda config --add channels conda-forge
conda config --set channel_priority strict
conda create -n nxpython python=3.10
conda activate nxpython
conda install -c bluequartzsoftware dream3dnx
21 changes: 18 additions & 3 deletions wrapping/python/docs/source/Python_Introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,20 @@ Interoperating with Numpy
This will hopefully be addressed in a future update.


This code example shows how to create a simplnx DataArray and then use that array
SIMPLNX DataArray objects are exposed to python through the use of a numpy view into the Data Array. This means that any modifications
to the numpy view are immediately reflected in the DataArray itself. This kind of interaction opens up many 3rd party libraries that
operate on numpy arrays and views such as numpy itself, pillow (for image processing), scipy and others.

Once the DataStructure has a DataArray allocated into it through the use of a filter, the user can get a view of that
DataArray through the following:

.. code:: python
output_array_path = nx.DataPath(["Image Geometry/Cell Data/RGB"])
rgb_np_view = data_structure[output_array_path].npview()
The following code examples show how to create a simplnx DataArray and then use that array
as a numpy view.

The next code section was take from `basic_arrays.py <https://github.com/bluequartzsoftware/simplnx/tree/develop/wrapping/python/examples/basic_arrays.py>`__
Expand Down Expand Up @@ -345,7 +358,8 @@ The next code section was take from `basic_arrays.py <https://github.com/bluequa
tuple_dimensions=[[99]],
output_data_array=array_path,
initialization_value='0')
npdata = data_structure[array_path].store.npview()
# Get the new numpy view
npdata = data_structure[array_path].npview()
# Read the CSV file into the DataArray using the numpy view
file_path = 'angles.csv'
npdata[:] = np.loadtxt(file_path, delimiter=',')
Expand All @@ -356,6 +370,7 @@ The next code section was take from `basic_arrays.py <https://github.com/bluequa
input_type=0,
output_orientation_array_name='Quaternions',
output_type=2)
# Get the new numpy view and then print the data
npdata = data_structure['Quaternions'].store.npview()
npdata = data_structure['Quaternions'].npview()
print(npdata)
4 changes: 4 additions & 0 deletions wrapping/python/docs/source/User_API.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ API for Users
Error & Warning Reporting
--------------------------

.. _UserAPI:
.. py:module:: nx
.. _Result:
.. py:class:: Result
Expand Down
Loading

0 comments on commit c59e375

Please sign in to comment.