Function __init__
has a Cognitive Complexity of 189 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
c3d_path: str | list[str] = None,
calibration_matrix_path: str = None,
for_identification: bool = False,
- 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
File force_from_c3d.py
has 326 lines of code (exceeds 250 allowed). Consider refactoring. Open
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import find_peaks
from copy import deepcopy
import heapq
Function stimulation_detection
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def stimulation_detection(
self,
time,
stimulation_signal,
average_time_difference: float = None,
- 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
Function set_zero_level
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_zero_level(data: np.array, average_length: int = 1000, average_on: list[int, int] = None):
"""
Set the zero level of the data by averaging the first 1000 points
:param data: The data to set the zero level
:param average_length: The number of points to average
- 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
for k in range(1, len(time[j])):
if counter == 9:
counter = 0
else:
remove_list.append(k)
Avoid deeply nested control flow statements. Open
for k in range(1, len(sliced_time[j])):
if counter == 9:
counter = 0
else:
remove_list.append(k)
Avoid deeply nested control flow statements. Open
for k in range(len(sliced_data)):
remove_list = []
counter = 0
for m in range(1, len(sliced_data[k][j])):
if counter == 9:
Avoid deeply nested control flow statements. Open
if saving_pickle_path_list[:-4] == ".pkl":
save_pickle_path = saving_pickle_path_list[:-4] + "_" + str(i) + ".pkl"
else:
save_pickle_path = saving_pickle_path_list[0] + "_" + str(i) + ".pkl"
else:
Avoid deeply nested control flow statements. Open
for k in range(len(peaks)):
plt.plot(time[peaks[k]], filtered_6d_force[0][peaks[k]], "x")
if down_sample:
Avoid deeply nested control flow statements. Open
if down_sample:
for k in range(len(sliced_time)):
plt.plot(temp_time[k], temp_data[0][k])
plt.show()
Avoid deeply nested control flow statements. Open
for k in range(len(filtered_6d_force)):
remove_list = []
counter = 0
for m in range(1, len(filtered_6d_force[k][j])):
if counter == 9:
Avoid deeply nested control flow statements. Open
for k in range(len(sliced_time)):
plt.plot(sliced_time[k], sliced_data[0][k])
for k in range(len(peaks)):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Avoid deeply nested control flow statements. Open
for l in remove_list:
sliced_time[j].pop(l)
Avoid deeply nested control flow statements. Open
for l in remove_list:
time[j].pop(l)
raw_data[7].pop(l)
dictionary = {
Function stimulation_detection
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def stimulation_detection(