Skip to content

Commit f28da01

Browse files
committed
Update docs to reflect themove to pip from conda
1 parent 43bb36a commit f28da01

File tree

10 files changed

+100
-18
lines changed

10 files changed

+100
-18
lines changed

_sources/installation.rst.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,22 @@ The repository remains under active development as of late 2024.
1313
Step 2: Install Dependencies
1414
----------------------------
1515

16-
CDTools requires python 3.7 or greater.
16+
CDTools is regularly tested with Python versions 3.8 to 3.12, so it is recommended to use one of these versions. In general, CDTools requires Python 3.7 or higher.
1717

1818
The major dependency for CDTools is pytorch (version 1.9.0 or greater). Because the details of the installation can vary depending on platform, GPU availability, etc, it is recommended that you follow the install instructions on `the pytorch site`_ to install pytorch before installing the remaining dependencies.
1919

2020
.. _`the pytorch site`: https://pytorch.org/get-started/locally/
2121

22-
If you manage your environment with conda, the remaining dependencies can be installed by running the following command in the top level directory of the package:
22+
pytorch stopped supporting installation using conda for installation, so it is recommended continue the installation using pip.
2323

2424
.. code:: bash
2525
26-
$ conda install --file requirements.txt -c conda-forge
26+
$ pip install -r requirements.txt
27+
28+
This will install all required dependencies and verify that they meet the pytorch version requirements. Additionally, several optional dependencies used for testing and documentation will also be installed. The full set of dependencies and minimum requirements are listed below is listed below.
29+
30+
CDTools is reguarly tested with the latest versions of the packages shown below.
2731

28-
This will install all required dependencies *except for pytorch*, as well as several optional dependencies which are used for the tests and documentation. The full set of dependencies are noted below.
29-
3032
Required dependencies:
3133

3234
* `numpy <http://www.numpy.org>`_ >= 1.0

_sources/intro.rst.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ Introduction to CDTools
77
Introduction to CDTools
88
-----------------------
99

10-
`CDTools`_ is an open source python library for ptychography and CDI reconstructions, using an automatic differentiation based approach. It is distributed under an MIT (a.k.a. Expat) license.
11-
12-
.. _`CDTools`: https://github.com/cdtools-developers/cdtools
10+
CDTools is an open source python library for ptychography and CDI reconstructions, using an automatic differentiation based approach. It is distributed under an MIT (a.k.a. Expat) license.
1311

1412
.. code-block:: python
1513

datasets.html

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@
7474
<li class="toctree-l3"><a class="reference internal" href="#cdtools.datasets.Ptycho2DDataset.plot_mean_pattern"><code class="docutils literal notranslate"><span class="pre">Ptycho2DDataset.plot_mean_pattern()</span></code></a></li>
7575
<li class="toctree-l3"><a class="reference internal" href="#cdtools.datasets.Ptycho2DDataset.split"><code class="docutils literal notranslate"><span class="pre">Ptycho2DDataset.split()</span></code></a></li>
7676
<li class="toctree-l3"><a class="reference internal" href="#cdtools.datasets.Ptycho2DDataset.pad"><code class="docutils literal notranslate"><span class="pre">Ptycho2DDataset.pad()</span></code></a></li>
77+
<li class="toctree-l3"><a class="reference internal" href="#cdtools.datasets.Ptycho2DDataset.downsample"><code class="docutils literal notranslate"><span class="pre">Ptycho2DDataset.downsample()</span></code></a></li>
78+
<li class="toctree-l3"><a class="reference internal" href="#cdtools.datasets.Ptycho2DDataset.remove_translations_mask"><code class="docutils literal notranslate"><span class="pre">Ptycho2DDataset.remove_translations_mask()</span></code></a></li>
79+
<li class="toctree-l3"><a class="reference internal" href="#cdtools.datasets.Ptycho2DDataset.crop_translations"><code class="docutils literal notranslate"><span class="pre">Ptycho2DDataset.crop_translations()</span></code></a></li>
7780
</ul>
7881
</li>
7982
</ul>
@@ -472,6 +475,71 @@
472475
</dl>
473476
</dd></dl>
474477

