dictk — pylint report

Informational only: pylint runs alongside ruff (which gates CI) purely to produce this report and the README's pylint score badge. See CONTRIBUTING.md.

************* Module dictk.grid
src/dictk/grid.py:220:0: C0301: Line too long (118/100) (line-too-long)
src/dictk/grid.py:48:0: R0913: Too many arguments (8/5) (too-many-arguments)
src/dictk/grid.py:80:0: R0913: Too many arguments (9/5) (too-many-arguments)
src/dictk/grid.py:110:0: R0913: Too many arguments (12/5) (too-many-arguments)
src/dictk/grid.py:110:0: R0914: Too many local variables (18/15) (too-many-locals)
src/dictk/grid.py:141:34: W0212: Access to a protected member _refine of a client class (protected-access)
src/dictk/grid.py:146:21: W0212: Access to a protected member _translation_warp of a client class (protected-access)
src/dictk/grid.py:269:0: R0913: Too many arguments (11/5) (too-many-arguments)
src/dictk/grid.py:385:0: R0913: Too many arguments (12/5) (too-many-arguments)
src/dictk/grid.py:495:0: R0913: Too many arguments (13/5) (too-many-arguments)
src/dictk/grid.py:495:0: R0914: Too many local variables (16/15) (too-many-locals)
src/dictk/grid.py:578:28: W0212: Access to a protected member _gradients of a client class (protected-access)
src/dictk/grid.py:579:29: W0212: Access to a protected member _spline_coefficients of a client class (protected-access)
src/dictk/grid.py:598:0: R0913: Too many arguments (12/5) (too-many-arguments)
src/dictk/grid.py:598:0: R0914: Too many local variables (40/15) (too-many-locals)
src/dictk/grid.py:742:26: W0212: Access to a protected member _gradients of a client class (protected-access)
src/dictk/grid.py:743:29: W0212: Access to a protected member _spline_coefficients of a client class (protected-access)
src/dictk/grid.py:744:27: W0212: Access to a protected member _spline_coefficients of a client class (protected-access)
src/dictk/grid.py:747:15: W0212: Access to a protected member _refine of a client class (protected-access)
src/dictk/grid.py:806:16: W0212: Access to a protected member _shape_seeds of a client class (protected-access)
src/dictk/grid.py:598:0: R0912: Too many branches (18/12) (too-many-branches)
src/dictk/grid.py:598:0: R0915: Too many statements (74/50) (too-many-statements)
************* Module dictk.cli
src/dictk/cli.py:20:0: R0913: Too many arguments (6/5) (too-many-arguments)
src/dictk/cli.py:20:0: R0917: Too many positional arguments (6/5) (too-many-positional-arguments)
************* Module dictk.warp
src/dictk/warp.py:38:0: R0913: Too many arguments (11/5) (too-many-arguments)
src/dictk/warp.py:38:0: R0914: Too many local variables (41/15) (too-many-locals)
src/dictk/warp.py:63:13: E1101: Instance of 'tuple' has no 'astype' member (no-member)
src/dictk/warp.py:95:49: E1101: Instance of 'finfo' has no 'eps' member (no-member)
src/dictk/warp.py:97:4: W0632: Possible unbalanced tuple unpacking with sequence defined at line 2 of : left side has 2 labels, right side has 1 value (unbalanced-tuple-unpacking)
src/dictk/warp.py:131:0: R0913: Too many arguments (9/5) (too-many-arguments)
src/dictk/warp.py:131:0: R0914: Too many local variables (30/15) (too-many-locals)
src/dictk/warp.py:158:13: E1101: Instance of 'tuple' has no 'astype' member (no-member)
src/dictk/warp.py:200:0: R0913: Too many arguments (11/5) (too-many-arguments)
src/dictk/warp.py:313:0: R0913: Too many arguments (11/5) (too-many-arguments)
************* Module dictk.rosta
src/dictk/rosta.py:99:0: R0913: Too many arguments (6/5) (too-many-arguments)
************* Module dictk.discontinuity
src/dictk/discontinuity.py:135:0: C0301: Line too long (102/100) (line-too-long)
src/dictk/discontinuity.py:226:0: C0301: Line too long (118/100) (line-too-long)
src/dictk/discontinuity.py:231:0: C0301: Line too long (127/100) (line-too-long)
src/dictk/discontinuity.py:120:0: R0913: Too many arguments (12/5) (too-many-arguments)
src/dictk/discontinuity.py:120:0: R0914: Too many local variables (20/15) (too-many-locals)
src/dictk/discontinuity.py:253:0: R0913: Too many arguments (12/5) (too-many-arguments)
src/dictk/discontinuity.py:253:0: R0914: Too many local variables (18/15) (too-many-locals)
src/dictk/discontinuity.py:325:7: R1714: Consider merging these comparisons with 'in' by using 'i in (0, len(ratios) - 1)'. Use a set instead if elements are hashable. (consider-using-in)
************* Module dictk.element
src/dictk/element.py:146:0: C0301: Line too long (112/100) (line-too-long)
src/dictk/element.py:187:0: C0301: Line too long (113/100) (line-too-long)
src/dictk/element.py:233:0: C0301: Line too long (105/100) (line-too-long)
src/dictk/element.py:248:0: C0301: Line too long (121/100) (line-too-long)
src/dictk/element.py:182:32: W0621: Redefining name 'jacobian' from outer scope (line 164) (redefined-outer-name)
src/dictk/element.py:232:28: W0621: Redefining name 'displacement_gradient' from outer scope (line 211) (redefined-outer-name)
src/dictk/element.py:247:29: W0621: Redefining name 'deformation_gradient' from outer scope (line 232) (redefined-outer-name)
src/dictk/element.py:262:18: W0621: Redefining name 'deformation_gradient' from outer scope (line 232) (redefined-outer-name)
************* Module dictk.translation
src/dictk/translation.py:4:0: E0611: No name 'phase_cross_correlation' in module 'skimage.registration' (no-name-in-module)
src/dictk/translation.py:10:0: R0913: Too many arguments (9/5) (too-many-arguments)
src/dictk/translation.py:10:0: R0914: Too many local variables (23/15) (too-many-locals)
src/dictk/translation.py:202:0: R0913: Too many arguments (10/5) (too-many-arguments)
src/dictk/translation.py:202:0: R0914: Too many local variables (24/15) (too-many-locals)
************* Module dictk.plot
src/dictk/plot.py:1085:0: C0301: Line too long (101/100) (line-too-long)
src/dictk/plot.py:1834:0: C0301: Line too long (117/100) (line-too-long)
src/dictk/plot.py:1:0: C0302: Too many lines in module (1947/1000) (too-many-lines)
src/dictk/plot.py:47:0: R0913: Too many arguments (6/5) (too-many-arguments)
src/dictk/plot.py:47:0: R0914: Too many local variables (16/15) (too-many-locals)
src/dictk/plot.py:143:0: R0913: Too many arguments (6/5) (too-many-arguments)
src/dictk/plot.py:216:0: R0913: Too many arguments (14/5) (too-many-arguments)
src/dictk/plot.py:216:0: R0914: Too many local variables (32/15) (too-many-locals)
src/dictk/plot.py:216:0: R0915: Too many statements (58/50) (too-many-statements)
src/dictk/plot.py:505:0: R0913: Too many arguments (8/5) (too-many-arguments)
src/dictk/plot.py:505:0: R0914: Too many local variables (28/15) (too-many-locals)
src/dictk/plot.py:664:0: R0914: Too many local variables (28/15) (too-many-locals)
src/dictk/plot.py:852:0: R0913: Too many arguments (11/5) (too-many-arguments)
src/dictk/plot.py:852:0: R0914: Too many local variables (39/15) (too-many-locals)
src/dictk/plot.py:912:4: W0632: Possible unbalanced tuple unpacking with sequence defined at line 2 of : left side has 2 labels, right side has 1 value (unbalanced-tuple-unpacking)
src/dictk/plot.py:852:0: R0915: Too many statements (72/50) (too-many-statements)
src/dictk/plot.py:1074:0: R0913: Too many arguments (8/5) (too-many-arguments)
src/dictk/plot.py:1159:0: R0913: Too many arguments (11/5) (too-many-arguments)
src/dictk/plot.py:1289:0: R0913: Too many arguments (8/5) (too-many-arguments)
src/dictk/plot.py:1289:0: R0914: Too many local variables (22/15) (too-many-locals)
src/dictk/plot.py:1436:0: R0913: Too many arguments (13/5) (too-many-arguments)
src/dictk/plot.py:1436:0: R0914: Too many local variables (39/15) (too-many-locals)
src/dictk/plot.py:1653:0: R0913: Too many arguments (12/5) (too-many-arguments)
src/dictk/plot.py:1653:0: R0914: Too many local variables (19/15) (too-many-locals)
src/dictk/plot.py:1768:0: R0913: Too many arguments (16/5) (too-many-arguments)
src/dictk/plot.py:1768:0: R0914: Too many local variables (29/15) (too-many-locals)
************* Module dictk.correlation
src/dictk/correlation.py:46:0: C0301: Line too long (140/100) (line-too-long)
src/dictk/correlation.py:493:10: E1101: Instance of 'finfo' has no 'eps' member (no-member)
src/dictk/correlation.py:1:0: R0801: Similar lines in 2 files
==dictk.discontinuity:[103:179]
==dictk.grid:[702:716]
    if kernel_margin_width < 1:
        raise ValueError(f"kernel_margin_width {kernel_margin_width} must be >= 1")
    if kernel_margin_height < 1:
        raise ValueError(f"kernel_margin_height {kernel_margin_height} must be >= 1")
    if search_margin_width <= kernel_margin_width:
        raise ValueError(
            f"search_margin_width {search_margin_width} must be greater than "
            f"kernel_margin_width {kernel_margin_width}"
        )
    if search_margin_height <= kernel_margin_height:
        raise ValueError(
            f"search_margin_height {search_margin_height} must be greater than "
            f"kernel_margin_height {kernel_margin_height}"
        )


