From ef9bcfb77854e815a4a0754b8d5daee59549cde1 Mon Sep 17 00:00:00 2001 From: emmanuelle Date: Tue, 29 Mar 2016 19:17:01 +0200 Subject: [PATCH] A first pass to let the gallery build using sphinx-gallery. --- doc/Makefile | 4 +- doc/examples/README.txt | 4 +- .../plot_windowed_histogram.py | 2 +- doc/examples/filters/plot_phase_unwrap.py | 50 +++++++++---------- .../{release_0.10.txt => release_0.10.rst} | 0 .../{release_0.11.txt => release_0.11.rst} | 0 .../{release_0.12.txt => release_0.12.rst} | 0 .../{release_0.3.txt => release_0.3.rst} | 0 .../{release_0.4.txt => release_0.4.rst} | 0 .../{release_0.5.txt => release_0.5.rst} | 0 .../{release_0.6.txt => release_0.6.rst} | 0 .../{release_0.7.txt => release_0.7.rst} | 0 .../{release_0.8.txt => release_0.8.rst} | 0 .../{release_0.9.txt => release_0.9.rst} | 0 .../{release_template.txt => release_dev.rst} | 0 .../{release_dev.txt => release_template.rst} | 0 .../{api_changes.txt => api_changes.rst} | 0 .../{cell_profiler.txt => cell_profiler.rst} | 0 doc/source/conf.py | 18 ++++++- doc/source/{contribute.txt => contribute.rst} | 0 .../{configure_git.txt => configure_git.rst} | 0 ..._workflow.txt => development_workflow.rst} | 0 ...lowing_latest.txt => following_latest.rst} | 0 .../{forking_hell.txt => forking_hell.rst} | 0 ...it_development.txt => git_development.rst} | 0 .../{git_install.txt => git_install.rst} | 0 .../gitwash/{git_intro.txt => git_intro.rst} | 0 .../{git_resources.txt => git_resources.rst} | 0 doc/source/gitwash/{index.txt => index.rst} | 0 ...r_workflow.txt => maintainer_workflow.rst} | 0 .../gitwash/{patching.txt => patching.rst} | 0 .../{set_up_fork.txt => set_up_fork.rst} | 0 doc/source/{gsoc2011.txt => gsoc2011.rst} | 0 doc/source/{index.txt => index.rst} | 0 doc/source/{install.txt => install.rst} | 0 doc/source/{license.txt => license.rst} | 0 doc/source/{overview.txt => overview.rst} | 0 ...txt => release_notes_and_installation.rst} | 0 doc/source/{user_guide.txt => user_guide.rst} | 0 .../{data_types.txt => data_types.rst} | 0 .../{getting_help.txt => getting_help.rst} | 0 ...etting_started.txt => getting_started.rst} | 0 .../{numpy_images.txt => numpy_images.rst} | 0 .../user_guide/{plugins.txt => plugins.rst} | 0 ...e_data.txt => transforming_image_data.rst} | 0 ...ation.txt => tutorial_parallelization.rst} | 0 ...entation.txt => tutorial_segmentation.rst} | 0 .../{tutorials.txt => tutorials.rst} | 0 .../user_guide/{viewer.txt => viewer.rst} | 0 49 files changed, 45 insertions(+), 33 deletions(-) rename doc/release/{release_0.10.txt => release_0.10.rst} (100%) rename doc/release/{release_0.11.txt => release_0.11.rst} (100%) rename doc/release/{release_0.12.txt => release_0.12.rst} (100%) rename doc/release/{release_0.3.txt => release_0.3.rst} (100%) rename doc/release/{release_0.4.txt => release_0.4.rst} (100%) rename doc/release/{release_0.5.txt => release_0.5.rst} (100%) rename doc/release/{release_0.6.txt => release_0.6.rst} (100%) rename doc/release/{release_0.7.txt => release_0.7.rst} (100%) rename doc/release/{release_0.8.txt => release_0.8.rst} (100%) rename doc/release/{release_0.9.txt => release_0.9.rst} (100%) rename doc/release/{release_template.txt => release_dev.rst} (100%) rename doc/release/{release_dev.txt => release_template.rst} (100%) rename doc/source/{api_changes.txt => api_changes.rst} (100%) rename doc/source/{cell_profiler.txt => cell_profiler.rst} (100%) rename doc/source/{contribute.txt => contribute.rst} (100%) rename doc/source/gitwash/{configure_git.txt => configure_git.rst} (100%) rename doc/source/gitwash/{development_workflow.txt => development_workflow.rst} (100%) rename doc/source/gitwash/{following_latest.txt => following_latest.rst} (100%) rename doc/source/gitwash/{forking_hell.txt => forking_hell.rst} (100%) rename doc/source/gitwash/{git_development.txt => git_development.rst} (100%) rename doc/source/gitwash/{git_install.txt => git_install.rst} (100%) rename doc/source/gitwash/{git_intro.txt => git_intro.rst} (100%) rename doc/source/gitwash/{git_resources.txt => git_resources.rst} (100%) rename doc/source/gitwash/{index.txt => index.rst} (100%) rename doc/source/gitwash/{maintainer_workflow.txt => maintainer_workflow.rst} (100%) rename doc/source/gitwash/{patching.txt => patching.rst} (100%) rename doc/source/gitwash/{set_up_fork.txt => set_up_fork.rst} (100%) rename doc/source/{gsoc2011.txt => gsoc2011.rst} (100%) rename doc/source/{index.txt => index.rst} (100%) rename doc/source/{install.txt => install.rst} (100%) rename doc/source/{license.txt => license.rst} (100%) rename doc/source/{overview.txt => overview.rst} (100%) rename doc/source/{release_notes_and_installation.txt => release_notes_and_installation.rst} (100%) rename doc/source/{user_guide.txt => user_guide.rst} (100%) rename doc/source/user_guide/{data_types.txt => data_types.rst} (100%) rename doc/source/user_guide/{getting_help.txt => getting_help.rst} (100%) rename doc/source/user_guide/{getting_started.txt => getting_started.rst} (100%) rename doc/source/user_guide/{numpy_images.txt => numpy_images.rst} (100%) rename doc/source/user_guide/{plugins.txt => plugins.rst} (100%) rename doc/source/user_guide/{transforming_image_data.txt => transforming_image_data.rst} (100%) rename doc/source/user_guide/{tutorial_parallelization.txt => tutorial_parallelization.rst} (100%) rename doc/source/user_guide/{tutorial_segmentation.txt => tutorial_segmentation.rst} (100%) rename doc/source/user_guide/{tutorials.txt => tutorials.rst} (100%) rename doc/source/user_guide/{viewer.txt => viewer.rst} (100%) diff --git a/doc/Makefile b/doc/Makefile index 63523365..7535afb6 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -43,7 +43,7 @@ api: release_notes: @echo "Copying release notes" - @tail -n +4 `ls release/*.txt | sort -k 2 -t . -n | tail -n 1` > release/_release_notes_for_docs.txt + @tail -n +4 `ls release/*.rst | sort -k 2 -t . -n | tail -n 1` > release/_release_notes_for_docs.rst html: api release_notes $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DEST)/html @@ -129,4 +129,4 @@ gitwash: --project-ml-url=http://groups.google.com/group/scikit-image \ --repo-name=scikit-image \ --github-user=scikit-image \ - --source-suffix=.txt + --source-suffix=.rst diff --git a/doc/examples/README.txt b/doc/examples/README.txt index ae692ec4..82328224 100644 --- a/doc/examples/README.txt +++ b/doc/examples/README.txt @@ -5,4 +5,6 @@ General examples General-purpose and introductory examples for scikit-image. -The `narrative documentation <../user_guide.html>`_ introduces conventions and basic image manipulations. +The `narrative documentation <../user_guide.html>`_ introduces +conventions and basic image manipulations. + diff --git a/doc/examples/features_detection/plot_windowed_histogram.py b/doc/examples/features_detection/plot_windowed_histogram.py index 65e67706..09de5ce0 100644 --- a/doc/examples/features_detection/plot_windowed_histogram.py +++ b/doc/examples/features_detection/plot_windowed_histogram.py @@ -1,4 +1,3 @@ -from __future__ import division """ ======================== Sliding window histogram @@ -35,6 +34,7 @@ References .. [2] S.Perreault and P.Hebert. Median filtering in constant time. Trans. Image Processing, 16(9):2389-2394, 2007. """ +from __future__ import division import numpy as np import matplotlib import matplotlib.pyplot as plt diff --git a/doc/examples/filters/plot_phase_unwrap.py b/doc/examples/filters/plot_phase_unwrap.py index 73298b10..aba03ff6 100644 --- a/doc/examples/filters/plot_phase_unwrap.py +++ b/doc/examples/filters/plot_phase_unwrap.py @@ -42,14 +42,12 @@ ax3.set_title('After phase unwrapping') fig.colorbar(ax4.imshow(image_unwrapped - image, cmap='gray'), ax=ax4) ax4.set_title('Unwrapped minus original') -""" -.. image:: PLOT2RST.current_figure -The unwrapping procedure accepts masked arrays, and can also optionally -assume cyclic boundaries to connect edges of an image. In the example below, -we study a simple phase ramp which has been split in two by masking -a row of the image. -""" +########################################################################### +# The unwrapping procedure accepts masked arrays, and can also optionally +# assume cyclic boundaries to connect edges of an image. In the example below, +# we study a simple phase ramp which has been split in two by masking +# a row of the image. # Create a simple ramp image = np.ones((100, 100)) * np.linspace(0, 8 * np.pi, 100).reshape((-1, 1)) @@ -84,24 +82,22 @@ ax4.set_title('Unwrapped with wrap_around') plt.show() -""" -.. image:: PLOT2RST.current_figure -In the figures above, the masked row can be seen as a white line across -the image. The difference between the two unwrapped images in the bottom row -is clear: Without unwrapping (lower left), the regions above and below the -masked boundary do not interact at all, resulting in an offset between the -two regions of an arbitrary integer times two pi. We could just as well have -unwrapped the regions as two separate images. With wrap around enabled for the -vertical direction (lower right), the situation changes: Unwrapping paths are -now allowed to pass from the bottom to the top of the image and vice versa, in -effect providing a way to determine the offset between the two regions. - -References ----------- - -.. [1] Miguel Arevallilo Herraez, David R. Burton, Michael J. Lalor, - and Munther A. Gdeisat, "Fast two-dimensional phase-unwrapping - algorithm based on sorting by reliability following a noncontinuous - path", Journal Applied Optics, Vol. 41, No. 35, pp. 7437, 2002 -""" +########################################################################### +# In the figures above, the masked row can be seen as a white line across +# the image. The difference between the two unwrapped images in the bottom row +# is clear: Without unwrapping (lower left), the regions above and below the +# masked boundary do not interact at all, resulting in an offset between the +# two regions of an arbitrary integer times two pi. We could just as well have +# unwrapped the regions as two separate images. With wrap around enabled for the +# vertical direction (lower right), the situation changes: Unwrapping paths are +# now allowed to pass from the bottom to the top of the image and vice versa, in +# effect providing a way to determine the offset between the two regions. +# +# References +# ---------- +# +# .. [1] Miguel Arevallilo Herraez, David R. Burton, Michael J. Lalor, +# and Munther A. Gdeisat, "Fast two-dimensional phase-unwrapping +# algorithm based on sorting by reliability following a noncontinuous +# path", Journal Applied Optics, Vol. 41, No. 35, pp. 7437, 2002 diff --git a/doc/release/release_0.10.txt b/doc/release/release_0.10.rst similarity index 100% rename from doc/release/release_0.10.txt rename to doc/release/release_0.10.rst diff --git a/doc/release/release_0.11.txt b/doc/release/release_0.11.rst similarity index 100% rename from doc/release/release_0.11.txt rename to doc/release/release_0.11.rst diff --git a/doc/release/release_0.12.txt b/doc/release/release_0.12.rst similarity index 100% rename from doc/release/release_0.12.txt rename to doc/release/release_0.12.rst diff --git a/doc/release/release_0.3.txt b/doc/release/release_0.3.rst similarity index 100% rename from doc/release/release_0.3.txt rename to doc/release/release_0.3.rst diff --git a/doc/release/release_0.4.txt b/doc/release/release_0.4.rst similarity index 100% rename from doc/release/release_0.4.txt rename to doc/release/release_0.4.rst diff --git a/doc/release/release_0.5.txt b/doc/release/release_0.5.rst similarity index 100% rename from doc/release/release_0.5.txt rename to doc/release/release_0.5.rst diff --git a/doc/release/release_0.6.txt b/doc/release/release_0.6.rst similarity index 100% rename from doc/release/release_0.6.txt rename to doc/release/release_0.6.rst diff --git a/doc/release/release_0.7.txt b/doc/release/release_0.7.rst similarity index 100% rename from doc/release/release_0.7.txt rename to doc/release/release_0.7.rst diff --git a/doc/release/release_0.8.txt b/doc/release/release_0.8.rst similarity index 100% rename from doc/release/release_0.8.txt rename to doc/release/release_0.8.rst diff --git a/doc/release/release_0.9.txt b/doc/release/release_0.9.rst similarity index 100% rename from doc/release/release_0.9.txt rename to doc/release/release_0.9.rst diff --git a/doc/release/release_template.txt b/doc/release/release_dev.rst similarity index 100% rename from doc/release/release_template.txt rename to doc/release/release_dev.rst diff --git a/doc/release/release_dev.txt b/doc/release/release_template.rst similarity index 100% rename from doc/release/release_dev.txt rename to doc/release/release_template.rst diff --git a/doc/source/api_changes.txt b/doc/source/api_changes.rst similarity index 100% rename from doc/source/api_changes.txt rename to doc/source/api_changes.rst diff --git a/doc/source/cell_profiler.txt b/doc/source/cell_profiler.rst similarity index 100% rename from doc/source/cell_profiler.txt rename to doc/source/cell_profiler.rst diff --git a/doc/source/conf.py b/doc/source/conf.py index ae734c3d..d13cefb4 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -31,11 +31,23 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.imgmath', 'numpydoc', 'sphinx.ext.autosummary', - 'plot2rst', + #'plot2rst', 'sphinx.ext.intersphinx', 'sphinx.ext.linkcode', + 'sphinx_gallery.gen_gallery' ] +#------------------------------------------------------------------------ +# Sphinx-gallery configuration +#------------------------------------------------------------------------ + +sphinx_gallery_conf = { + # path to your examples scripts + 'examples_dirs' : '../examples', + # path where to save gallery generated examples + 'gallery_dirs' : 'auto_examples', + } + # Determine if the matplotlib has a recent enough version of the # plot_directive, otherwise use the local fork. try: @@ -57,7 +69,7 @@ else: templates_path = ['_templates'] # The suffix of source filenames. -source_suffix = '.txt' +source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' @@ -366,3 +378,5 @@ def linkcode_resolve(domain, info): else: return ("http://github.com/scikit-image/scikit-image/blob/" "v%s/skimage/%s%s" % (skimage.__version__, fn, linespec)) + + diff --git a/doc/source/contribute.txt b/doc/source/contribute.rst similarity index 100% rename from doc/source/contribute.txt rename to doc/source/contribute.rst diff --git a/doc/source/gitwash/configure_git.txt b/doc/source/gitwash/configure_git.rst similarity index 100% rename from doc/source/gitwash/configure_git.txt rename to doc/source/gitwash/configure_git.rst diff --git a/doc/source/gitwash/development_workflow.txt b/doc/source/gitwash/development_workflow.rst similarity index 100% rename from doc/source/gitwash/development_workflow.txt rename to doc/source/gitwash/development_workflow.rst diff --git a/doc/source/gitwash/following_latest.txt b/doc/source/gitwash/following_latest.rst similarity index 100% rename from doc/source/gitwash/following_latest.txt rename to doc/source/gitwash/following_latest.rst diff --git a/doc/source/gitwash/forking_hell.txt b/doc/source/gitwash/forking_hell.rst similarity index 100% rename from doc/source/gitwash/forking_hell.txt rename to doc/source/gitwash/forking_hell.rst diff --git a/doc/source/gitwash/git_development.txt b/doc/source/gitwash/git_development.rst similarity index 100% rename from doc/source/gitwash/git_development.txt rename to doc/source/gitwash/git_development.rst diff --git a/doc/source/gitwash/git_install.txt b/doc/source/gitwash/git_install.rst similarity index 100% rename from doc/source/gitwash/git_install.txt rename to doc/source/gitwash/git_install.rst diff --git a/doc/source/gitwash/git_intro.txt b/doc/source/gitwash/git_intro.rst similarity index 100% rename from doc/source/gitwash/git_intro.txt rename to doc/source/gitwash/git_intro.rst diff --git a/doc/source/gitwash/git_resources.txt b/doc/source/gitwash/git_resources.rst similarity index 100% rename from doc/source/gitwash/git_resources.txt rename to doc/source/gitwash/git_resources.rst diff --git a/doc/source/gitwash/index.txt b/doc/source/gitwash/index.rst similarity index 100% rename from doc/source/gitwash/index.txt rename to doc/source/gitwash/index.rst diff --git a/doc/source/gitwash/maintainer_workflow.txt b/doc/source/gitwash/maintainer_workflow.rst similarity index 100% rename from doc/source/gitwash/maintainer_workflow.txt rename to doc/source/gitwash/maintainer_workflow.rst diff --git a/doc/source/gitwash/patching.txt b/doc/source/gitwash/patching.rst similarity index 100% rename from doc/source/gitwash/patching.txt rename to doc/source/gitwash/patching.rst diff --git a/doc/source/gitwash/set_up_fork.txt b/doc/source/gitwash/set_up_fork.rst similarity index 100% rename from doc/source/gitwash/set_up_fork.txt rename to doc/source/gitwash/set_up_fork.rst diff --git a/doc/source/gsoc2011.txt b/doc/source/gsoc2011.rst similarity index 100% rename from doc/source/gsoc2011.txt rename to doc/source/gsoc2011.rst diff --git a/doc/source/index.txt b/doc/source/index.rst similarity index 100% rename from doc/source/index.txt rename to doc/source/index.rst diff --git a/doc/source/install.txt b/doc/source/install.rst similarity index 100% rename from doc/source/install.txt rename to doc/source/install.rst diff --git a/doc/source/license.txt b/doc/source/license.rst similarity index 100% rename from doc/source/license.txt rename to doc/source/license.rst diff --git a/doc/source/overview.txt b/doc/source/overview.rst similarity index 100% rename from doc/source/overview.txt rename to doc/source/overview.rst diff --git a/doc/source/release_notes_and_installation.txt b/doc/source/release_notes_and_installation.rst similarity index 100% rename from doc/source/release_notes_and_installation.txt rename to doc/source/release_notes_and_installation.rst diff --git a/doc/source/user_guide.txt b/doc/source/user_guide.rst similarity index 100% rename from doc/source/user_guide.txt rename to doc/source/user_guide.rst diff --git a/doc/source/user_guide/data_types.txt b/doc/source/user_guide/data_types.rst similarity index 100% rename from doc/source/user_guide/data_types.txt rename to doc/source/user_guide/data_types.rst diff --git a/doc/source/user_guide/getting_help.txt b/doc/source/user_guide/getting_help.rst similarity index 100% rename from doc/source/user_guide/getting_help.txt rename to doc/source/user_guide/getting_help.rst diff --git a/doc/source/user_guide/getting_started.txt b/doc/source/user_guide/getting_started.rst similarity index 100% rename from doc/source/user_guide/getting_started.txt rename to doc/source/user_guide/getting_started.rst diff --git a/doc/source/user_guide/numpy_images.txt b/doc/source/user_guide/numpy_images.rst similarity index 100% rename from doc/source/user_guide/numpy_images.txt rename to doc/source/user_guide/numpy_images.rst diff --git a/doc/source/user_guide/plugins.txt b/doc/source/user_guide/plugins.rst similarity index 100% rename from doc/source/user_guide/plugins.txt rename to doc/source/user_guide/plugins.rst diff --git a/doc/source/user_guide/transforming_image_data.txt b/doc/source/user_guide/transforming_image_data.rst similarity index 100% rename from doc/source/user_guide/transforming_image_data.txt rename to doc/source/user_guide/transforming_image_data.rst diff --git a/doc/source/user_guide/tutorial_parallelization.txt b/doc/source/user_guide/tutorial_parallelization.rst similarity index 100% rename from doc/source/user_guide/tutorial_parallelization.txt rename to doc/source/user_guide/tutorial_parallelization.rst diff --git a/doc/source/user_guide/tutorial_segmentation.txt b/doc/source/user_guide/tutorial_segmentation.rst similarity index 100% rename from doc/source/user_guide/tutorial_segmentation.txt rename to doc/source/user_guide/tutorial_segmentation.rst diff --git a/doc/source/user_guide/tutorials.txt b/doc/source/user_guide/tutorials.rst similarity index 100% rename from doc/source/user_guide/tutorials.txt rename to doc/source/user_guide/tutorials.rst diff --git a/doc/source/user_guide/viewer.txt b/doc/source/user_guide/viewer.rst similarity index 100% rename from doc/source/user_guide/viewer.txt rename to doc/source/user_guide/viewer.rst