wafo-project/pywafo

View on GitHub
src/wafo/covariance/estimation.py

Summary

Maintainability
F
4 days
Test Coverage

Cyclomatic complexity is too high in method tocovdata. (11)
Open

    def tocovdata(self, timeseries):
        """
        Return auto covariance function from data.

        Return
Severity: Minor
Found in src/wafo/covariance/estimation.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

Function tocovdata has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def tocovdata(self, timeseries):
        """
        Return auto covariance function from data.

        Return
Severity: Minor
Found in src/wafo/covariance/estimation.py - About 1 hr to fix

    Method "__init__" has 8 parameters, which is greater than the 7 authorized.
    Open

        def __init__(self, lag=None, tr=None, detrend=None, window='boxcar',
                     flag='biased', norm=False, dt=None):

    A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

    Noncompliant Code Example

    With a maximum number of 4 parameters:

    def do_something(param1, param2, param3, param4, param5):
        ...
    

    Compliant Solution

    def do_something(param1, param2, param3, param4):
        ...
    

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

            acf.sigma = np.sqrt(np.r_[0, auto_cov[0] ** 2,
                                auto_cov[0] ** 2 + 2 * np.cumsum(auto_cov[1:] ** 2)] / Ncens)
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 1 other location - About 6 hrs to fix
    src/wafo/covariance/estimation.py on lines 78..79

    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 79.

    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

            sigma = np.sqrt(np.r_[0, R[0] ** 2,
                                  R[0] ** 2 + 2 * np.cumsum(R[1:] ** 2)] / Ncens)
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 1 other location - About 6 hrs to fix
    src/wafo/covariance/estimation.py on lines 168..169

    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 79.

    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 __init__(self, lag=None, tr=None, detrend=None, window='boxcar',
                     flag='biased', norm=False, dt=None):
            self.lag = lag
            self.tr = tr
            self.detrend = detrend
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 1 other location - About 3 hrs to fix
    src/wafo/sg_filter/_core.py on lines 516..524

    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 50.

    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 3 locations. Consider refactoring.
    Open

        if abs(dt - dt1) > 1e-10:
            warnings.warn('Data is not uniformly sampled!')
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 2 other locations - About 2 hrs to fix
    src/wafo/covariance/core.py on lines 290..291
    src/wafo/objects.py on lines 1352..1353

    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 29.

    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 16 locations. Consider refactoring.
    Open

        t = t_vec[-1] - t_vec[0]
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 15 other locations - About 1 hr to fix
    src/wafo/covariance/estimation.py on lines 28..28
    src/wafo/kdetools/kdetools.py on lines 1125..1125
    src/wafo/kdetools/tests/test_gridding.py on lines 19..19
    src/wafo/kdetools/tests/test_gridding.py on lines 34..34
    src/wafo/kdetools/tests/test_gridding.py on lines 53..53
    src/wafo/kdetools/tests/test_gridding.py on lines 77..77
    src/wafo/misc.py on lines 2465..2465
    src/wafo/misc.py on lines 2541..2541
    src/wafo/objects.py on lines 1348..1348
    src/wafo/objects.py on lines 1350..1350
    src/wafo/sg_filter/demos.py on lines 47..47
    src/wafo/spectrum/core.py on lines 1274..1274
    src/wafo/spectrum/core.py on lines 1289..1289
    src/wafo/spectrum/core.py on lines 1406..1406
    src/wafo/spectrum/core.py on lines 1712..1712

    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 23.

    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 16 locations. Consider refactoring.
    Open

        dt1 = t_vec[1] - t_vec[0]
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 15 other locations - About 1 hr to fix
    src/wafo/covariance/estimation.py on lines 30..30
    src/wafo/kdetools/kdetools.py on lines 1125..1125
    src/wafo/kdetools/tests/test_gridding.py on lines 19..19
    src/wafo/kdetools/tests/test_gridding.py on lines 34..34
    src/wafo/kdetools/tests/test_gridding.py on lines 53..53
    src/wafo/kdetools/tests/test_gridding.py on lines 77..77
    src/wafo/misc.py on lines 2465..2465
    src/wafo/misc.py on lines 2541..2541
    src/wafo/objects.py on lines 1348..1348
    src/wafo/objects.py on lines 1350..1350
    src/wafo/sg_filter/demos.py on lines 47..47
    src/wafo/spectrum/core.py on lines 1274..1274
    src/wafo/spectrum/core.py on lines 1289..1289
    src/wafo/spectrum/core.py on lines 1406..1406
    src/wafo/spectrum/core.py on lines 1712..1712

    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 23.

    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

                            PlotData(2. * acf.sigma[lags], t)]
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 1 other location - About 1 hr to fix
    src/wafo/covariance/estimation.py on lines 170..170

    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 20.

    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

            acf.children = [PlotData(-2. * acf.sigma[lags], t),
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 1 other location - About 1 hr to fix
    src/wafo/covariance/estimation.py on lines 171..171

    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 20.

    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

            Lmax = min(300, len(R) - 1)  # maximum lag if L is undetermined
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 1 other location - About 1 hr to fix
    src/wafo/gaussian.py on lines 358..358

    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 20.

    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

            acf = CovData1D(auto_cov[lags], t)
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 3 other locations - About 1 hr to fix
    src/wafo/kdetools/kernels.py on lines 823..823
    src/wafo/kdetools/kernels.py on lines 915..915
    src/wafo/misc.py on lines 1195..1195

    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 16.

    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

            lag = min(lag, n - 2)
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 1 other location - About 1 hr to fix
    src/wafo/objects.py on lines 1515..1515

    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 16.

    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

        n = len(t_vec) - 1
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 3 other locations - About 55 mins to fix
    src/wafo/integrate.py on lines 98..98
    src/wafo/objects.py on lines 1349..1349
    src/wafo/wave_theory/core.py on lines 177..177

    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 4 locations. Consider refactoring.
    Open

            nfft = 2 ** nextpow2(n)
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 3 other locations - About 55 mins to fix
    src/wafo/covariance/core.py on lines 235..238
    src/wafo/kdetools/kdetools.py on lines 662..662
    src/wafo/spectrum/core.py on lines 925..928

    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

                Ncens = n - indnan.sum()
    Severity: Minor
    Found in src/wafo/covariance/estimation.py and 1 other location - About 55 mins to fix
    src/wafo/covariance/estimation.py on lines 140..140

    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

                x = x - x.mean()
    Severity: Minor
    Found in src/wafo/covariance/estimation.py and 1 other location - About 55 mins to fix
    src/wafo/covariance/estimation.py on lines 136..136

    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

                dt = sampling_period(timeseries[:, 0])
    Severity: Minor
    Found in src/wafo/covariance/estimation.py and 1 other location - About 50 mins to fix
    src/wafo/markov.py on lines 513..513

    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 23 locations. Consider refactoring.
    Open

            if self.tr is not None:
                x = self.tr.dat2gauss(x)
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 22 other locations - About 45 mins to fix
    src/wafo/containers.py on lines 367..367
    src/wafo/covariance/core.py on lines 704..704
    src/wafo/doc/tutorial_scripts/chapter5.py on lines 36..36
    src/wafo/doc/tutorial_scripts/chapter5.py on lines 46..46
    src/wafo/doc/tutorial_scripts/chapter5.py on lines 88..88
    src/wafo/doc/tutorial_scripts/chapter5.py on lines 243..243
    src/wafo/interpolate.py on lines 1297..1297
    src/wafo/interpolate.py on lines 1311..1311
    src/wafo/kdetools/kdetools.py on lines 451..451
    src/wafo/kdetools/kdetools.py on lines 493..493
    src/wafo/kdetools/kdetools.py on lines 722..722
    src/wafo/kdetools/kernels.py on lines 641..641
    src/wafo/kdetools/kernels.py on lines 801..801
    src/wafo/kdetools/kernels.py on lines 802..802
    src/wafo/kdetools/kernels.py on lines 886..886
    src/wafo/kdetools/kernels.py on lines 1001..1001
    src/wafo/kdetools/kernels.py on lines 1002..1002
    src/wafo/kdetools/kernels.py on lines 1105..1105
    src/wafo/kdetools/kernels.py on lines 1106..1106
    src/wafo/kdetools/kernels.py on lines 1232..1232
    src/wafo/kdetools/kernels.py on lines 1233..1233
    src/wafo/markov.py on lines 803..803

    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 2 locations. Consider refactoring.
    Open

                x = timeseries.data.flatten('F')
    Severity: Minor
    Found in src/wafo/covariance/estimation.py and 1 other location - About 45 mins to fix
    src/wafo/containers.py on lines 232..232

    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 2 locations. Consider refactoring.
    Open

                auto_cov = auto_cov / auto_cov[0]
    Severity: Minor
    Found in src/wafo/covariance/estimation.py and 1 other location - About 45 mins to fix
    src/wafo/kdetools/kernels.py on lines 133..133

    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 2 locations. Consider refactoring.
    Open

                x = x - x[1 - indnan].mean()
    Severity: Minor
    Found in src/wafo/covariance/estimation.py and 1 other location - About 45 mins to fix
    src/wafo/transform/estimation.py on lines 242..242

    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 11 locations. Consider refactoring.
    Open

            lags = slice(0, lag + 1)
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 10 other locations - About 40 mins to fix
    src/wafo/integrate.py on lines 247..247
    src/wafo/integrate.py on lines 340..340
    src/wafo/integrate.py on lines 506..506
    src/wafo/integrate.py on lines 558..558
    src/wafo/integrate.py on lines 611..611
    src/wafo/spectrum/core.py on lines 834..834
    src/wafo/spectrum/core.py on lines 963..963
    src/wafo/stats/_continuous_distns.py on lines 7492..7492
    src/wafo/stats/core.py on lines 92..92
    src/wafo/stats/core.py on lines 94..94

    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 12.

    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

                x = timeseries[:, 1:].flatten('F')
    Severity: Minor
    Found in src/wafo/covariance/estimation.py and 1 other location - About 40 mins to fix
    src/wafo/spectrum/core.py on lines 2330..2330

    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 12.

    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 16 locations. Consider refactoring.
    Open

            auto_cov[lag] = 0
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 15 other locations - About 35 mins to fix
    src/wafo/covariance/core.py on lines 408..408
    src/wafo/covariance/estimation.py on lines 137..137
    src/wafo/integrate_oscillating.py on lines 47..47
    src/wafo/integrate_oscillating.py on lines 401..401
    src/wafo/integrate_oscillating.py on lines 402..402
    src/wafo/interpolate.py on lines 784..784
    src/wafo/misc.py on lines 857..857
    src/wafo/misc.py on lines 1718..1719
    src/wafo/misc.py on lines 1740..1740
    src/wafo/misc.py on lines 2009..2009
    src/wafo/sg_filter/_core.py on lines 257..257
    src/wafo/sg_filter/_core.py on lines 350..350
    src/wafo/spectrum/models.py on lines 1856..1856
    src/wafo/spectrum/models.py on lines 1874..1874
    src/wafo/spectrum/models.py on lines 1933..1933

    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 16 locations. Consider refactoring.
    Open

                x[indnan] = 0.
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 15 other locations - About 35 mins to fix
    src/wafo/covariance/core.py on lines 408..408
    src/wafo/covariance/estimation.py on lines 164..164
    src/wafo/integrate_oscillating.py on lines 47..47
    src/wafo/integrate_oscillating.py on lines 401..401
    src/wafo/integrate_oscillating.py on lines 402..402
    src/wafo/interpolate.py on lines 784..784
    src/wafo/misc.py on lines 857..857
    src/wafo/misc.py on lines 1718..1719
    src/wafo/misc.py on lines 1740..1740
    src/wafo/misc.py on lines 2009..2009
    src/wafo/sg_filter/_core.py on lines 257..257
    src/wafo/sg_filter/_core.py on lines 350..350
    src/wafo/spectrum/models.py on lines 1856..1856
    src/wafo/spectrum/models.py on lines 1874..1874
    src/wafo/spectrum/models.py on lines 1933..1933

    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 5 locations. Consider refactoring.
    Open

            auto_cov[:lag] = auto_cov[:lag] * win[lag - 1::]
    Severity: Major
    Found in src/wafo/covariance/estimation.py and 4 other locations - About 35 mins to fix
    src/wafo/markov.py on lines 341..341
    src/wafo/markov.py on lines 342..342
    src/wafo/markov.py on lines 408..408
    src/wafo/markov.py on lines 419..419

    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

            if isinstance(window, str) or type(window) is tuple:
    Severity: Minor
    Found in src/wafo/covariance/estimation.py and 1 other location - About 35 mins to fix
    src/wafo/objects.py on lines 1517..1517

    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

    There are no issues that match your filters.

    Category
    Status