File inverse_kinematics.py
has 544 lines of code (exceeds 250 allowed). Consider refactoring. Open
from typing import Callable
import numpy as np
from casadi import vertcat, horzcat, MX, Function, sum1
- Create a ticketCreate a ticket
Function get_Q_init_from_initial_guess_mode
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def get_Q_init_from_initial_guess_mode(
self,
initial_guess_mode: InitialGuessModeType,
Q_init: np.ndarray | NaturalCoordinates,
experimental_markers: np.ndarray,
- Read upRead up
- Create a ticketCreate a ticket
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 _solve_frame_per_frame
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _solve_frame_per_frame(
self,
Q_init: np.ndarray | NaturalCoordinates,
initial_guess_mode: InitialGuessModeType,
method: str,
- Read upRead up
- Create a ticketCreate a ticket
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 __init__
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
model: BiomechanicalModel,
experimental_markers: np.ndarray | str = None,
experimental_heatmaps: dict[str, np.ndarray] = None,
- Read upRead up
- Create a ticketCreate a ticket
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 __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
- Create a ticketCreate a ticket
Function _solve_frame_per_frame
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _solve_frame_per_frame(
- Create a ticketCreate a ticket
Function update_initial_guess
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_initial_guess(
- Create a ticketCreate a ticket
Function solve
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def solve(
- Create a ticketCreate a ticket
Function _solve_all_frame_together
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _solve_all_frame_together(
self,
Q_init: np.ndarray | NaturalCoordinates,
method: str,
options: dict,
- Read upRead up
- Create a ticketCreate a ticket
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 add_objective
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_objective(self, objective_function: Callable):
"""
This method adds an extra objective to the inverse kinematics problem. The objective function has to be a
CasADi Function with the following signature: [objective_sym] = objective_function(Q_sym, markers_sym)
- Read upRead up
- Create a ticketCreate a ticket
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 check_segment_determinants
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_segment_determinants(self):
"""Checks the determinant of each segment frame"""
self.segment_determinants = np.zeros((self.model.nb_segments, self.nb_frames))
for i in range(0, self.Qopt.shape[1]):
Qi = NaturalCoordinatesNumpy(self.Qopt)[:, i : i + 1]
- Read upRead up
- Create a ticketCreate a ticket
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"