478+
<dl class="py method">
479+
<dt class="sig sig-object py" id="cdtools.datasets.Ptycho2DDataset.downsample">
480+
<span class="sig-name descname"><span class="pre">downsample</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">factor</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">2</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cdtools.datasets.Ptycho2DDataset.downsample" title="Link to this definition"></a></dt>
481+
<dd><p>Downsamples all diffraction patterns by the specified factor</p>
482+
<p>This is an easy way to shrink the amount of data you need to work with
483+
if the speckle size is much larger than the detector pixel size.</p>
484+
<p>The downsampling factor must be an integer. The size of the output
485+
patterns are reduced by the specified factor, with each output pixel
486+
equal to the sum of a &lt;factor&gt; x &lt;factor&gt; region of pixels in the
487+
input pattern. This summation is done by pytorch.functional.avg_pool2d.</p>
488+
<p>Any mask and background data which is stored with the dataset is
489+
downsampled with the data. The background is downsampled using the same
490+
method as the data. The mask is expanded so that any output pixel
491+
containing a masked pixel will be masked.</p>
492+
<dl class="field-list simple">
493+
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
494+
<dd class="field-odd"><p><strong>factor</strong> (<em>int</em>) – Default 2, the factor to downsample by</p>
495+
</dd>
496+
</dl>
497+
</dd></dl>
498+
499+
<dl class="py method">
500+
<dt class="sig sig-object py" id="cdtools.datasets.Ptycho2DDataset.remove_translations_mask">
501+
<span class="sig-name descname"><span class="pre">remove_translations_mask</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mask_remove</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cdtools.datasets.Ptycho2DDataset.remove_translations_mask" title="Link to this definition"></a></dt>
502+
<dd><p>Removes one or more translation positions, and their associated
503+
properties, from the dataset using logical indexing.</p>
504+
<p>This takes a 1D mask (boolean torch tensor) with the length
505+
self.translations.shape[0] (i.e., the number of individual
506+
translated points). Patterns, translations, and intensities
507+
associated with indices that are “True” will be removed.</p>
508+
<section id="parameters">
509+
<h2>Parameters:<a class="headerlink" href="#parameters" title="Link to this heading"></a></h2>
510+
<dl class="simple">
511+
<dt>mask_remove<span class="classifier">1D torch.tensor(dtype=torch.bool)</span></dt><dd><p>The boolean mask indicating which elements are to be removed from
512+
the dataset. True indicates that the corresponding element will be
513+
removed.</p>
514+
</dd>
515+
</dl>
516+
</section>
517+
</dd></dl>
518+
519+
<dl class="py method">
520+
<dt class="sig sig-object py" id="cdtools.datasets.Ptycho2DDataset.crop_translations">
521+
<span class="sig-name descname"><span class="pre">crop_translations</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">roi</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cdtools.datasets.Ptycho2DDataset.crop_translations" title="Link to this definition"></a></dt>
522+
<dd><p>Shrinks the range of translation positions that are analyzed</p>
523+
<p>This deletes all diffraction patterns associated with x- and
524+
y-translations that lie outside of a specified rectangular
525+
region of interest. In essence, this operation crops the “relative
526+
displacement map” (shown in self.inspect()) down to the region of
527+
interest.</p>
528+
<section id="id1">
529+
<h2>Parameters:<a class="headerlink" href="#id1" title="Link to this heading"></a></h2>
530+
<dl class="simple">
531+
<dt>roi<span class="classifier">tuple(float, float, float, float)</span></dt><dd><p>The translation-x and -y coordinates that define the rectangular
532+
region of interest as (in units of meters)
533+
(left, right, bottom, top). The definition of these bounds are
534+
based on how an image is normally displayed with matplotlib’s
535+
imshow. The order in which these elements are defined in roi
536+
do not matter as long as roi[:2] and roi[2:] correspond with
537+
the x and y coordinates, respectively.</p>
538+
</dd>
539+
</dl>
540+
</section>
541+
</dd></dl>
542+
475543
</dd></dl>
476544

477545
</section>

