alexandrebarachant/pyRiemann

View on GitHub
pyriemann/utils/covariance.py

Summary

Maintainability
D
2 days
Test Coverage

File covariance.py has 673 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import warnings
from functools import wraps

import numpy as np
from scipy.linalg import block_diag
Severity: Major
Found in pyriemann/utils/covariance.py - About 1 day to fix

    Function cross_spectrum has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def cross_spectrum(X, window=128, overlap=0.75, fmin=None, fmax=None, fs=None):
        """Compute the complex cross-spectral matrices of a real signal X.
    
        Parameters
        ----------
    Severity: Minor
    Found in pyriemann/utils/covariance.py - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function covariance_mest has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def covariance_mest(X, m_estimator, *, init=None, tol=10e-3, n_iter_max=50,
                        assume_centered=False, q=0.9, nu=5, norm="trace"):
        r"""Robust M-estimators.
    
        Robust M-estimator based covariance matrix [1]_, computed by fixed point
    Severity: Minor
    Found in pyriemann/utils/covariance.py - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function coherence has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def coherence(X, window=128, overlap=0.75, fmin=None, fmax=None, fs=None,
                  coh='ordinary'):
        """Compute squared coherence.
    
        Parameters
    Severity: Minor
    Found in pyriemann/utils/covariance.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function covariance_mest has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def covariance_mest(X, m_estimator, *, init=None, tol=10e-3, n_iter_max=50,
    Severity: Major
    Found in pyriemann/utils/covariance.py - About 1 hr to fix

      Function coherence has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def coherence(X, window=128, overlap=0.75, fmin=None, fmax=None, fs=None,
      Severity: Major
      Found in pyriemann/utils/covariance.py - About 50 mins to fix

        Function cospectrum has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def cospectrum(X, window=128, overlap=0.75, fmin=None, fmax=None, fs=None):
        Severity: Minor
        Found in pyriemann/utils/covariance.py - About 45 mins to fix

          Function cross_spectrum has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def cross_spectrum(X, window=128, overlap=0.75, fmin=None, fmax=None, fs=None):
          Severity: Minor
          Found in pyriemann/utils/covariance.py - About 45 mins to fix

            Function eegtocov has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def eegtocov(sig, window=128, overlapp=0.5, padding=True, estimator="cov"):
            Severity: Minor
            Found in pyriemann/utils/covariance.py - About 35 mins to fix

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

              def normalize(X, norm):
                  """Normalize a set of square matrices, using corr, trace or determinant.
              
                  Parameters
                  ----------
              Severity: Minor
              Found in pyriemann/utils/covariance.py - About 25 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

              There are no issues that match your filters.

              Category
              Status