From 858d8f3b2ae4f40591e4cd0802b44e14592bb4ec Mon Sep 17 00:00:00 2001 From: Abe Levitan Date: Wed, 8 Jun 2022 13:30:49 -0700 Subject: [PATCH] Make edits to the docs to handle the lowercaseness of cdtools now --- README.md | 2 +- docs/source/conf.py | 2 +- docs/source/latextoc.rst | 2 ++ docs/source/tutorial.rst | 18 +++++++++--------- src/cdtools/datasets/__init__.py | 10 ++++++---- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 6ada9df..8dfcedb 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,6 @@ model.compare(dataset) # See how the simulated and measured patterns compare plt.show() ``` -Full installation instructions and documentation can be found [here](https://github.mit.edu/pages/Scattering/CDTools/). +Full installation instructions and documentation can be found [here](https://github.mit.edu/pages/Scattering/cdtools/). Have a wonderful day! diff --git a/docs/source/conf.py b/docs/source/conf.py index 84d4c29..9777da8 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -71,7 +71,7 @@ master_doc = 'index' # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = 'en' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. diff --git a/docs/source/latextoc.rst b/docs/source/latextoc.rst index 354fc21..8e0481a 100644 --- a/docs/source/latextoc.rst +++ b/docs/source/latextoc.rst @@ -1,3 +1,5 @@ +:orphan: + .. toctree:: :maxdepth: 1 diff --git a/docs/source/tutorial.rst b/docs/source/tutorial.rst index 1c16313..1397cab 100644 --- a/docs/source/tutorial.rst +++ b/docs/source/tutorial.rst @@ -13,7 +13,7 @@ Our first step will be creating the file and filling out the boilerplate: All th .. code-block:: python - import CDTools + import cdtools from matplotlib import pyplot as plt from scipy import io @@ -24,7 +24,7 @@ You can always import more libraries, like numpy, or pytorch, or pandas, or what .. code-block:: python filename = 'example_data/lab_ptycho_data.cxi' - dataset = CDTools.datasets.Ptycho2DDataset.from_cxi(filename) + dataset = cdtools.datasets.Ptycho2DDataset.from_cxi(filename) dataset.inspect() plt.show() @@ -35,7 +35,7 @@ Now that we know we have the data loaded and it looks good, we can go ahead and .. code-block:: python - model = CDTools.models.FancyPtycho.from_dataset(dataset) + model = cdtools.models.FancyPtycho.from_dataset(dataset) model.to(device='cuda') dataset.get_as(device='cuda') @@ -62,7 +62,7 @@ Once we run this, we can take a look at the result. What we see is pretty good, .. code-block:: python - model = CDTools.models.FancyPtycho.from_dataset(dataset, oversampling=2) + model = cdtools.models.FancyPtycho.from_dataset(dataset, oversampling=2) And secondly, we note that there don't seem to be any errors with the positioning. So we can just not reconstruct the probe positions, knowing that the initial guesses are already accurate enough. We can do this by writing the following line, just before we run the reconstruction for loop. @@ -77,7 +77,7 @@ After running this reconstruction, we can see that we're getting a little improv .. code-block:: python - model = CDTools.models.FancyPtycho.from_dataset(dataset, oversampling=2, + model = cdtools.models.FancyPtycho.from_dataset(dataset, oversampling=2, probe_support_radius=90) @@ -129,8 +129,8 @@ We can start with the basic skeleton for this file. In addition to our standard import numpy as np import torch as t from matplotlib import pyplot as plt - from CDTools.datasets import CDataset - from CDTools.tools import data as cdtdata + from cdtools.datasets import CDataset + from cdtools.tools import data as cdtdata __all__ = ['BasicPtychoDataset'] @@ -288,8 +288,8 @@ Once again, we start with the basic skeleton import numpy as np import torch as t - from CDTools.models import CDIModel - from CDTools import tools + from cdtools.models import CDIModel + from cdtools import tools __all__ = ['SimplePtycho'] diff --git a/src/cdtools/datasets/__init__.py b/src/cdtools/datasets/__init__.py index acad8da..ebccc20 100644 --- a/src/cdtools/datasets/__init__.py +++ b/src/cdtools/datasets/__init__.py @@ -10,10 +10,7 @@ implemented by default in pytorch (such as drawing data in a random order, drawing minibatches, etc.) New Datasets can be defined a subclass of the main CDataset class defined -in the base.py file. Example implementations of all these functions -can be found in the code for the Ptycho2DDataset class. In addition, it is -recommended to read through the tutorial section on defining a new CDI -dataset before attempting to do so +in the base.py file, and should define the following functions: * __init__ * __len__ @@ -23,6 +20,11 @@ dataset before attempting to do so * to_cxi * inspect +Example implementations of all these functions can be found in the code +for the Ptycho2DDataset class. In addition, it is recommended to read +through the tutorial section on defining a new CDI dataset before +attempting to do so + """ # I don't believe that __all__ really needed, but it's nice to define it