def sweep(
    *,
    reference_image: np.ndarray,
    current_image: np.ndarray,
    start: PixelCoordinate,
    end: PixelCoordinate,
    samples: int,
    kernel_margin_width: int,
    kernel_margin_height: int,
    search_margin_width: int,
    search_margin_height: int,
    windowing: WindowingMethod | None = None,
    height_threshold: float = 0.2,
    distance: int = 2,
) -> DiscontinuitySweep:
    """Evaluate `peak_ratio` at `samples` window-center positions evenly spaced from `start` to `end`.

    At each position, extracts a kernel from `reference_image` and a
    search area from `current_image`, both centered on that position
    (the same "center a window here" step [Synthetic
    Dislocation](../getting_started/synthetic_dislocation.html#moving-the-window-off-the-crack)
    does by hand at one fixed row), computes their ZNCC surface, and
    reads its `peak_ratio`. A discontinuity crossing the `start`-`end`
    line shows up as a rise in `peak_ratios` near the crossing, high on
    an ambiguous, straddling window and low everywhere else -- see
    [`locate`](#locate) to turn that rise into a single position.

    Args:
        reference_image: The reference (undeformed) 2D grayscale image.
        current_image: The current (deformed) 2D grayscale image.
        start: The first window-center position, in both images' shared
            pixel reference frame.
        end: The last window-center position.
        samples: Number of window-center positions, evenly spaced from
            `start` to `end` inclusive. Must be >= 2.
        kernel_margin_width: Half each kernel's width, in pixels. Must be
            >= 1.
        kernel_margin_height: Half each kernel's height, in pixels. Must
            be >= 1.
        search_margin_width: Half each search area's width, in pixels.
            Must be greater than `kernel_margin_width`.
        search_margin_height: Half each search area's height, in pixels.
            Must be greater than `kernel_margin_height`.
        windowing: Passed straight through to
            [`dictk.correlation.window`](./correlation.html#window) for
            both the kernel and search area at every position. Default
            `None` applies no windowing.
        height_threshold: Passed straight through to each position's own
            [`peak_ratio`](#peak_ratio) call.
        distance: Passed straight through to each position's own
            `peak_ratio` call.

    Returns:
        A `DiscontinuitySweep` pairing each swept position with its own
        `peak_ratio`, in sweep order.

    Raises:
        ValueError: If `samples` is less than 2, or the margin arguments
            are invalid (see `kernel_margin_width`/etc. above).
    """ (duplicate-code)