genindex.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ <h1 id="index">Index</h1>
8787
| <a href="#A"><strong>A</strong></a>
8888
| <a href="#B"><strong>B</strong></a>
8989
| <a href="#C"><strong>C</strong></a>
90+
| <a href="#D"><strong>D</strong></a>
9091
| <a href="#E"><strong>E</strong></a>
9192
| <a href="#F"><strong>F</strong></a>
9293
| <a href="#G"><strong>G</strong></a>
@@ -303,6 +304,16 @@ <h2 id="C">C</h2>
303304
<li><a href="tools/image_processing.html#cdtools.tools.image_processing.convolve_1d">convolve_1d() (in module cdtools.tools.image_processing)</a>
304305
</li>
305306
<li><a href="tools/data.html#cdtools.tools.data.create_cxi">create_cxi() (in module cdtools.tools.data)</a>
307+
</li>
308+
<li><a href="datasets.html#cdtools.datasets.Ptycho2DDataset.crop_translations">crop_translations() (cdtools.datasets.Ptycho2DDataset method)</a>
309+
</li>
310+
</ul></td>
311+
</tr></table>
312+
313+
<h2 id="D">D</h2>
314+
<table style="width: 100%" class="indextable genindextable"><tr>
315+
<td style="width: 33%; vertical-align: top;"><ul>
316+
<li><a href="datasets.html#cdtools.datasets.Ptycho2DDataset.downsample">downsample() (cdtools.datasets.Ptycho2DDataset method)</a>
306317
</li>
307318
</ul></td>
308319
</tr></table>
@@ -553,10 +564,12 @@ <h2 id="R">R</h2>
553564
<td style="width: 33%; vertical-align: top;"><ul>
554565
<li><a href="models.html#cdtools.models.RPI.random_init">random_init() (cdtools.models.RPI method)</a>
555566
</li>
556-
<li><a href="models.html#cdtools.models.CDIModel.report">report() (cdtools.models.CDIModel method)</a>
567+
<li><a href="datasets.html#cdtools.datasets.Ptycho2DDataset.remove_translations_mask">remove_translations_mask() (cdtools.datasets.Ptycho2DDataset method)</a>
557568
</li>
558569
</ul></td>
559570
<td style="width: 33%; vertical-align: top;"><ul>
571+
<li><a href="models.html#cdtools.models.CDIModel.report">report() (cdtools.models.CDIModel method)</a>
572+
</li>
560573
<li><a href="models.html#cdtools.models.RPI">RPI (class in cdtools.models)</a>
561574
</li>
562575
<li><a href="tools/interactions.html#cdtools.tools.interactions.RPI_interaction">RPI_interaction() (in module cdtools.tools.interactions)</a>

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
</div>
8787
<section id="introduction-to-cdtools">
8888
<h1>Introduction to CDTools<a class="headerlink" href="#introduction-to-cdtools" title="Link to this heading"></a></h1>
89-
<p><a class="reference external" href="https://github.com/cdtools-developers/cdtools">CDTools</a> is an open source python library for ptychography and CDI reconstructions, using an automatic differentiation based approach. It is distributed under an MIT (a.k.a. Expat) license.</p>
89+
<p>CDTools is an open source python library for ptychography and CDI reconstructions, using an automatic differentiation based approach. It is distributed under an MIT (a.k.a. Expat) license.</p>
9090
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">matplotlib</span> <span class="kn">import</span> <span class="n">pyplot</span> <span class="k">as</span> <span class="n">plt</span>
9191
<span class="kn">from</span> <span class="nn">cdtools.datasets</span> <span class="kn">import</span> <span class="n">Ptycho2DDataset</span>
9292
<span class="kn">from</span> <span class="nn">cdtools.models</span> <span class="kn">import</span> <span class="n">FancyPtycho</span>

installation.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,14 @@ <h2>Step 1: Download<a class="headerlink" href="#step-1-download" title="Link to
9898
</section>
9999
<section id="step-2-install-dependencies">
100100
<h2>Step 2: Install Dependencies<a class="headerlink" href="#step-2-install-dependencies" title="Link to this heading"></a></h2>
101-
<p>CDTools requires python 3.7 or greater.</p>
101+
<p>CDTools is regularly tested with Python versions 3.8 to 3.12, so it is recommended to use one of these versions. In general, CDTools requires Python 3.7 or higher.</p>
102102
<p>The major dependency for CDTools is pytorch (version 1.9.0 or greater). Because the details of the installation can vary depending on platform, GPU availability, etc, it is recommended that you follow the install instructions on <a class="reference external" href="https://pytorch.org/get-started/locally/">the pytorch site</a> to install pytorch before installing the remaining dependencies.</p>
103-
<p>If you manage your environment with conda, the remaining dependencies can be installed by running the following command in the top level directory of the package:</p>
104-
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>conda<span class="w"> </span>install<span class="w"> </span>--file<span class="w"> </span>requirements.txt<span class="w"> </span>-c<span class="w"> </span>conda-forge
103+
<p>pytorch stopped supporting installation using conda for installation, so it is recommended continue the installation using pip.</p>
104+
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>-r<span class="w"> </span>requirements.txt
105105
</pre></div>
106106
</div>
107-
<p>This will install all required dependencies <em>except for pytorch</em>, as well as several optional dependencies which are used for the tests and documentation. The full set of dependencies are noted below.</p>
107+
<p>This will install all required dependencies and verify that they meet the pytorch version requirements. Additionally, several optional dependencies used for testing and documentation will also be installed. The full set of dependencies and minimum requirements are listed below is listed below.</p>
108+
<p>CDTools is reguarly tested with the latest versions of the packages shown below.</p>
108109
<p>Required dependencies:</p>
109110
<blockquote>
110111
<div><ul class="simple">

intro.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383

8484
<section id="introduction-to-cdtools">
8585
<h1>Introduction to CDTools<a class="headerlink" href="#introduction-to-cdtools" title="Link to this heading"></a></h1>
86-
<p><a class="reference external" href="https://github.com/cdtools-developers/cdtools">CDTools</a> is an open source python library for ptychography and CDI reconstructions, using an automatic differentiation based approach. It is distributed under an MIT (a.k.a. Expat) license.</p>
86+
<p>CDTools is an open source python library for ptychography and CDI reconstructions, using an automatic differentiation based approach. It is distributed under an MIT (a.k.a. Expat) license.</p>
8787
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">matplotlib</span> <span class="kn">import</span> <span class="n">pyplot</span> <span class="k">as</span> <span class="n">plt</span>
8888
<span class="kn">from</span> <span class="nn">cdtools.datasets</span> <span class="kn">import</span> <span class="n">Ptycho2DDataset</span>
8989
<span class="kn">from</span> <span class="nn">cdtools.models</span> <span class="kn">import</span> <span class="n">FancyPtycho</span>

0 commit comments

Comments
 (0)