[RTR] Muscles changing color with activation#68
Conversation
| A class to handle emg data. | ||
| """ | ||
|
|
||
| def __init__( |
There was a problem hiding this comment.
Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
| A class to handle emg data. | ||
| """ | ||
|
|
||
| def __init__( |
There was a problem hiding this comment.
Function __init__ has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Ipuch
left a comment
There was a problem hiding this comment.
Reviewed 11 of 11 files at r1, all commit messages.
Reviewable status: all files reviewed, 13 unresolved discussions (waiting on @EveCharbie)
pyorerun/phase_rerun.py line 63 at r1 (raw file):
q: np.ndarray, tracked_markers: PyoMarkers | np.ndarray = None, emg: Pyoemg | np.ndarray = None,
PyoMuscles
pyorerun/model_phase.py line 19 at r1 (raw file):
self.rerun_models = [] self.q = [] self.muscle_colors = []
muscle_activations_intensity (?)
pyorerun/model_phase.py line 32 at r1 (raw file):
def add_animated_model( self, model: AbstractModel, q: np.ndarray, tracked_markers: np.ndarray = None, muscle_colors: np.ndarray = None
consistency on names
pyorerun/model_phase.py line 36 at r1 (raw file):
self.models.append(model) self.rerun_models.append( ModelUpdater(name=f"{self.name}/{self.nb_models}_{model.name}", model=model, muscle_colors=muscle_colors)
consistency on names
pyorerun/abstract/linestrip.py line 103 at r1 (raw file):
A numpy array with the color of each line. """ # @ ipuch: at this point we do not know how much frames there will be :/
remove the comment.
pyorerun/__init__.py line 19 at r1 (raw file):
from .phase_rerun import PhaseRerun from .pyomarkers import Pyomarkers from .pyoemg import Pyoemg
PyoMuscles
pyorerun/model_components/ligaments.py line 72 at r1 (raw file):
colors = [self.properties.color[s, :, :] for _ in range(nb_frames) for s in range(self.nb_strips)] else: colors = [self.properties.color for _ in range(nb_frames * self.nb_strips)]
def color_to_rerun(nb_frame):
return
Code quote:
# @ipuch: I do not find the declaration, but I feel this should be done before
if len(self.properties.color.shape) == 3:
colors = [self.properties.color[s, f, :] for f in range(nb_frames) for s in range(self.nb_strips)]
elif len(self.properties.color.shape) == 2:
colors = [self.properties.color[s, :, :] for _ in range(nb_frames) for s in range(self.nb_strips)]
else:
colors = [self.properties.color for _ in range(nb_frames * self.nb_strips)]examples/biorbd/gait_reconstruction.py line 4 at r1 (raw file):
import numpy as np from pyorerun.pyomarkers import Pyomarkers as PyoMarkers
PyoMarkers
examples/biorbd/gait_reconstruction.py line 6 at r1 (raw file):
from pyorerun.pyomarkers import Pyomarkers as PyoMarkers from pyorerun import BiorbdModel, PhaseRerun, Pyoemg
PyoEmgs
examples/biorbd/gait_reconstruction.py line 45 at r1 (raw file):
for i_muscle in range(nb_muscles): fake_emg[i_muscle, :] = np.linspace(0.01, 1, nb_frames) pyoemg = Pyoemg(
PyoMuscles
examples/biorbd/gait_reconstruction.py line 46 at r1 (raw file):
fake_emg[i_muscle, :] = np.linspace(0.01, 1, nb_frames) pyoemg = Pyoemg( data=fake_emg,
magnitude (?)
EveCharbie
left a comment
There was a problem hiding this comment.
Reviewable status: all files reviewed, 13 unresolved discussions (waiting on @Ipuch)
examples/biorbd/gait_reconstruction.py line 4 at r1 (raw file):
Previously, Ipuch (Pierre Puchaud) wrote…
PyoMarkers
Done.
examples/biorbd/gait_reconstruction.py line 6 at r1 (raw file):
Previously, Ipuch (Pierre Puchaud) wrote…
PyoEmgs
Done.
examples/biorbd/gait_reconstruction.py line 45 at r1 (raw file):
Previously, Ipuch (Pierre Puchaud) wrote…
PyoMuscles
Done.
examples/biorbd/gait_reconstruction.py line 46 at r1 (raw file):
Previously, Ipuch (Pierre Puchaud) wrote…
magnitude (?)
I confirmed it is "data" also in PyoMarkers
pyorerun/__init__.py line 19 at r1 (raw file):
Previously, Ipuch (Pierre Puchaud) wrote…
PyoMuscles
Done.
pyorerun/model_phase.py line 19 at r1 (raw file):
Previously, Ipuch (Pierre Puchaud) wrote…
muscle_activations_intensity (?)
It really is a color
pyorerun/model_phase.py line 32 at r1 (raw file):
Previously, Ipuch (Pierre Puchaud) wrote…
consistency on names
It really is a color since at this point it is evaluated into a np.array
pyorerun/model_phase.py line 36 at r1 (raw file):
Previously, Ipuch (Pierre Puchaud) wrote…
consistency on names
It really is a color
pyorerun/phase_rerun.py line 63 at r1 (raw file):
Previously, Ipuch (Pierre Puchaud) wrote…
PyoMuscles
Done.
pyorerun/abstract/linestrip.py line 103 at r1 (raw file):
Previously, Ipuch (Pierre Puchaud) wrote…
remove the comment.
Done.
pyorerun/model_components/ligaments.py line 72 at r1 (raw file):
Previously, Ipuch (Pierre Puchaud) wrote…
def color_to_rerun(nb_frame):
return
Done.
|
@Ipuch I think we are good :) |
Ipuch
left a comment
There was a problem hiding this comment.
Reviewed 19 of 19 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @EveCharbie)
|
The tests are not passing because we changed the signature of color_to_rerun(nb_frame). According to code climate there is room for improvement in the init of pyomucles if you want to extract some checks or function out of it. I merge when tests pass |
|
Code Climate has analyzed commit bf17c9b and detected 3 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
Ipuch
left a comment
There was a problem hiding this comment.
Reviewed 2 of 8 files at r3, all commit messages.
Reviewable status: 18 of 25 files reviewed, 2 unresolved discussions (waiting on @EveCharbie)
Ipuch
left a comment
There was a problem hiding this comment.
Reviewed 6 of 8 files at r3, 1 of 1 files at r4.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @EveCharbie)
This change is