From d01b14f2ff89051d5fd7da507c30b6062ab3e128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Tue, 12 Mar 2013 09:12:13 +0100 Subject: [PATCH 01/11] Add API documentation to latex docs --- doc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Makefile b/doc/Makefile index 7552be6b..311ce3ca 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -90,7 +90,7 @@ devhelp: @echo "# ln -s build/devhelp $$HOME/.local/share/devhelp/scikitimage" @echo "# devhelp" -latex: +latex: api $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(DEST)/latex @echo @echo "Build finished; the LaTeX files are in $(DEST)/latex." From b82764583a4991b9a07af08488e4f7bac7a75dea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Tue, 12 Mar 2013 09:36:33 +0100 Subject: [PATCH 02/11] Increase list-depth for nested quotes etc. --- doc/source/conf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 5071fab1..328a75a0 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -203,7 +203,10 @@ latex_documents = [ #latex_use_parts = False # Additional stuff for the LaTeX preamble. -#latex_preamble = '' +latex_preamble = ''' +\usepackage{enumitem} +\setlistdepth{100} +''' # Documents to append as an appendix to all manuals. #latex_appendices = [] From a1ad4ca34b000d237a9a9c674751505a3ccd9510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Tue, 12 Mar 2013 09:39:00 +0100 Subject: [PATCH 03/11] Change latex doc settings --- doc/source/conf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 328a75a0..7e742eb2 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -42,8 +42,8 @@ source_suffix = '.txt' master_doc = 'index' # General information about the project. -project = u'skimage' -copyright = u'2011, the scikit-image team' +project = 'skimage' +copyright = '2013, the scikit-image team' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -190,8 +190,8 @@ htmlhelp_basename = 'scikitimagedoc' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('contents', 'scikitimage.tex', u'The Image Scikit Documentation', - u'SciPy Developers', 'manual'), + ('contents', 'scikit-image.tex', u'The scikit-image Documentation', + u'scikit-image development team', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of From 0324737c4739824186b4da88ba408482a0d6f5b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Tue, 12 Mar 2013 09:39:42 +0100 Subject: [PATCH 04/11] Fix some doc strings for latex docs --- skimage/filter/rank/rank.pyx | 4 ++-- skimage/io/collection.py | 3 --- skimage/transform/hough_transform.py | 2 -- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/skimage/filter/rank/rank.pyx b/skimage/filter/rank/rank.pyx index e8a4c8f1..5380363a 100644 --- a/skimage/filter/rank/rank.pyx +++ b/skimage/filter/rank/rank.pyx @@ -669,7 +669,7 @@ def noise_filter(image, selem, out=None, mask=None, shift_x=False, def entropy(image, selem, out=None, mask=None, shift_x=False, shift_y=False): - """Returns the entropy [wiki_entropy]_ computed locally. Entropy is computed + """Returns the entropy [1]_ computed locally. Entropy is computed using base 2 logarithm i.e. the filter returns the minimum number of bits needed to encode local greylevel distribution. @@ -698,7 +698,7 @@ def entropy(image, selem, out=None, mask=None, shift_x=False, shift_y=False): References ---------- - .. [wiki_entropy] http://en.wikipedia.org/wiki/Entropy_(information_theory) + .. [1] http://en.wikipedia.org/wiki/Entropy_(information_theory) Examples -------- diff --git a/skimage/io/collection.py b/skimage/io/collection.py index 5a5dfff6..fafca83f 100644 --- a/skimage/io/collection.py +++ b/skimage/io/collection.py @@ -102,9 +102,6 @@ class MultiImage(object): (15, 10) (15, 10) - The two frames in this image can be shown with matplotlib: - - .. plot:: show_collection.py """ def __init__(self, filename, conserve_memory=True, dtype=None): """Load a multi-img.""" diff --git a/skimage/transform/hough_transform.py b/skimage/transform/hough_transform.py index e83cecd5..1552e531 100644 --- a/skimage/transform/hough_transform.py +++ b/skimage/transform/hough_transform.py @@ -140,8 +140,6 @@ def hough_line(img, theta=None): >>> out, angles, d = hough(img) - .. plot:: hough_tf.py - """ return _hough(img, theta) From 16863535ebc33401dc886aa1225837d17cbfe112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Wed, 13 Mar 2013 10:59:26 +0100 Subject: [PATCH 05/11] Re-enable plots in doc strings and generate PDF images for them --- doc/source/conf.py | 2 +- skimage/io/collection.py | 4 ++++ skimage/transform/hough_transform.py | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 7e742eb2..c5ca8869 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -246,7 +246,7 @@ matplotlib.rcParams.update({ """ plot_include_source = True -plot_formats = [('png', 100)] +plot_formats = [('png', 100), ('pdf', 100)] plot2rst_index_name = 'README' plot2rst_rcparams = {'image.cmap' : 'gray', diff --git a/skimage/io/collection.py b/skimage/io/collection.py index fafca83f..6aa9cfc6 100644 --- a/skimage/io/collection.py +++ b/skimage/io/collection.py @@ -102,6 +102,10 @@ class MultiImage(object): (15, 10) (15, 10) + The two frames in this image can be shown with matplotlib: + + .. plot:: show_collection.py + """ def __init__(self, filename, conserve_memory=True, dtype=None): """Load a multi-img.""" diff --git a/skimage/transform/hough_transform.py b/skimage/transform/hough_transform.py index 1552e531..e83cecd5 100644 --- a/skimage/transform/hough_transform.py +++ b/skimage/transform/hough_transform.py @@ -140,6 +140,8 @@ def hough_line(img, theta=None): >>> out, angles, d = hough(img) + .. plot:: hough_tf.py + """ return _hough(img, theta) From 97d7f88b0441413fc7ff330c63244b24dc76ac96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Wed, 13 Mar 2013 11:08:02 +0100 Subject: [PATCH 06/11] Explicitly set latex font size and paper size --- doc/source/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index c5ca8869..5d7a6fc4 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -182,10 +182,10 @@ htmlhelp_basename = 'scikitimagedoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' +latex_paper_size = 'a4' # The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' +latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). From 3f31b48fe1c80d3d744c27622de7f5fc846ab77a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Wed, 13 Mar 2013 11:10:03 +0100 Subject: [PATCH 07/11] Use plot_directive from matplotlib.sphinxext if available --- doc/source/conf.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 5d7a6fc4..975de3eb 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -26,9 +26,26 @@ sys.path.append(os.path.join(curpath, '..', 'ext')) # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.pngmath', 'numpydoc', - 'sphinx.ext.autosummary', 'plot_directive', 'plot2rst', + 'sphinx.ext.autosummary', 'plot2rst', 'sphinx.ext.intersphinx'] +# Determine if the matplotlib has a recent enough version of the +# plot_directive, otherwise use the local fork. +try: + from matplotlib.sphinxext import plot_directive +except ImportError: + use_matplotlib_plot_directive = False +else: + try: + use_matplotlib_plot_directive = (plot_directive.__version__ >= 2) + except AttributeError: + use_matplotlib_plot_directive = False + +if use_matplotlib_plot_directive: + extensions.append('matplotlib.sphinxext.plot_directive') +else: + extensions.append('plot_directive') + # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] From d68515f0d8e9dab05dc834b9bc4c42ae58a39024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Wed, 13 Mar 2013 12:03:44 +0100 Subject: [PATCH 08/11] Copy some useful latex settings from NumPy --- doc/source/conf.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 975de3eb..52dc8f13 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -220,9 +220,25 @@ latex_documents = [ #latex_use_parts = False # Additional stuff for the LaTeX preamble. -latex_preamble = ''' +latex_preamble = r''' \usepackage{enumitem} \setlistdepth{100} + +\usepackage{amsmath} +\DeclareUnicodeCharacter{00A0}{\nobreakspace} + +% In the parameters section, place a newline after the Parameters header +\usepackage{expdlist} +\let\latexdescription=\description +\def\description{\latexdescription{}{} \breaklabel} + +% Make Examples/etc section headers smaller and more compact +\makeatletter +\titleformat{\paragraph}{\normalsize\py@HeaderFamily}% + {\py@TitleColor}{0em}{\py@TitleColor}{\py@NormalColor} +\titlespacing*{\paragraph}{0pt}{1ex}{0pt} +\makeatother + ''' # Documents to append as an appendix to all manuals. From 169d945534f78425926057eb4900f33337a6d428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Wed, 13 Mar 2013 12:08:08 +0100 Subject: [PATCH 09/11] Fix make.bat --- doc/make.bat | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/make.bat b/doc/make.bat index e16c8d40..5f117648 100644 --- a/doc/make.bat +++ b/doc/make.bat @@ -27,6 +27,14 @@ if "%1" == "help" ( goto end ) +for %%x in (html htmlhelp latex qthelp) do ( + if "%1" == "%%x" ( + md source\api 2>NUL + python tools/build_modref_templates.py + ) +) + + if "%1" == "clean" ( for /d %%i in (build\*) do rmdir /q /s %%i del /q /s build\* @@ -34,6 +42,7 @@ if "%1" == "clean" ( ) if "%1" == "html" ( + cd source && python random_gallery.py && python coverage_generator.py && cd .. %SPHINXBUILD% -b html %ALLSPHINXOPTS% build/html echo. echo.Build finished. The HTML pages are in build/html. From 1d9fb145f6f2f0ce6261ea528f0ce3dcd09452f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Wed, 13 Mar 2013 12:09:39 +0100 Subject: [PATCH 10/11] Avoid duplicate python module index --- doc/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 52dc8f13..2f39b0b3 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -245,7 +245,7 @@ latex_preamble = r''' #latex_appendices = [] # If false, no module index is generated. -#latex_use_modindex = True +latex_use_modindex = False # ----------------------------------------------------------------------------- # Numpy extensions From 5e67572ac7aaa7a5bbfa22c4c4dd35b251ba8f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Wed, 13 Mar 2013 12:16:58 +0100 Subject: [PATCH 11/11] Do not set paper size to allow manual setting through make --- doc/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 2f39b0b3..c2179b41 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -199,7 +199,7 @@ htmlhelp_basename = 'scikitimagedoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). -latex_paper_size = 'a4' +#latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). latex_font_size = '10pt'