tomography/xdesign

View on GitHub
src/xdesign/metrics/fullref.py

Summary

Maintainability
A
3 hrs
Test Coverage

Function quality has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def quality(self, method="MSSSIM", L=1.0, **kwargs):
        """Compute the full-reference image quality of each image pair.

        Available methods include SSIM :cite:`wang:02`, MSSSIM :cite:`wang:03`,
        VIFp :cite:`Sheikh:15`
Severity: Minor
Found in src/xdesign/metrics/fullref.py - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function ssim has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def ssim(
    img1,
    img2,
    sigma=1.2,
    L=1,
Severity: Minor
Found in src/xdesign/metrics/fullref.py - About 1 hr to fix

    Function ssim has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def ssim(
        img1,
        img2,
        sigma=1.2,
        L=1,
    Severity: Minor
    Found in src/xdesign/metrics/fullref.py - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function msssim has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def msssim(
        img0,
        img1,
        nlevels=5,
        sigma=1.2,
    Severity: Minor
    Found in src/xdesign/metrics/fullref.py - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _full_reference_input_check has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def _full_reference_input_check(img0, img1, sigma, nlevels, L):
        """Checks full reference quality measures for valid inputs."""
        if nlevels <= 0:
            raise ValueError('nlevels must be >= 1.')
        if sigma < 1.2:
    Severity: Minor
    Found in src/xdesign/metrics/fullref.py - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Invalid escape sequence ')'
    Open

        'From scipy 0\.13\.0, the output shape of zoom\(\) '
    Severity: Minor
    Found in src/xdesign/metrics/fullref.py by pep8

    Invalid escape sequences are deprecated in Python 3.6.

    Okay: regex = r'\.png$'
    W605: regex = '\.png$'

    Invalid escape sequence '('
    Open

        'is calculated with round\(\) instead of int\(\)'
    Severity: Minor
    Found in src/xdesign/metrics/fullref.py by pep8

    Invalid escape sequences are deprecated in Python 3.6.

    Okay: regex = r'\.png$'
    W605: regex = '\.png$'

    Line too long (80 > 79 characters)
    Open

    #     similarity index for image qualtiy assessment", IEEE Transactions on Image
    Severity: Minor
    Found in src/xdesign/metrics/fullref.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    Invalid escape sequence '.'
    Open

        'From scipy 0\.13\.0, the output shape of zoom\(\) '
    Severity: Minor
    Found in src/xdesign/metrics/fullref.py by pep8

    Invalid escape sequences are deprecated in Python 3.6.

    Okay: regex = r'\.png$'
    W605: regex = '\.png$'

    Invalid escape sequence '('
    Open

        'From scipy 0\.13\.0, the output shape of zoom\(\) '
    Severity: Minor
    Found in src/xdesign/metrics/fullref.py by pep8

    Invalid escape sequences are deprecated in Python 3.6.

    Okay: regex = r'\.png$'
    W605: regex = '\.png$'

    Invalid escape sequence ')'
    Open

        'is calculated with round\(\) instead of int\(\)'
    Severity: Minor
    Found in src/xdesign/metrics/fullref.py by pep8

    Invalid escape sequences are deprecated in Python 3.6.

    Okay: regex = r'\.png$'
    W605: regex = '\.png$'

    Invalid escape sequence '.'
    Open

        'From scipy 0\.13\.0, the output shape of zoom\(\) '
    Severity: Minor
    Found in src/xdesign/metrics/fullref.py by pep8

    Invalid escape sequences are deprecated in Python 3.6.

    Okay: regex = r'\.png$'
    W605: regex = '\.png$'

    Invalid escape sequence '('
    Open

        'is calculated with round\(\) instead of int\(\)'
    Severity: Minor
    Found in src/xdesign/metrics/fullref.py by pep8

    Invalid escape sequences are deprecated in Python 3.6.

    Okay: regex = r'\.png$'
    W605: regex = '\.png$'

    Invalid escape sequence ')'
    Open

        'is calculated with round\(\) instead of int\(\)'
    Severity: Minor
    Found in src/xdesign/metrics/fullref.py by pep8

    Invalid escape sequences are deprecated in Python 3.6.

    Okay: regex = r'\.png$'
    W605: regex = '\.png$'

    Line too long (80 > 79 characters)
    Open

    #         # sigma = 1.2 is approximately correct because the width of the scharr
    Severity: Minor
    Found in src/xdesign/metrics/fullref.py by pep8

    Limit all lines to a maximum of 79 characters.

    There are still many devices around that are limited to 80 character
    lines; plus, limiting windows to 80 characters makes it possible to
    have several windows side-by-side.  The default wrapping on such
    devices looks ugly.  Therefore, please limit all lines to a maximum
    of 79 characters. For flowing long blocks of text (docstrings or
    comments), limiting the length to 72 characters is recommended.
    
    Reports error E501.

    There are no issues that match your filters.

    Category
    Status