sylvchev/mdla

View on GitHub
experiments/experiment_bci_competition.py

Summary

Maintainability
C
7 hrs
Test Coverage

Function read_BCI_signals has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

def read_BCI_signals():
    kppath = "../../datasets/BCIcompetition4/"
    lkp = listdir(kppath)
    sujets = list()
    classes = list()
Severity: Minor
Found in experiments/experiment_bci_competition.py - About 5 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

Avoid deeply nested control flow statements.
Open

                    for e in range(s.shape[1]):
                        fs[:, e] = filtfilt(real(bb), real(ab), ns[:, e])
                    # decimate the signal
                    if decimation:
Severity: Major
Found in experiments/experiment_bci_competition.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if decimation:
                            fs = decimate(fs, int(dfactor), axis=0, zero_phase=True)
    
                    # Event Type
                    trial_begin = 768
    Severity: Major
    Found in experiments/experiment_bci_competition.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          for e in range(s.shape[1]):
                              ns[:, e] = filtfilt(bn, an, s[:, e])
                          # Apply a bandpass filter
                          fs = zeros_like(s)
      Severity: Major
      Found in experiments/experiment_bci_competition.py - About 45 mins to fix

        There are no issues that match your filters.

        Category
        Status