src/dictk/correlation.py:1:0: R0801: Similar lines in 2 files
==dictk.grid:[129:140]
==dictk.warp:[287:298]
    start = translation.locate(
        reference_image=reference_image,
        current_image=current_image,
        reference_point=reference_point,
        search_center=search_center,
        kernel_margin_width=kernel_margin_width,
        kernel_margin_height=kernel_margin_height,
        search_margin_width=search_margin_width,
        search_margin_height=search_margin_height,
        windowing=windowing,
    ) (duplicate-code)
src/dictk/correlation.py:1:0: R0801: Similar lines in 2 files
==dictk.grid:[67:94]
==dictk.warp:[288:298]
        reference_image=reference_image,
        current_image=current_image,
        reference_point=reference_point,
        search_center=search_center,
        kernel_margin_width=kernel_margin_width,
        kernel_margin_height=kernel_margin_height,
        search_margin_width=search_margin_width,
        search_margin_height=search_margin_height,
        windowing=windowing,
    )


def _locate_subpixel_worker(
    args: tuple[PixelCoordinate, PixelCoordinate],
    *,
    reference_image: np.ndarray,
    current_image: np.ndarray,
    kernel_margin_width: int,
    kernel_margin_height: int,
    search_margin_width: int,
    search_margin_height: int,
    windowing: WindowingMethod | None,
    upsample_factor: int,
) -> SubpixelCoordinate:
    """One point's worth of `translation.locate_subpixel` -- see
    `_locate_worker`'s own docstring for why this is a module-level
    function taking a single positional argument, not a closure.""" (duplicate-code)
