experiments/experiment_bci_competition.py
Function read_BCI_signals
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
Open
def read_BCI_signals():
kppath = "../../datasets/BCIcompetition4/"
lkp = listdir(kppath)
sujets = list()
classes = list()
- Read upRead up
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
Open
for e in range(s.shape[1]):
fs[:, e] = filtfilt(real(bb), real(ab), ns[:, e])
# decimate the signal
if decimation:
Avoid deeply nested control flow statements. Open
Open
if decimation:
fs = decimate(fs, int(dfactor), axis=0, zero_phase=True)
# Event Type
trial_begin = 768
Avoid deeply nested control flow statements. Open
Open
for e in range(s.shape[1]):
ns[:, e] = filtfilt(bn, an, s[:, e])
# Apply a bandpass filter
fs = zeros_like(s)