From abdd0d6e1ef2e13eaa0544158d02d72e1af06d0a Mon Sep 17 00:00:00 2001 From: Abraham Levitan Date: Mon, 16 Dec 2019 12:40:41 -0500 Subject: [PATCH] Update docs so that they can produce a latex/pdf version as well --- docs/source/conf.py | 8 ++++++-- docs/source/index.rst | 34 ++-------------------------------- docs/source/intro.rst | 40 ++++++++++++++++++++++++++++++++++++++++ docs/source/latextoc.rst | 14 ++++++++++++++ 4 files changed, 62 insertions(+), 34 deletions(-) create mode 100644 docs/source/intro.rst create mode 100644 docs/source/latextoc.rst diff --git a/docs/source/conf.py b/docs/source/conf.py index b5dd381..5b54560 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -114,7 +114,7 @@ html_theme = 'sphinx_rtd_theme' # -- Options for HTMLHelp output --------------------------------------------- # Output file base name for HTML help builder. -htmlhelp_basename = 'ADCDdoc' +htmlhelp_basename = 'CDToolsdoc' # -- Options for LaTeX output ------------------------------------------------ @@ -140,8 +140,12 @@ latex_elements = { # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). +#latex_documents = [ +# (master_doc, 'CDTools.tex', 'CDTools Documentation', +# 'Abraham Levitan', 'manual'), +#] latex_documents = [ - (master_doc, 'ADCD.tex', 'ADCD Documentation', + ('latextoc', 'CDTools.tex', 'CDTools Documentation', 'Abraham Levitan', 'manual'), ] diff --git a/docs/source/index.rst b/docs/source/index.rst index f26f216..c6fcb8d 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -11,37 +11,7 @@ models tools/index indices_tables + -Introduction to CDTools -======================= +.. include:: intro.rst -CDTools is a python library for ptychography and CDI reconstructions, using an Automatic Differentiation based approach. - -.. code-block:: python - - # imports - from matplotlib import pyplot as plt - from CDTools.datasets import Ptycho2DDataset - from CDTools.models import SimplePtycho - - # Load the file - dataset = Ptycho2DDataset.from_cxi('ptycho_data.cxi') - - # Generate a model from the data - model = SimplePtycho.from_dataset(dataset) - - # Run a reconstruction - for i, loss in enumerate(model.Adam_optimize(10, dataset)): - print(i, loss) - - # And look at the results! - model.inspect(dataset) - model.compare(dataset) - plt.show() - - -CDTools makes it simple to load and inspect data stored in .cxi files using python scripts. Several reconstruction models for common geometries are included "out of the box". For more advanced users, it includes a bunch of modular functions for AD ptychography, which can then be used right away from the same scripting framework. - -The high-level interface to CDTools is built on a lower level "three-legged stool". This consists of tools to access stored data, tools to visualize data and reconstructions, and tools that implement basic operations relevant to coherent diffraction. All of these tools can be used directly alongside the high-level interface, when needed. - -Enough blabber. If you're interested, read the docs! diff --git a/docs/source/intro.rst b/docs/source/intro.rst new file mode 100644 index 0000000..5c981e8 --- /dev/null +++ b/docs/source/intro.rst @@ -0,0 +1,40 @@ +Introduction to CDTools +======================= + + +.. only:: latex + + Introduction to CDTools + ----------------------- + +CDTools is a python library for ptychography and CDI reconstructions, using an Automatic Differentiation based approach. + +.. code-block:: python + + # imports + from matplotlib import pyplot as plt + from CDTools.datasets import Ptycho2DDataset + from CDTools.models import SimplePtycho + + # Load the file + dataset = Ptycho2DDataset.from_cxi('ptycho_data.cxi') + + # Generate a model from the data + model = SimplePtycho.from_dataset(dataset) + + # Run a reconstruction + for i, loss in enumerate(model.Adam_optimize(10, dataset)): + print(i, loss) + + # And look at the results! + model.inspect(dataset) + model.compare(dataset) + plt.show() + + +CDTools makes it simple to load and inspect data stored in .cxi files using python scripts. Several reconstruction models for common geometries are included "out of the box". For more advanced users, it includes a bunch of modular functions for AD ptychography, which can then be used right away from the same scripting framework. + +The high-level interface to CDTools is built on a lower level "three-legged stool". This consists of tools to access stored data, tools to visualize data and reconstructions, and tools that implement basic operations relevant to coherent diffraction. All of these tools can be used directly alongside the high-level interface, when needed. + +Enough blabber. If you're interested, read the docs! + diff --git a/docs/source/latextoc.rst b/docs/source/latextoc.rst new file mode 100644 index 0000000..354fc21 --- /dev/null +++ b/docs/source/latextoc.rst @@ -0,0 +1,14 @@ +.. toctree:: + :maxdepth: 1 + + intro + installation + examples + tutorial + general + datasets + models + tools/index + indices_tables + +