Skip to content

Commit

Permalink
Merge pull request #3 from mcara/pep8-tify
Browse files Browse the repository at this point in the history
Fix math formatting in docstrings after PEP8 changes
  • Loading branch information
mcara authored Aug 7, 2019
2 parents 1aeff03 + 879912a commit ff3a73a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
21 changes: 11 additions & 10 deletions wiimatch/lsq_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@ def build_lsq_eqs(images, masks, sigmas, degree, center=None,
:py:func:`build_lsq_eqs` builds a system of linear equations
.. math::
a \\cdot c = b
a \cdot c = b
whose solution :math:`c` is a set of coefficients of (multivariate)
polynomials that represent the "background" in each input image (these are
polynomials that are "corrections" to intensities of input images) such
that the following sum is minimized:
.. math::
L = \sum^N_{n,m=1,n \\neq m} \sum_k\
\\frac{\\left[I_n(k) - I_m(k) - P_n(k) + P_m(k)\\right]^2}\
L = \sum^N_{n,m=1,n \neq m} \sum_k
\frac{\left[I_n(k) - I_m(k) - P_n(k) + P_m(k)\right]^2}
{\sigma^2_n(k) + \sigma^2_m(k)}.
In the above equation, index :math:`k=(k_1,k_2,...)` labels a position
Expand All @@ -112,15 +112,16 @@ def build_lsq_eqs(images, masks, sigmas, degree, center=None,
corresponding coefficients as:
.. math::
P_n(k_1,k_2,...) = \sum_{d_1=0,d_2=0,...}^{D_1,D_2,...} \
c_{d_1,d_2,...}^n \\cdot k_1^{d_1} \\cdot k_2^{d_2} \\cdot \\ldots .
P_n(k_1,k_2,...) = \sum_{d_1=0,d_2=0,...}^{D_1,D_2,...}
c_{d_1,d_2,...}^n \cdot k_1^{d_1} \cdot k_2^{d_2} \cdot \ldots .
Coefficients :math:`c_{d_1,d_2,...}^n` are arranged in the vector :math:`c`
in the following order:
.. math::
(c_{0,0,\\ldots}^1,c_{1,0,\\ldots}^1,\\ldots,c_{0,0,\\ldots}^2,\
c_{1,0,\\ldots}^2,\\ldots).
(c_{0,0,\ldots}^1,c_{1,0,\ldots}^1,\ldots,c_{0,0,\ldots}^2,
c_{1,0,\ldots}^2,\ldots).
Examples
--------
Expand Down Expand Up @@ -276,7 +277,7 @@ def pinv_solve(matrix, free_term, nimages, tol=None):
Solves a system of linear equations
.. math::
a \\cdot c = b.
a \ cdot c = b.
using Moore-Penrose pseudoinverse.
Expand Down Expand Up @@ -333,11 +334,11 @@ def pinv_solve(matrix, free_term, nimages, tol=None):


def rlu_solve(matrix, free_term, nimages):
"""
r"""
Computes solution of a "reduced" system of linear equations
.. math::
a' \\cdot c' = b'.
a' \cdot c' = b'.
using LU-decomposition. If the original system contained a set of
linearly-dependent equations, then the "reduced" system is formed by
Expand Down
16 changes: 8 additions & 8 deletions wiimatch/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,17 @@ def match_lsq(images, masks=None, sigmas=None, degree=0,
:py:func:`match_lsq` builds a system of linear equations
.. math::
a \\cdot c = b
a \cdot c = b
whose solution :math:`c` is a set of coefficients of (multivariate)
polynomials that represent the "background" in each input image (these are
polynomials that are "corrections" to intensities of input images) such
that the following sum is minimized:
.. math::
L = \sum^N_{n,m=1,n \\neq m} \sum_k\
\\frac{\\left[I_n(k) - I_m(k) - P_n(k) + P_m(k)\\right]^2}\
{\sigma^2_n(k) + \sigma^2_m(k)}.
L = \sum^N_{n,m=1,n \neq m} \sum_k
\frac{\left[I_n(k) - I_m(k) - P_n(k) + P_m(k)\right]^2}
{\sigma^2_n(k) + \sigma^2_m(k)}.
In the above equation, index :math:`k=(k_1,k_2,...)` labels a position
in input image's pixel grid [NOTE: all input images share a common
Expand All @@ -139,15 +139,15 @@ def match_lsq(images, masks=None, sigmas=None, degree=0,
corresponding coefficients as:
.. math::
P_n(k_1,k_2,...) = \sum_{d_1=0,d_2=0,...}^{D_1,D_2,...} \
c_{d_1,d_2,...}^n \\cdot k_1^{d_1} \\cdot k_2^{d_2} \\cdot \\ldots .
P_n(k_1,k_2,...) = \sum_{d_1=0,d_2=0,...}^{D_1,D_2,...}
c_{d_1,d_2,...}^n \cdot k_1^{d_1} \cdot k_2^{d_2} \cdot \ldots .
Coefficients :math:`c_{d_1,d_2,...}^n` are arranged in the vector :math:`c`
in the following order:
.. math::
(c_{0,0,\\ldots}^1,c_{1,0,\\ldots}^1,\\ldots,c_{0,0,\\ldots}^2,\
c_{1,0,\\ldots}^2,\\ldots).
(c_{0,0,\ldots}^1,c_{1,0,\ldots}^1,\ldots,c_{0,0,\ldots}^2,
c_{1,0,\ldots}^2,\ldots).
:py:func:`match_lsq` returns coefficients of the polynomials that
minimize *L*.
Expand Down

0 comments on commit ff3a73a

Please sign in to comment.