src/dictk/correlation.py:1:0: R0801: Similar lines in 2 files
==dictk.grid:[67:76]
==dictk.warp:[342:351]
        reference_image=reference_image,
        current_image=current_image,
        reference_point=reference_point,
        search_center=search_center,
        kernel_margin_width=kernel_margin_width,
        kernel_margin_height=kernel_margin_height,
        search_margin_width=search_margin_width,
        search_margin_height=search_margin_height,
        windowing=windowing, (duplicate-code)
src/dictk/correlation.py:1:0: R0801: Similar lines in 2 files
==dictk.grid:[96:105]
==dictk.warp:[288:297]
        reference_image=reference_image,
        current_image=current_image,
        reference_point=reference_point,
        search_center=search_center,
        kernel_margin_width=kernel_margin_width,
        kernel_margin_height=kernel_margin_height,
        search_margin_width=search_margin_width,
        search_margin_height=search_margin_height,
        windowing=windowing, (duplicate-code)
src/dictk/correlation.py:1:0: R0801: Similar lines in 2 files
==dictk.grid:[579:587]
==dictk.warp:[346:354]
        kernel_margin_width=kernel_margin_width,
        kernel_margin_height=kernel_margin_height,
        search_margin_width=search_margin_width,
        search_margin_height=search_margin_height,
        windowing=windowing,
        max_iterations=max_iterations,
        tolerance=tolerance,
    ) (duplicate-code)
src/dictk/correlation.py:1:0: R0801: Similar lines in 2 files
==dictk.grid:[371:377]
==dictk.warp:[292:298]
        kernel_margin_width=kernel_margin_width,
        kernel_margin_height=kernel_margin_height,
        search_margin_width=search_margin_width,
        search_margin_height=search_margin_height,
        windowing=windowing,
    ) (duplicate-code)
src/dictk/correlation.py:1:0: R0801: Similar lines in 2 files
==dictk.grid:[371:376]
==dictk.warp:[346:351]
        kernel_margin_width=kernel_margin_width,
        kernel_margin_height=kernel_margin_height,
        search_margin_width=search_margin_width,
        search_margin_height=search_margin_height,
        windowing=windowing, (duplicate-code)
src/dictk/correlation.py:1:0: R0801: Similar lines in 2 files
==dictk.grid:[480:485]
==dictk.warp:[292:297]
        kernel_margin_width=kernel_margin_width,
        kernel_margin_height=kernel_margin_height,
        search_margin_width=search_margin_width,
        search_margin_height=search_margin_height,
        windowing=windowing, (duplicate-code)
src/dictk/correlation.py:1:0: R0801: Similar lines in 2 files
==dictk.discontinuity:[314:319]
==dictk.grid:[71:76]
        kernel_margin_width=kernel_margin_width,
        kernel_margin_height=kernel_margin_height,
        search_margin_width=search_margin_width,
        search_margin_height=search_margin_height,
        windowing=windowing, (duplicate-code)
src/dictk/correlation.py:1:0: R0801: Similar lines in 2 files
==dictk.image:[72:78]
==dictk.plot:[79:86]
    if width < 1:
        raise ValueError(f"width {width} must be >= 1")
    if height < 1:
        raise ValueError(f"height {height} must be >= 1")

    image_height, image_width = image.shape
 (duplicate-code)


Report
======
1268 statements analysed.

Statistics by type
------------------

+---------+-------+-----------+-----------+------------+---------+
|type     |number |old number |difference |%documented |%badname |
+=========+=======+===========+===========+============+=========+
|module   |12     |NC         |NC         |100.00      |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|class    |10     |NC         |NC         |100.00      |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|method   |1      |NC         |NC         |100.00      |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|function |101    |NC         |NC         |100.00      |0.00     |
+---------+-------+-----------+-----------+------------+---------+



