Skip to content

Commit

Permalink
Rename pelvis to torso to sacrum
Browse files Browse the repository at this point in the history
  • Loading branch information
tjstienstra committed Sep 4, 2023
1 parent 9f71a8e commit d3ef71a
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions src/brim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

"SphericalLeftShoulder", "SphericalRightShoulder",

"FixedPelvisToTorso",
"FixedSacrum",

"BicycleRider",

Expand Down Expand Up @@ -60,7 +60,7 @@
SideLeanSeat,
)
from brim.rider import (
FixedPelvisToTorso,
FixedSacrum,
PinElbowStickLeftArm,
PinElbowStickRightArm,
PinLeftHip,
Expand Down
8 changes: 4 additions & 4 deletions src/brim/rider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"Rider",

"HipBase", "LeftHipBase", "RightHipBase", "PelvisToTorsoBase",
"HipBase", "LeftHipBase", "RightHipBase", "SacrumBase",
"LeftShoulderBase", "RightShoulderBase", "ShoulderBase",

"PelvisBase", "PlanarPelvis",
Expand All @@ -22,7 +22,7 @@

"TwoPinLegTorque", "TwoPinLegSpringDamper",

"FixedPelvisToTorso",
"FixedSacrum",

"SphericalLeftHip", "SphericalRightHip", "PinLeftHip", "PinRightHip",

Expand All @@ -46,9 +46,9 @@
HipBase,
LeftHipBase,
LeftShoulderBase,
PelvisToTorsoBase,
RightHipBase,
RightShoulderBase,
SacrumBase,
ShoulderBase,
)
from brim.rider.connections import RiderLeanConnection
Expand All @@ -70,9 +70,9 @@
TwoPinStickRightLeg,
)
from brim.rider.pelvis import PelvisBase, PlanarPelvis
from brim.rider.pelvis_to_torso import FixedPelvisToTorso
from brim.rider.rider import Rider
from brim.rider.rider_lean import RiderLean
from brim.rider.sacrums import FixedSacrum
from brim.rider.shoulder_joints import (
SphericalLeftShoulder,
SphericalRightShoulder,
Expand Down
4 changes: 2 additions & 2 deletions src/brim/rider/base_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
with contextlib.suppress(ImportError):
from brim.utilities.plotting import PlotModel

__all__ = ["PelvisToTorsoBase", "ShoulderBase", "LeftShoulderBase", "RightShoulderBase",
__all__ = ["SacrumBase", "ShoulderBase", "LeftShoulderBase", "RightShoulderBase",
"HipBase", "LeftHipBase", "RightHipBase"]


class PelvisToTorsoBase(ConnectionBase):
class SacrumBase(ConnectionBase):
"""Base class for the connection between the pelvis and the torso."""

required_models: tuple[ModelRequirement, ...] = (
Expand Down
12 changes: 6 additions & 6 deletions src/brim/rider/rider.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from brim.rider.base_connections import (
LeftHipBase,
LeftShoulderBase,
PelvisToTorsoBase,
RightHipBase,
RightShoulderBase,
SacrumBase,
)
from brim.rider.legs import LeftLegBase, RightLegBase
from brim.rider.pelvis import PelvisBase
Expand All @@ -31,7 +31,7 @@ class Rider(ModelBase):
ModelRequirement("right_leg", RightLegBase, "Right leg of the rider.", False),
)
required_connections: tuple[ConnectionRequirement] = (
ConnectionRequirement("pelvis_to_torso", PelvisToTorsoBase,
ConnectionRequirement("sacrum", SacrumBase,
"Connection between the pelvis and the torso.", False),
ConnectionRequirement("left_shoulder", LeftShoulderBase,
"Connection between the torso and the left arm.", False),
Expand All @@ -48,7 +48,7 @@ class Rider(ModelBase):
right_arm: RightArmBase
left_leg: LeftLegBase
right_leg: RightLegBase
pelvis_to_torso: PelvisToTorsoBase
sacrum: SacrumBase
left_shoulder: LeftShoulderBase
right_shoulder: RightShoulderBase
left_hip: LeftHipBase
Expand All @@ -57,9 +57,9 @@ class Rider(ModelBase):
def _define_connections(self) -> None:
"""Define the connections."""
super()._define_connections()
if self.pelvis_to_torso:
self.pelvis_to_torso.pelvis = self.pelvis
self.pelvis_to_torso.torso = self.torso
if self.sacrum:
self.sacrum.pelvis = self.pelvis
self.sacrum.torso = self.torso
if self.left_shoulder:
self.left_shoulder.torso = self.torso
self.left_shoulder.arm = self.left_arm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
from sympy.physics.mechanics import Vector, WeldJoint
from sympy.physics.mechanics._system import System

from brim.rider.base_connections import PelvisToTorsoBase
from brim.rider.base_connections import SacrumBase

with contextlib.suppress(ImportError):
import numpy as np

if TYPE_CHECKING:
from bicycleparameters import Bicycle

__all__ = ["FixedPelvisToTorso"]
__all__ = ["FixedSacrum"]


class FixedPelvisToTorso(PelvisToTorsoBase):
"""Connection between the pelvis and the torso with a fixed connection."""
class FixedSacrum(SacrumBase):
"""Connection to fixate the torso to the pelvis."""

@property
def descriptions(self) -> dict[Any, str]:
Expand Down
4 changes: 2 additions & 2 deletions tests/brim/test_bicycle_rider.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
SideLeanSeat,
)
from brim.rider import (
FixedPelvisToTorso,
FixedSacrum,
PinElbowStickLeftArm,
PinElbowStickRightArm,
PlanarPelvis,
Expand Down Expand Up @@ -64,7 +64,7 @@ def _rider_setup(self) -> None:
self.rider.right_arm = PinElbowStickRightArm("right_arm")
self.rider.left_leg = TwoPinStickLeftLeg("left_leg")
self.rider.right_leg = TwoPinStickRightLeg("right_leg")
self.rider.pelvis_to_torso = FixedPelvisToTorso("pelvis_to_torso")
self.rider.sacrum = FixedSacrum("sacrum")
self.rider.left_hip = SphericalLeftHip("left_hip")
self.rider.right_hip = SphericalRightHip("right_hip")
self.rider.left_shoulder = SphericalLeftShoulder("left_shoulder")
Expand Down
6 changes: 3 additions & 3 deletions tests/rider/test_rider.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from brim.rider import (
FixedPelvisToTorso,
FixedSacrum,
PinElbowStickLeftArm,
PinElbowStickRightArm,
PlanarPelvis,
Expand All @@ -27,7 +27,7 @@ def _setup(self) -> None:
self.rider.right_arm = PinElbowStickRightArm("right_arm")
self.rider.left_leg = TwoPinStickLeftLeg("left_leg")
self.rider.right_leg = TwoPinStickRightLeg("right_leg")
self.rider.pelvis_to_torso = FixedPelvisToTorso("pelvis_to_torso")
self.rider.sacrum = FixedSacrum("sacrum")
self.rider.left_hip = SphericalLeftHip("left_hip")
self.rider.right_hip = SphericalRightHip("right_hip")
self.rider.left_shoulder = SphericalLeftShoulder("left_shoulder")
Expand All @@ -40,7 +40,7 @@ def test_setup(self, _setup) -> None:
assert self.rider.right_arm is not None
assert self.rider.left_leg is not None
assert self.rider.right_leg is not None
assert self.rider.pelvis_to_torso is not None
assert self.rider.sacrum is not None
assert self.rider.left_hip is not None
assert self.rider.right_hip is not None
assert self.rider.left_shoulder is not None
Expand Down
24 changes: 12 additions & 12 deletions tests/rider/test_pelvis_to_torso.py → tests/rider/test_sacrums.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from __future__ import annotations

import pytest
from brim.rider.base_connections import PelvisToTorsoBase
from brim.rider.base_connections import SacrumBase
from brim.rider.pelvis import PlanarPelvis
from brim.rider.pelvis_to_torso import FixedPelvisToTorso
from brim.rider.sacrums import FixedSacrum
from brim.rider.torso import PlanarTorso
from brim.utilities.testing import _test_descriptions, create_model_of_connection
from sympy import eye
Expand All @@ -14,22 +14,22 @@
PlotConnection = None


@pytest.mark.parametrize("pelvis_cls, torso_cls, pelvis_to_torso_cls", [
(PlanarPelvis, PlanarTorso, FixedPelvisToTorso),
@pytest.mark.parametrize("pelvis_cls, torso_cls, sacrum_cls", [
(PlanarPelvis, PlanarTorso, FixedSacrum),
])
class TestPelvisToTorsoBase:
class TestSacrumBase:
@pytest.fixture(autouse=True)
def _setup(self, pelvis_cls, torso_cls, pelvis_to_torso_cls) -> None:
self.model = create_model_of_connection(pelvis_to_torso_cls)("model")
def _setup(self, pelvis_cls, torso_cls, sacrum_cls) -> None:
self.model = create_model_of_connection(sacrum_cls)("model")
self.model.pelvis = pelvis_cls("pelvis")
self.model.torso = torso_cls("torso")
self.model.conn = pelvis_to_torso_cls("pelvis_to_torso")
self.model.conn = sacrum_cls("sacrum")
self.pelvis, self.torso, self.conn = (
self.model.pelvis, self.model.torso, self.model.conn)
self.model.define_all()

def test_types(self) -> None:
assert isinstance(self.conn, PelvisToTorsoBase)
assert isinstance(self.conn, SacrumBase)

def test_descriptions(self) -> None:
_test_descriptions(self.conn)
Expand All @@ -41,13 +41,13 @@ def test_plotting(self):
assert plot_conn.children


class TestFixedPelvisToTorso:
class TestFixedSacrum:
@pytest.fixture(autouse=True)
def _setup(self) -> None:
self.model = create_model_of_connection(FixedPelvisToTorso)("model")
self.model = create_model_of_connection(FixedSacrum)("model")
self.model.pelvis = PlanarPelvis("pelvis")
self.model.torso = PlanarTorso("torso")
self.model.conn = FixedPelvisToTorso("pelvis_to_torso")
self.model.conn = FixedSacrum("sacrum")
self.pelvis, self.torso, self.conn = (
self.model.pelvis, self.model.torso, self.model.conn)
self.model.define_connections()
Expand Down
4 changes: 2 additions & 2 deletions tests/utilities/test_parametrize.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from brim.rider.hip_joints import SphericalLeftHip, SphericalRightHip
from brim.rider.legs import TwoPinStickLeftLeg, TwoPinStickRightLeg
from brim.rider.pelvis import PlanarPelvis
from brim.rider.pelvis_to_torso import FixedPelvisToTorso
from brim.rider.rider import Rider
from brim.rider.sacrums import FixedSacrum
from brim.rider.shoulder_joints import SphericalLeftShoulder, SphericalRightShoulder
from brim.rider.torso import PlanarTorso
from sympy import diag
Expand Down Expand Up @@ -93,7 +93,7 @@ def _setup_full_model(self) -> None:
self.rider.right_arm = PinElbowStickRightArm("right_arm")
self.rider.left_leg = TwoPinStickLeftLeg("left_leg")
self.rider.right_leg = TwoPinStickRightLeg("right_leg")
self.rider.pelvis_to_torso = FixedPelvisToTorso("pelvis_to_torso")
self.rider.sacrum = FixedSacrum("sacrum")
self.rider.left_hip = SphericalLeftHip("left_hip")
self.rider.right_hip = SphericalRightHip("right_hip")
self.rider.left_shoulder = SphericalLeftShoulder("left_shoulder")
Expand Down

0 comments on commit d3ef71a

Please sign in to comment.