wafo-project/pywafo

View on GitHub
src/wafo/tests/test_gaussian.py

Summary

Maintainability
F
1 wk
Test Coverage

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert(np.abs(E3 - val3) < err3)
Severity: Info
Found in src/wafo/tests/test_gaussian.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert(np.abs(val - Et) < err)

Severity: Info
Found in src/wafo/tests/test_gaussian.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert(np.abs(E2 - val2) < err2)

Severity: Info
Found in src/wafo/tests/test_gaussian.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert(t == t_true)

    # Compute expectation E( abs(X1*X2*...*X5) )
Severity: Info
Found in src/wafo/tests/test_gaussian.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert(np.abs(E0 - Et) < 2*(err0 + terr0))

Severity: Info
Found in src/wafo/tests/test_gaussian.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert(err < 0.0013)
Severity: Info
Found in src/wafo/tests/test_gaussian.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert(np.abs(E3 - val3) < err3)
Severity: Info
Found in src/wafo/tests/test_gaussian.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert(t == 'val = 0.00195')
Severity: Info
Found in src/wafo/tests/test_gaussian.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert(np.abs(E1 - Et) < 2*(err1 + terr1))

Severity: Info
Found in src/wafo/tests/test_gaussian.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert(t == t_true)

Severity: Info
Found in src/wafo/tests/test_gaussian.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert(np.abs(E2 - val2) < err2)

Severity: Info
Found in src/wafo/tests/test_gaussian.py by bandit

Function test_rind has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def test_rind():

    Et = 0.001946  # exact prob.
    n = 5
    Blo = -np.inf
Severity: Minor
Found in src/wafo/tests/test_gaussian.py - About 1 hr to fix

    Cyclomatic complexity is too high in function test_rind. (6)
    Open

    def test_rind():
    
        Et = 0.001946  # exact prob.
        n = 5
        Blo = -np.inf
    Severity: Minor
    Found in src/wafo/tests/test_gaussian.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Remove this commented out code.
    Open

        # import sys;sys.argv = ['', 'Test.testName']

    Programmers should not comment out code as it bloats programs and reduces readability.

    Unused code should be deleted and can be retrieved from source control history if required.

    See

    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    def test_prbnormndpc():
    
        rho2 = np.random.rand(2)
        a2 = np.zeros(2)
        b2 = np.repeat(np.inf, 2)
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 1 other location - About 3 days to fix
    src/wafo/tests/test_gaussian.py on lines 86..107

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 320.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    def test_prbnormtndpc():
    
        rho2 = np.random.rand(2)
        a2 = np.zeros(2)
        b2 = np.repeat(np.inf, 2)
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 1 other location - About 3 days to fix
    src/wafo/tests/test_gaussian.py on lines 110..131

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 320.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        Sc = (np.ones((n, n)) - np.eye(n)) * rho + np.eye(n)
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 1 other location - About 3 hrs to fix
    src/wafo/tests/test_gaussian.py on lines 23..23

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 44.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        Sc = (np.ones((n, n)) - np.eye(n)) * rho + np.eye(n)
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 1 other location - About 3 hrs to fix
    src/wafo/tests/test_gaussian.py on lines 142..142

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 44.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        assert(np.abs(E1 - Et) < 2*(err1 + terr1))
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 1 other location - About 2 hrs to fix
    src/wafo/tests/test_gaussian.py on lines 28..28

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 33.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        assert(np.abs(E0 - Et) < 2*(err0 + terr0))
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 1 other location - About 2 hrs to fix
    src/wafo/tests/test_gaussian.py on lines 37..37

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 33.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        E4, err4, terr4 = rind2(Sc2, m2, Blo2, Bup2, indI2, nt=0)
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 1 other location - About 1 hr to fix
    src/wafo/tests/test_gaussian.py on lines 70..70

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 21.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        E3, err3, terr3 = rind(Sc2, m2, Blo2, Bup2, indI2, nt=0)
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 1 other location - About 1 hr to fix
    src/wafo/tests/test_gaussian.py on lines 75..75

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 21.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 15 locations. Consider refactoring.
    Open

        dev = np.sqrt(np.diag(Sc))  # std
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 14 other locations - About 1 hr to fix
    src/wafo/interpolate.py on lines 90..90
    src/wafo/interpolate.py on lines 91..91
    src/wafo/kdetools/kdetools.py on lines 1097..1100
    src/wafo/kdetools/kdetools.py on lines 1155..1155
    src/wafo/kdetools/kdetools.py on lines 1192..1192
    src/wafo/markov.py on lines 32..32
    src/wafo/markov.py on lines 609..609
    src/wafo/markov.py on lines 684..684
    src/wafo/misc.py on lines 1672..1672
    src/wafo/stats/_continuous_distns.py on lines 5428..5428
    src/wafo/stats/_continuous_distns.py on lines 5444..5444
    src/wafo/stats/core.py on lines 891..891
    src/wafo/stats/estimation.py on lines 386..386
    src/wafo/stats/estimation.py on lines 1157..1157

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 17.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 13 locations. Consider refactoring.
    Open

    if __name__ == '__main__':
        # import sys;sys.argv = ['', 'Test.testName']
        unittest.main()
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 12 other locations - About 1 hr to fix
    src/wafo/kdetools/tests/test_gridding.py on lines 114..116
    src/wafo/kdetools/tests/test_kdetools.py on lines 413..415
    src/wafo/kdetools/tests/test_kernels.py on lines 146..148
    src/wafo/sg_filter/tests/test_sg_filter.py on lines 78..80
    src/wafo/spectrum/tests/test_models.py on lines 131..132
    src/wafo/tests/test_bitwise.py on lines 36..38
    src/wafo/tests/test_containers.py on lines 56..58
    src/wafo/tests/test_dct_pack.py on lines 65..67
    src/wafo/tests/test_integrate.py on lines 122..124
    src/wafo/tests/test_integrate_oscillating.py on lines 391..393
    src/wafo/tests/test_objects.py on lines 187..189
    src/wafo/tests/test_padua.py on lines 100..101

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 17.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        E0, err0, terr0 = rind(Sc, m, Blo, Bup, indI)
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 3 other locations - About 1 hr to fix
    src/wafo/misc.py on lines 2783..2783
    src/wafo/wavemodels.py on lines 88..88
    src/wafo/wavemodels.py on lines 194..194

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 17.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 31 locations. Consider refactoring.
    Open

        Bup, Blo = np.atleast_2d(Bup, Blo)
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 30 other locations - About 55 mins to fix
    src/wafo/containers.py on lines 203..203
    src/wafo/demos.py on lines 13..13
    src/wafo/demos.py on lines 23..23
    src/wafo/graphutil.py on lines 214..215
    src/wafo/integrate.py on lines 83..83
    src/wafo/interpolate.py on lines 1161..1161
    src/wafo/kdetools/gridding.py on lines 339..339
    src/wafo/kdetools/kernels.py on lines 116..116
    src/wafo/markov.py on lines 489..493
    src/wafo/misc.py on lines 494..494
    src/wafo/misc.py on lines 1334..1334
    src/wafo/misc.py on lines 2429..2429
    src/wafo/padua.py on lines 326..326
    src/wafo/padua.py on lines 475..475
    src/wafo/padua.py on lines 513..513
    src/wafo/sg_filter/demos.py on lines 418..418
    src/wafo/spectrum/models.py on lines 2099..2099
    src/wafo/spectrum/models.py on lines 2108..2108
    src/wafo/stats/_continuous_distns.py on lines 3779..3779
    src/wafo/stats/core.py on lines 495..495
    src/wafo/stats/core.py on lines 534..534
    src/wafo/stats/core.py on lines 937..937
    src/wafo/stats/estimation.py on lines 474..474
    src/wafo/stats/estimation.py on lines 482..482
    src/wafo/tests/test_gaussian.py on lines 154..154
    src/wafo/tests/test_misc.py on lines 546..546
    src/wafo/tests/test_misc.py on lines 556..556
    src/wafo/tests/test_misc.py on lines 569..569
    src/wafo/transform/models.py on lines 231..231
    src/wafo/transform/models.py on lines 240..240

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 15.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 31 locations. Consider refactoring.
    Open

        [b1, b2] = np.meshgrid(x, x)
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 30 other locations - About 55 mins to fix
    src/wafo/containers.py on lines 203..203
    src/wafo/demos.py on lines 13..13
    src/wafo/demos.py on lines 23..23
    src/wafo/graphutil.py on lines 214..215
    src/wafo/integrate.py on lines 83..83
    src/wafo/interpolate.py on lines 1161..1161
    src/wafo/kdetools/gridding.py on lines 339..339
    src/wafo/kdetools/kernels.py on lines 116..116
    src/wafo/markov.py on lines 489..493
    src/wafo/misc.py on lines 494..494
    src/wafo/misc.py on lines 1334..1334
    src/wafo/misc.py on lines 2429..2429
    src/wafo/padua.py on lines 326..326
    src/wafo/padua.py on lines 475..475
    src/wafo/padua.py on lines 513..513
    src/wafo/sg_filter/demos.py on lines 418..418
    src/wafo/spectrum/models.py on lines 2099..2099
    src/wafo/spectrum/models.py on lines 2108..2108
    src/wafo/stats/_continuous_distns.py on lines 3779..3779
    src/wafo/stats/core.py on lines 495..495
    src/wafo/stats/core.py on lines 534..534
    src/wafo/stats/core.py on lines 937..937
    src/wafo/stats/estimation.py on lines 474..474
    src/wafo/stats/estimation.py on lines 482..482
    src/wafo/tests/test_gaussian.py on lines 47..47
    src/wafo/tests/test_misc.py on lines 546..546
    src/wafo/tests/test_misc.py on lines 556..556
    src/wafo/tests/test_misc.py on lines 569..569
    src/wafo/transform/models.py on lines 231..231
    src/wafo/transform/models.py on lines 240..240

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 15.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        val, err, terr = rind(Sc, m, Blo, Bup, indI, xc, nt=0)
    Severity: Minor
    Found in src/wafo/tests/test_gaussian.py and 1 other location - About 50 mins to fix
    src/wafo/gaussian.py on lines 396..396

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 14.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 37 locations. Consider refactoring.
    Open

        x = np.linspace(-3, 3, 3)
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 36 other locations - About 45 mins to fix
    src/wafo/doc/tutorial_scripts/chapter3.py on lines 37..37
    src/wafo/doc/tutorial_scripts/chapter5.py on lines 97..97
    src/wafo/doc/tutorial_scripts/chapter5.py on lines 184..184
    src/wafo/interpolate.py on lines 1149..1149
    src/wafo/interpolate.py on lines 1150..1150
    src/wafo/interpolate.py on lines 1151..1151
    src/wafo/interpolate.py on lines 1155..1155
    src/wafo/interpolate.py on lines 1156..1156
    src/wafo/interpolate.py on lines 1157..1157
    src/wafo/interpolate.py on lines 1304..1304
    src/wafo/kdetools/demo.py on lines 31..31
    src/wafo/kdetools/demo.py on lines 68..68
    src/wafo/kdetools/kernels.py on lines 923..923
    src/wafo/objects.py on lines 415..415
    src/wafo/sg_filter/demos.py on lines 20..20
    src/wafo/sg_filter/demos.py on lines 381..381
    src/wafo/sg_filter/demos.py on lines 417..417
    src/wafo/sg_filter/tests/test_sg_filter.py on lines 37..37
    src/wafo/spectrum/core.py on lines 4401..4401
    src/wafo/spectrum/models.py on lines 2087..2087
    src/wafo/spectrum/models.py on lines 2092..2092
    src/wafo/spectrum/models.py on lines 2140..2140
    src/wafo/spectrum/models.py on lines 2150..2150
    src/wafo/spectrum/tests/test_specdata1d.py on lines 184..184
    src/wafo/stats/core.py on lines 1427..1427
    src/wafo/stats/core.py on lines 1446..1446
    src/wafo/tests/test_misc.py on lines 112..112
    src/wafo/tests/test_misc.py on lines 389..389
    src/wafo/tests/test_misc.py on lines 452..452
    src/wafo/tests/test_misc.py on lines 510..510
    src/wafo/tests/test_misc.py on lines 520..520
    src/wafo/tests/test_misc.py on lines 530..530
    src/wafo/tests/test_misc.py on lines 535..535
    src/wafo/tests/test_misc.py on lines 545..545
    src/wafo/tests/test_misc.py on lines 555..555
    src/wafo/tests/test_misc.py on lines 568..568

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 13.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        ind = np.nonzero(indI[1:])[0]
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 2 other locations - About 45 mins to fix
    src/wafo/graphutil.py on lines 243..243
    src/wafo/misc.py on lines 574..574

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 13.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

        t = '%2.4f' % E1
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 6 other locations - About 35 mins to fix
    src/wafo/spectrum/core.py on lines 3358..3358
    src/wafo/stats/tests/test_fit.py on lines 74..74
    src/wafo/tests/test_gaussian.py on lines 30..30
    src/wafo/tests/test_gaussian.py on lines 31..31
    src/wafo/tests/test_gaussian.py on lines 148..148
    src/wafo/transform/models.py on lines 271..271

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 11.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

        t = 'val = %2.5f' % val
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 6 other locations - About 35 mins to fix
    src/wafo/spectrum/core.py on lines 3358..3358
    src/wafo/stats/tests/test_fit.py on lines 74..74
    src/wafo/tests/test_gaussian.py on lines 30..30
    src/wafo/tests/test_gaussian.py on lines 31..31
    src/wafo/tests/test_gaussian.py on lines 39..39
    src/wafo/transform/models.py on lines 271..271

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 11.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

        rind2 = Rind(method=1)
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 5 other locations - About 35 mins to fix
    src/wafo/sg_filter/demos.py on lines 465..465
    src/wafo/spectrum/core.py on lines 1354..1354
    src/wafo/spectrum/tests/test_models.py on lines 53..53
    src/wafo/tests/test_misc.py on lines 313..313
    src/wafo/tests/test_misc.py on lines 320..320

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 11.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

        t = '%2.4f' % E0
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 6 other locations - About 35 mins to fix
    src/wafo/spectrum/core.py on lines 3358..3358
    src/wafo/stats/tests/test_fit.py on lines 74..74
    src/wafo/tests/test_gaussian.py on lines 31..31
    src/wafo/tests/test_gaussian.py on lines 39..39
    src/wafo/tests/test_gaussian.py on lines 148..148
    src/wafo/transform/models.py on lines 271..271

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 11.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

        t_true = '%2.4f' % Et
    Severity: Major
    Found in src/wafo/tests/test_gaussian.py and 6 other locations - About 35 mins to fix
    src/wafo/spectrum/core.py on lines 3358..3358
    src/wafo/stats/tests/test_fit.py on lines 74..74
    src/wafo/tests/test_gaussian.py on lines 30..30
    src/wafo/tests/test_gaussian.py on lines 39..39
    src/wafo/tests/test_gaussian.py on lines 148..148
    src/wafo/transform/models.py on lines 271..271

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 11.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        Blo = -np.inf
    Severity: Minor
    Found in src/wafo/tests/test_gaussian.py and 1 other location - About 35 mins to fix
    src/wafo/tests/test_gaussian.py on lines 138..138

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 11.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        Blo = -np.inf
    Severity: Minor
    Found in src/wafo/tests/test_gaussian.py and 1 other location - About 35 mins to fix
    src/wafo/tests/test_gaussian.py on lines 18..18

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 11.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        assert_array_almost_equal(g2(rho2), 0.24137214191774381)  # exact value
    Severity: Minor
    Found in src/wafo/tests/test_gaussian.py and 1 other location - About 30 mins to fix
    src/wafo/spectrum/models.py on lines 641..641

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 10.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Rename function "g2" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
    Open

        def g2(x):

    Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

    Noncompliant Code Example

    With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

    def MyFunction(a,b):
        ...
    

    Compliant Solution

    def my_function(a,b):
        ...
    

    Rename function "g3" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
    Open

        def g3(x):

    Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

    Noncompliant Code Example

    With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

    def MyFunction(a,b):
        ...
    

    Compliant Solution

    def my_function(a,b):
        ...
    

    Rename function "g2" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
    Open

        def g2(x):

    Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

    Noncompliant Code Example

    With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

    def MyFunction(a,b):
        ...
    

    Compliant Solution

    def my_function(a,b):
        ...
    

    Rename function "g2" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
    Open

        def g2(x):

    Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

    Noncompliant Code Example

    With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

    def MyFunction(a,b):
        ...
    

    Compliant Solution

    def my_function(a,b):
        ...
    

    Rename function "g3" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
    Open

        def g3(x):

    Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

    Noncompliant Code Example

    With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

    def MyFunction(a,b):
        ...
    

    Compliant Solution

    def my_function(a,b):
        ...
    

    There are no issues that match your filters.

    Category
    Status