External dependencies
---------------------
::

    imageio 
      \-v3 (dictk.image)
    matplotlib 
      \-colors (dictk.plot)
      \-patches (dictk.plot)
      \-path (dictk.plot)
      \-patheffects (dictk.plot)
      \-pyplot (dictk.plot)
    numpy (dictk.cli,dictk.correlation,dictk.discontinuity,dictk.element,dictk.grid,dictk.image,dictk.plot,dictk.rosta,dictk.strain_window,dictk.translation,dictk.warp)
    scipy 
      \-interpolate (dictk.image)
      \-ndimage (dictk.image,dictk.rosta,dictk.warp)
      \-signal (dictk.discontinuity)
      \-spatial (dictk.grid)
    skimage 
      \-registration (dictk.translation)



6057 lines have been analyzed

Raw metrics
-----------

+----------+-------+------+---------+-----------+
|type      |number |%     |previous |difference |
+==========+=======+======+=========+===========+
|code      |2653   |43.80 |NC       |NC         |
+----------+-------+------+---------+-----------+
|docstring |2759   |45.55 |NC       |NC         |
+----------+-------+------+---------+-----------+
|comment   |200    |3.30  |NC       |NC         |
+----------+-------+------+---------+-----------+
|empty     |445    |7.35  |NC       |NC         |
+----------+-------+------+---------+-----------+



Duplication
-----------

+-------------------------+------+---------+-----------+
|                         |now   |previous |difference |
+=========================+======+=========+===========+
|nb duplicated lines      |0     |NC       |NC         |
+-------------------------+------+---------+-----------+
|percent duplicated lines |0.000 |NC       |NC         |
+-------------------------+------+---------+-----------+



Messages by category
--------------------

+-----------+-------+---------+-----------+
|type       |number |previous |difference |
+===========+=======+=========+===========+
|convention |12     |NC       |NC         |
+-----------+-------+---------+-----------+
|refactor   |63     |NC       |NC         |
+-----------+-------+---------+-----------+
|warning    |15     |NC       |NC         |
+-----------+-------+---------+-----------+
|error      |5      |NC       |NC         |
+-----------+-------+---------+-----------+



% errors / warnings by module
-----------------------------

+--------------------+------+--------+---------+-----------+
|module              |error |warning |refactor |convention |
+====================+======+========+=========+===========+
|dictk.warp          |60.00 |6.67    |9.52     |0.00       |
+--------------------+------+--------+---------+-----------+
|dictk.correlation   |20.00 |0.00    |17.46    |8.33       |
+--------------------+------+--------+---------+-----------+
|dictk.translation   |20.00 |0.00    |6.35     |0.00       |
+--------------------+------+--------+---------+-----------+
|dictk.grid          |0.00  |60.00   |19.05    |8.33       |
+--------------------+------+--------+---------+-----------+
|dictk.element       |0.00  |26.67   |0.00     |33.33      |
+--------------------+------+--------+---------+-----------+
|dictk.plot          |0.00  |6.67    |34.92    |25.00      |
+--------------------+------+--------+---------+-----------+
|dictk.discontinuity |0.00  |0.00    |7.94     |25.00      |
+--------------------+------+--------+---------+-----------+
|dictk.cli           |0.00  |0.00    |3.17     |0.00       |
+--------------------+------+--------+---------+-----------+
|dictk.rosta         |0.00  |0.00    |1.59     |0.00       |
+--------------------+------+--------+---------+-----------+



Messages
--------

+------------------------------+------------+
|message id                    |occurrences |
+==============================+============+
|too-many-arguments            |28          |
+------------------------------+------------+
|too-many-locals               |18          |
+------------------------------+------------+
|line-too-long                 |11          |
+------------------------------+------------+
|duplicate-code                |11          |
+------------------------------+------------+
|protected-access              |9           |
+------------------------------+------------+
|redefined-outer-name          |4           |
+------------------------------+------------+
|no-member                     |4           |
+------------------------------+------------+
|too-many-statements           |3           |
+------------------------------+------------+
|unbalanced-tuple-unpacking    |2           |
+------------------------------+------------+
|too-many-positional-arguments |1           |
+------------------------------+------------+
|too-many-lines                |1           |
+------------------------------+------------+
|too-many-branches             |1           |
+------------------------------+------------+
|no-name-in-module             |1           |
+------------------------------+------------+
|consider-using-in             |1           |
+------------------------------+------------+




-----------------------------------
Your code has been rated at 9.09/10