Skip to content

Investigate 5 vs ndim in test_structural_similarity_nD #8129

Open

Description

@stefanv

In tests/skimage/metrics/test_structural_similarity.py, test_structural_similarity_nD constructs test arrays using * 5 instead of * ndim:

for ndim in range(1, 5):
    xsize = [N] * 5  # should this be `* ndim`?
    X = (rng.rand(*xsize) * 255).astype(dtype)
    Y = (rng.rand(*xsize) * 255).astype(dtype)

ndim is effectively unused — arrays are always 5-dimensional regardless of the loop variable.

Changing * 5 → * ndim causes failures:

FAILED test_structural_similarity_nD[uint8] - assert np.float64(0.12033917126639686) < 0.05
FAILED test_structural_similarity_nD[float32] - assert np.float64(0.12066029480774887) < 0.05
FAILED test_structural_similarity_nD[float64] - assert np.float64(0.12066033348447812) < 0.05

Questions:

  • Was * 5 intentional? If so, what does the ndim loop actually exercise?
  • If it should be * ndim, the < 0.05 threshold likely needs revisiting for lower-dimensional inputs.

Noted in PR #8084.

Activity

  1. github-actions commented on Oct 22, 2026

    @github-actions

    Hello scikit-image core devs! There hasn't been any activity on this issue for more than 180 days. I have marked it as "dormant" to make it easy to find.

    To our contributors, thank you for your contribution and apologies if this issue fell through the cracks! Hopefully this ping will help bring some fresh attention to the issue. If you need help, you can always reach out on our forum

    If you think that this issue is no longer relevant, you may close it, or we may do it at some point (either way, it will be done manually).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    😴 Dormant

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions