diff --git a/conda/meta.yaml b/conda/meta.yaml index 2cbd45b8eba..093d6bbc085 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -1,13 +1,11 @@ package: name: odl - version: "0.4.0" + version: "0.5.0" source: - # fn: odl-0.4.0.tar.gz - # url: https://pypi.python.org/packages/4d/f4/f7e0dbc1162d7286a306cd5a985a4d1f705a3bc1d892c5991b86037c2cb6/odl-0.4.0.tar.gz - # md5: aba2e6b826aae1ff8f95bf495b67034b git_url: https://github.com/odlgroup/odl - git_rev: master # for testing + git_rev: master # for testing, put any branch here + # git_rev: v0.5.0 # release build: noarch_python: True diff --git a/conftest.py b/conftest.py index 1ce2a97b9e0..e59c7fb5590 100644 --- a/conftest.py +++ b/conftest.py @@ -62,6 +62,9 @@ def pytest_addoption(parser): parser.addoption('--examples', action='store_true', help='Run examples') + parser.addoption('--documentation', action='store_true', + help='Run doctests in the documentation') + # reusable fixtures fn_impl_params = odl.FN_IMPLS.keys() diff --git a/doc/source/conf.py b/doc/source/conf.py index 0f9bf4778b3..b5849b7732e 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -67,8 +67,8 @@ # Intersphinx to get Numpy and other targets intersphinx_mapping = { 'python': ('https://docs.python.org/3/', None), - 'numpy': ('http://docs.scipy.org/doc/numpy/', None), - 'scipy': ('http://docs.scipy.org/doc/scipy/reference/', None), + 'numpy': ('https://docs.scipy.org/doc/numpy/', None), + 'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None), 'matplotlib': ('http://matplotlib.org/', None), 'pywt': ('http://www.pybytes.com/pywavelets/', None), 'pyfftw': ('https://hgomersall.github.io/pyFFTW/', None)} diff --git a/doc/source/guide/index.rst b/doc/source/guide/index.rst deleted file mode 100644 index dde283f2147..00000000000 --- a/doc/source/guide/index.rst +++ /dev/null @@ -1,16 +0,0 @@ -######## -In depth -######## - -This is a more in depth guide to the different parts of ODL. - -.. toctree:: - :maxdepth: 2 - - operator_guide - linearspace_guide - functional_guide - vectorization_guide - numpy_guide - proximal_lang_guide - chambolle_pock_guide diff --git a/doc/source/release_notes.rst b/doc/source/release_notes.rst index df132eb7043..4a9786ca252 100644 --- a/doc/source/release_notes.rst +++ b/doc/source/release_notes.rst @@ -9,8 +9,30 @@ Release Notes Next release ============ + +ODL 0.5.0 Release Notes (2016-10-21) +==================================== + +This release features a new important top level class ``Functional`` that is intended to be used in optimization methods. +Beyond its parent ``Operator``, it provides special methods and properties like ``gradient`` or ``proximal`` which are useful in advanced smooth or non-smooth optimization schemes. +The interfaces of all solvers in ``odl.solvers`` have been updated to make use of functionals instead of their proximals, gradients etc. directly. + +Further notable changes are the implementation of an ``as_writable_array`` context manager that exposes arbitrary array storage as writable Numpy arrays, and the generalization of the wavelet transform to arbitrary dimensions. + +See below for a complete list of changes. + + New features ------------ +- Add ``Functional`` class to the solvers package. (:pull:`498`) + ``Functional`` is a subclass of odl ``Operator`` and intended to help in formulating and solving optimization problems. + It contains optimization specific features like ``proximal`` and ``convex_conj``, and built-in intelligence for handling things like translation, scaling of argument or scaling of functional. + * Migrate all solvers to work with ``Functional``'s instead of raw proximals etc. (:pull:`587`) + * ``FunctionalProduct`` and ``FunctionalQuotient`` which allow evaluation of the product/quotient of functions and also provides a gradient through the Leibniz/quotient rules. (:pull:`586`) + * ``FunctionalDefaultConvexConjugate`` which acts as a default for ``Functional.convex_conj``, providing it with a proximal property. (:pull:`588`) + * ``IndicatorBox`` and ``IndicatorNonnegativity`` which are indicator functions on a box shaped set and the set of nonnegative numbers, respectively. They return 0 if all points in a vector are inside the box, and infinity otherwise. (:pull:`589`) + * Add ``Functional``s for ``KullbackLeibler`` and ``KullbackLeiblerCrossEntropy``, together with corresponding convex conjugates (:pull:`627`). + Also add proximal operator for the convex conjugate of cross entropy Kullback-Leibler divergence, called ``proximal_cconj_kl_cross_entropy`` (:pull:`561`) - Add ``ResizingOperator`` for shrinking and extending (padding) of discretized functions, including a variety of padding methods. (:pull:`499`) - Add ``as_writable_array`` that allows casting arbitrary array-likes to a numpy array and then storing the results later on. This is intended to be used with odl vectors that may not be stored in numpy format (like cuda vectors), but can be used with other types like lists. @@ -26,7 +48,14 @@ New features - Add ``FunctionalDefaultConvexConjugate`` which acts as a default for ``Functional.convex_conj``, providing it with a proximal property. (:pull:`588`) - Add ``IndicatorBox`` and ``IndicatorNonnegativity`` which are indicator functions on a box shaped set and the set of nonnegative numbers, respectively. They return 0 if all points in a vector are inside the box, and infinity otherwise. (:pull:`589`) - Add proximal operator for the convex conjugate of cross entropy Kullback-Leibler divergence, called ``proximal_cconj_kl_cross_entropy`` (:pull:`561`) -- Add ``Functional``s for ``KullbackLeibler`` and ``KullbackLeiblerCrossEntropy``, together with corresponding convex conjugates (:pull:`627`) +- Add ``Functional``'s for ``KullbackLeibler`` and ``KullbackLeiblerCrossEntropy``, together with corresponding convex conjugates (:pull:`627`) +- Add tutorial style example. (:pull:`521`) +- Add MLEM solver. (:pull:`497`) +- Add ``MatVecOperator.inverse``. (:pull:`608`) +- Add the ``Rosenbrock`` standard test functional. (:pull:`602`) +- Add broadcasting of vector arithmetic involving ``ProductSpace`` vectors. (:pull:`555`) +- Add ``phantoms.poisson_noise``. (:pull:`630`) +- Add ``NumericalGradient`` and ``NumericalDerivative`` that numerically compute gradient and derivative of ``Operator``'s and ``Functional``'s. (:pull:`624`) Improvements ------------ @@ -36,19 +65,27 @@ Improvements - Allow showing subsets of the whole volume in ``DiscreteLpElement.show``. Previously this allowed slices to be shown, but the new version allows subsets such as ``0 < x < 3`` to be shown as well. (:pull:`574`) - Add ``Solvercallback.reset()`` which allows users to reset a callback to its initial state. Applicable if users want to reuse a callback in another solver. (:pull:`553`) - ``WaveletTransform`` and related operators now work in arbitrary dimensions. (:pull:`547`) +- Several documentation improvements. Including: + + * Move documentation from ``_call`` to ``__init__``. (:pull:`549`) + * Major review of minor style issues. (:pull:`534`) + * Typeset math in proximals. (:pull:`580`) + +- Improved installation docs and update of Chambolle-Pock documentation. (:pull:`121`) Changes -------- -- Changed definition of ``LinearSpaceVector.multiply`` to match the definition used by Numpy. (:pull:`509`) -- The parameters ``padding_method`` in ``diff_ops.py`` and ``mode`` in ``wavelet.py`` have been renamed to ``pad_mode``. +- Change definition of ``LinearSpaceVector.multiply`` to match the definition used by Numpy. (:pull:`509`) +- Rename the parameters ``padding_method`` in ``diff_ops.py`` and ``mode`` in ``wavelet.py`` to ``pad_mode``. The parameter ``padding_value`` is now called ``pad_const``. (:pull:`511`) - Expose ``ellipse_phantom`` and ``shepp_logan_ellipses`` to ``odl.phantom``. (:pull:`529`) - Unify the names of minimum (``min_pt``), maximum (``max_pt``) and middle (``mid_pt``) points as well as number of points (``shape``) in grids, interval products and factory functions for discretized spaces. (:pull:`541`) -- Removed ``simple_operator`` since it was never used and did not follow the ODL style. (:pull:`543`) +- Remove ``simple_operator`` since it was never used and did not follow the ODL style. (:pull:`543`) The parameter ``padding_value`` is now called ``pad_const``. -- Removed ``Interval``, ``Rectangle`` and ``Cuboid`` since they were confusing (Capitalized name but not a Cunction) and barely ever used. +- Remove ``Interval``, ``Rectangle`` and ``Cuboid`` since they were confusing (Capitalized name but not a class) and barely ever used. Users should instead use ``IntervalProd`` in all cases. (:pull:`537`) -- The following classes have been renamed: +- The following classes have been renamed (:pull:`560`): + * ``LinearSpaceVector`` -> ``LinearSpaceElement`` * ``DiscreteLpVector`` -> ``DiscreteLpElement`` * ``ProductSpaceVector`` -> ``ProductSpaceElement`` @@ -56,15 +93,24 @@ Changes * ``DiscretizedSpaceVector`` -> ``DiscretizedSpaceElement`` * ``FunctionSetVector`` -> ``FunctionSetElement`` * ``FunctionSpaceVector`` -> ``FunctionSpaceElement`` -- Changed parameter style of differential operators from having a ``pad_mode`` and a separate ``edge_order`` argument that were mutually exclusive to a single ``pad_mode`` that covers all cases. + +- Change parameter style of differential operators from having a ``pad_mode`` and a separate ``edge_order`` argument that were mutually exclusive to a single ``pad_mode`` that covers all cases. Also added several new pad modes to the differential operators. (:pull:`548`) +- Switch from RTD documentation hosting to gh-pages and let Travis CI build and deploy the documentation. (:pull:`536`) - Update name of ``proximal_zero`` to ``proximal_const_func``. (:pull:`582`) +- Move unit tests from top level ``test/`` to ``odl/test/`` folder and distribute them with the source. (:pull:`638`) +- Update pytest dependency to [>3.0] and use new featuers. (:pull:`653`) +- Add pytest option ``--documentation`` to test all doctest examples in the online documentation. +- Remove the ``pip install odl[all]`` option since it fails by default. + Bugfixes -------- -- Fixed ``python -c "import odl; odl.test()"`` not working on Windows. (:pull:`508`) -- Fixed a ``TypeError`` being raised in ``OperatorTest`` when running ``optest.ajoint()`` without specifying an operator norm. (:pull:`525`) - +- Fix ``python -c "import odl; odl.test()"`` not working on Windows. (:pull:`508`) +- Fix a ``TypeError`` being raised in ``OperatorTest`` when running ``optest.ajoint()`` without specifying an operator norm. (:pull:`525`) +- Fix scaling of scikit ray transform for non full scan. (:pull:`523`) +- Fix bug causing classes to not be vectorizable. (:pull:`604`) +- Fix rounding problem in some proximals (:pull:`661`) ODL 0.4.0 Release Notes (2016-08-17) ==================================== diff --git a/odl/__init__.py b/odl/__init__.py index 780c2cd4d56..100503f5d60 100644 --- a/odl/__init__.py +++ b/odl/__init__.py @@ -25,7 +25,7 @@ from __future__ import absolute_import -__version__ = '0.4.0' +__version__ = '0.5.0' __all__ = ('diagnostics', 'discr', 'operator', 'set', 'space', 'solvers', 'tomo', 'trafos', 'util', 'phantom', 'deform') diff --git a/doc/doctest_doc.py b/odl/test/test_doc.py similarity index 66% rename from doc/doctest_doc.py rename to odl/test/test_doc.py index 15caa4ea46c..fd5e6cf95bc 100644 --- a/doc/doctest_doc.py +++ b/odl/test/test_doc.py @@ -15,6 +15,15 @@ # You should have received a copy of the GNU General Public License # along with ODL. If not, see . +"""Run all doctests in the online documentation. + +Running this file causes all relevant files in the online documentation to +be run by ``doctest``, and any exception will give a FAILED result. +All other results are considered PASSED. + +This test file assumes that all dependencies are installed. +""" + # Imports for common Python 2/3 codebase from __future__ import print_function, division, absolute_import from future import standard_library @@ -23,6 +32,7 @@ import doctest from doctest import IGNORE_EXCEPTION_DETAIL, ELLIPSIS, NORMALIZE_WHITESPACE import os +import pytest # Modules to be added to testing globals import numpy @@ -36,7 +46,9 @@ doctest_extraglobs = {'odl': odl, 'np': numpy, 'scipy': scipy, 'proximal': proximal} -root_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'source') +root_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), + '../../doc/source') +root_dir = os.path.normpath(root_dir) test_dirs = ['guide', 'getting_started'] test_suffixes = ['.rst', '.py'] exclude_files = ['faq.rst'] @@ -49,9 +61,21 @@ for filename in filenames: if (any(filename.endswith(suffix) for suffix in test_suffixes) and filename not in exclude_files): - doc_src_files.append(path + '/' + filename) + doc_src_files.append(os.path.join(path, filename)) + -for doc_src_file in doc_src_files: +@pytest.fixture(scope="module", ids=doc_src_files, params=doc_src_files) +def doc_src_file(request): + return request.param + + +@pytest.mark.skipif("not pytest.config.getoption('--documentation')", + reason='Need --documentation option to run') +def test_file(doc_src_file): doctest.testfile(doc_src_file, module_relative=False, report=True, - extraglobs=doctest_extraglobs, + extraglobs=doctest_extraglobs, verbose=True, optionflags=doctest_optionflags) + + +if __name__ == '__main__': + pytest.main([str(__file__.replace('\\', '/')), '-v', '--documentation']) diff --git a/odl/test/test_examples.py b/odl/test/test_examples.py index 005edc74917..8a9469675f0 100644 --- a/odl/test/test_examples.py +++ b/odl/test/test_examples.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with ODL. If not, see . -"""Tests that all examples run at all. +"""Test that all examples run. Running this file causes all examples to be run, and any exception will give a FAILED result. All other results are considered PASSED. diff --git a/setup.py b/setup.py index 3f0ffd240cd..b7d6c0d0f36 100644 --- a/setup.py +++ b/setup.py @@ -89,7 +89,7 @@ def run_tests(self): setup( name='odl', - version='0.4.0', + version='0.5.0', description='Operator Discretization Library', long_description=long_description, @@ -119,10 +119,7 @@ def run_tests(self): 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', - 'Operating System :: POSIX :: Linux', - 'Operating System :: Microsoft :: Windows', - 'Operating System :: MacOS :: MacOS X', - + 'Operating System :: OS Independent' ], keywords='research development mathematics prototyping imaging tomography', @@ -137,9 +134,8 @@ def run_tests(self): 'show': 'matplotlib', 'fftw': 'pyfftw', 'pywavelets': 'Pywavelets>=0.4', - 'scikit' : 'scikit-image', - 'proximal' : 'proximal', - 'all': test_requires + ['matplotlib', 'pyfftw', 'Pywavelets', 'scikit-image', 'proximal'] + 'scikit': 'scikit-image', + 'proximal': 'proximal', }, cmdclass={'test': PyTest},