Skip to content

[RTR] Muscles changing color with activation #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jul 9, 2025
Merged

Conversation

EveCharbie
Copy link
Collaborator

@EveCharbie EveCharbie commented Jul 4, 2025

This change is Reviewable

A class to handle emg data.
"""

def __init__(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.

A class to handle emg data.
"""

def __init__(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function __init__ has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.

Copy link
Collaborator

@Ipuch Ipuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 EveCharbie requested a review from Ipuch July 8, 2025 14:51
Copy link
Collaborator Author

@EveCharbie EveCharbie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@EveCharbie EveCharbie changed the title Muscles changing color with activation [RTR] Muscles changing color with activation Jul 8, 2025
@EveCharbie
Copy link
Collaborator Author

@Ipuch I think we are good :)

Copy link
Collaborator

@Ipuch Ipuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 19 of 19 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @EveCharbie)

@Ipuch
Copy link
Collaborator

Ipuch commented Jul 8, 2025

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

Copy link

codeclimate bot commented Jul 9, 2025

Code Climate has analyzed commit bf17c9b and detected 3 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 3

View more on Code Climate.

Copy link
Collaborator

@Ipuch Ipuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 8 files at r3, all commit messages.
Reviewable status: 18 of 25 files reviewed, 2 unresolved discussions (waiting on @EveCharbie)

Copy link
Collaborator

@Ipuch Ipuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 6 of 8 files at r3, 1 of 1 files at r4.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @EveCharbie)

@Ipuch Ipuch merged commit ee0a25f into pyomeca:main Jul 9, 2025
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants