-
Notifications
You must be signed in to change notification settings - Fork 55
[RTM] Fully converted dynamics fatigue to new types #977
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
[RTM] Fully converted dynamics fatigue to new types #977
Conversation
9413250 to
bacb753
Compare
EveCharbie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GG, this one should be easier ;)
Reviewed 6 of 6 files at r1, all commit messages.
Reviewable status: all files reviewed, 37 unresolved discussions (waiting on @EastWest14)
bioptim/dynamics/fatigue/muscle_fatigue.py line 48 at r1 (raw file):
return MultiFatigueInterfaceMuscle def _get_target_load(self, nlp, controls, index):
controls: CX
index: Int
-> CX
Code quote:
def _get_target_load(self, nlp, controls, index):bioptim/dynamics/fatigue/muscle_fatigue.py line 54 at r1 (raw file):
return DynamicsFunctions.get(nlp.controls[self.type()], controls)[index, :] def dynamics(self, dxdt: MX, nlp, index: Int, states, controls) -> MX:
Same CX
Code quote:
def dynamics(self, dxdt: MX, nlp, index: Int, states, controls) -> MX:bioptim/dynamics/fatigue/michaud_fatigue.py line 84 at r1 (raw file):
return "tab:green", "tab:orange", "tab:red", "tab:brown" def default_initial_guess(self) -> IntTuple:
-> FloatTuple
Code quote:
def default_initial_guess(self) -> IntTuple:bioptim/dynamics/fatigue/michaud_fatigue.py line 87 at r1 (raw file):
return 0, 1, 0, 0 def default_bounds(self, variable_type: VariableType) -> AnyTuple:
Tuple[FloatTuple]
Code quote:
def default_bounds(self, variable_type: VariableType) -> AnyTuple:bioptim/dynamics/fatigue/michaud_fatigue.py line 90 at r1 (raw file):
return (0, 0, 0, 0), (1, 1, 1, 1) def apply_dynamics(self, target_load, *states):
target_load: CX
-> CX
Code quote:
def apply_dynamics(self, target_load, *states):bioptim/dynamics/fatigue/effort_perception.py line 57 at r1 (raw file):
return (0,), (1,) def apply_dynamics(self, target_load, *states):
target_load: CX
-> CX
Code quote:
def apply_dynamics(self, target_load, *states):bioptim/dynamics/fatigue/fatigue_dynamics.py line 47 at r1 (raw file):
@staticmethod @abstractmethod def suffix(variable_type: VariableType) -> AnyTuple:
StrTuple
Code quote:
def suffix(variable_type: VariableType) -> AnyTuple:bioptim/dynamics/fatigue/fatigue_dynamics.py line 54 at r1 (raw file):
@staticmethod @abstractmethod def color() -> AnyTuple:
-> StrTuple
Code quote:
def color() -> AnyTuple:bioptim/dynamics/fatigue/fatigue_dynamics.py line 72 at r1 (raw file):
@abstractmethod def default_initial_guess(self) -> AnyTuple:
FloatTuple
Code quote:
def default_initial_guess(self) -> AnyTuple:bioptim/dynamics/fatigue/fatigue_dynamics.py line 78 at r1 (raw file):
@abstractmethod def default_bounds(self, variable_type: VariableType) -> AnyTuple:
Tuple[FloatTuple]
Code quote:
def default_bounds(self, variable_type: VariableType) -> AnyTuple:bioptim/dynamics/fatigue/fatigue_dynamics.py line 98 at r1 (raw file):
@abstractmethod def dynamics(self, dxdt: MX, nlp, index: int, states, controls) -> MX:
index: Int
states: CX
controls: CX
Actually, I am 80% sure all MX in the fatigue context could be changed to CX (the docstring could also be updated to MX | SX)
Code quote:
def dynamics(self, dxdt: MX, nlp, index: int, states, controls) -> MX:bioptim/dynamics/fatigue/fatigue_dynamics.py line 135 at r1 (raw file):
def __init__( self, model: FatigueModel | AnyList,
list[FatigueModel]
Code quote:
model: FatigueModel | AnyList,bioptim/dynamics/fatigue/fatigue_dynamics.py line 191 at r1 (raw file):
@staticmethod @abstractmethod def color() -> AnyTuple:
-> StrTuple
Code quote:
def color() -> AnyTuple:bioptim/dynamics/fatigue/fatigue_dynamics.py line 198 at r1 (raw file):
@staticmethod @abstractmethod def plot_factor() -> AnyTuple:
FloatTuple
Code quote:
def plot_factor() -> AnyTuple:bioptim/dynamics/fatigue/fatigue_dynamics.py line 204 at r1 (raw file):
@abstractmethod def suffix(self) -> AnyTuple:
-> StrTuple
Code quote:
def suffix(self) -> AnyTuple:bioptim/dynamics/fatigue/fatigue_dynamics.py line 209 at r1 (raw file):
""" def add(self, fatigue: FatigueModel):
-> None
Code quote:
def add(self, fatigue: FatigueModel):bioptim/dynamics/fatigue/fatigue_dynamics.py line 220 at r1 (raw file):
self.models.append(fatigue) def dynamics(self, dxdt: MX, nlp, index: Int, states, controls) -> MX:
dxdt: CX
states: CX
controls: CX
-> CX
Code quote:
def dynamics(self, dxdt: MX, nlp, index: Int, states, controls) -> MX:bioptim/dynamics/fatigue/fatigue_dynamics.py line 227 at r1 (raw file):
@abstractmethod def _dynamics_per_suffix(self, dxdt: MX, suffix, nlp, index: int, states, controls):
Same
Code quote:
def _dynamics_per_suffix(self, dxdt: MX, suffix, nlp, index: int, states, controls):bioptim/dynamics/fatigue/fatigue_dynamics.py line 252 at r1 (raw file):
@staticmethod @abstractmethod def default_state_only():
-> Bool
Code quote:
def default_state_only():bioptim/dynamics/fatigue/fatigue_dynamics.py line 259 at r1 (raw file):
@staticmethod @abstractmethod def default_apply_to_joint_dynamics():
-> Bool
Code quote:
def default_apply_to_joint_dynamics():bioptim/dynamics/fatigue/fatigue_dynamics.py line 265 at r1 (raw file):
@abstractmethod def default_bounds(self, index: Int, variable_type: VariableType) -> AnyTuple:
Tuple[FloatTuple]
Code quote:
def default_bounds(self, index: Int, variable_type: VariableType) -> AnyTuple:bioptim/dynamics/fatigue/fatigue_dynamics.py line 282 at r1 (raw file):
@abstractmethod def default_initial_guess(self, index: Int, variable_type: VariableType) -> Int:
-> FloatTuple
Code quote:
-> Int:bioptim/dynamics/fatigue/fatigue_dynamics.py line 298 at r1 (raw file):
""" def _convert_to_models_key(self, item: IntOrStr):
-> Str
Code quote:
def _convert_to_models_key(self, item: IntOrStr):bioptim/dynamics/fatigue/fatigue_dynamics.py line 321 at r1 (raw file):
return ("fatigue",) def default_bounds(self, index: Int, variable_type: VariableType) -> AnyTuple:
Tuple[FloatTuple]
Code quote:
def default_bounds(self, index: Int, variable_type: VariableType) -> AnyTuple:bioptim/dynamics/fatigue/fatigue_dynamics.py line 324 at r1 (raw file):
return self.models["fatigue"].default_bounds(variable_type) def default_initial_guess(self, index: Int, variable_type: VariableType):
-> FloatTuple
Code quote:
def default_initial_guess(self, index: Int, variable_type: VariableType):bioptim/dynamics/fatigue/fatigue_dynamics.py line 327 at r1 (raw file):
return self.models["fatigue"].default_initial_guess() def _dynamics_per_suffix(self, dxdt: MX, suffix, nlp, index: Int, states, controls):
Same CX
Code quote:
def _dynamics_per_suffix(self, dxdt: MX, suffix, nlp, index: Int, states, controls):bioptim/dynamics/fatigue/fatigue_dynamics.py line 335 at r1 (raw file):
@staticmethod def plot_factor() -> IntTuple:
-> FloatTuple
Code quote:
def plot_factor() -> IntTuple:bioptim/dynamics/fatigue/fatigue_dynamics.py line 354 at r1 (raw file):
self.suffix = suffix def add(self, **extra_arguments: Any):
-> None
Code quote:
def add(self, **extra_arguments: Any):bioptim/dynamics/fatigue/fatigue_dynamics.py line 370 at r1 (raw file):
return self.options[self._iter_idx - 1][0] if self.options[self._iter_idx - 1] else None def dynamics(self, dxdt: MX, nlp, states, controls) -> MX:
Same CX
Code quote:
def dynamics(self, dxdt: MX, nlp, states, controls) -> MX:bioptim/dynamics/fatigue/fatigue_dynamics.py line 413 at r1 (raw file):
self.options[0][model.model_type()].add(model=model, phase=index) def dynamics(self, dxdt: MX, nlp, index: Int, states, controls):
Same CX
Code quote:
def dynamics(self, dxdt: MX, nlp, index: Int, states, controls):bioptim/dynamics/fatigue/xia_fatigue.py line 51 at r1 (raw file):
return "tab:green", "tab:orange", "tab:red" def default_initial_guess(self) -> StrTuple:
-> FloatTuple
Code quote:
def default_initial_guess(self) -> StrTuple:bioptim/dynamics/fatigue/xia_fatigue.py line 54 at r1 (raw file):
return 0, 1, 0 def default_bounds(self, variable_type: VariableType) -> AnyTuple:
Tuple[FloatTuple]
Code quote:
def default_bounds(self, variable_type: VariableType) -> AnyTuple:bioptim/dynamics/fatigue/xia_fatigue.py line 65 at r1 (raw file):
return "mf" def apply_dynamics(self, target_load: Float | CX, *states: Float | CX):
target_load: CX
states: CX
-> CX
Code quote:
def apply_dynamics(self, target_load: Float | CX, *states: Float | CX):bioptim/dynamics/fatigue/tau_fatigue.py line 60 at r1 (raw file):
@staticmethod def plot_factor() -> DoubleIntTuple:
FloatTuple
Code quote:
def plot_factor() -> DoubleIntTuple:bioptim/dynamics/fatigue/tau_fatigue.py line 79 at r1 (raw file):
""" def _dynamics_per_suffix(self, dxdt: MX, suffix, nlp, index: Int, states, controls) -> MX:
Same CX
Code quote:
def _dynamics_per_suffix(self, dxdt: MX, suffix, nlp, index: Int, states, controls) -> MX:bioptim/dynamics/fatigue/tau_fatigue.py line 93 at r1 (raw file):
return dxdt def _get_target_load(self, var: FatigueModel, suffix: Str, nlp, controls, index: Int):
controls: CX
-> CX
Code quote:
def _get_target_load(self, var: FatigueModel, suffix: Str, nlp, controls, index: Int):bioptim/dynamics/fatigue/tau_fatigue.py line 113 at r1 (raw file):
return False def default_bounds(self, index: int, variable_type: VariableType) -> AnyTuple:
Tuple[FloatTuple]
Code quote:
def default_bounds(self, index: int, variable_type: VariableType) -> AnyTuple:
EastWest14
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 7 files reviewed, 37 unresolved discussions (waiting on @EveCharbie)
bioptim/dynamics/fatigue/effort_perception.py line 57 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
target_load: CX
-> CX
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 47 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
StrTuple
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 72 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
FloatTuple
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 78 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
Tuple[FloatTuple]
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 98 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
index: Int
states: CX
controls: CX
Actually, I am 80% sure all MX in the fatigue context could be changed to CX (the docstring could also be updated to MX | SX)
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 135 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
list[FatigueModel]
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 191 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
-> StrTuple
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 198 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
FloatTuple
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 204 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
-> StrTuple
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 209 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
-> None
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 220 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
dxdt: CX
states: CX
controls: CX
-> CX
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 227 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
Same
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 252 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
-> Bool
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 265 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
Tuple[FloatTuple]
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 298 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
-> Str
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 321 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
Tuple[FloatTuple]
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 324 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
-> FloatTuple
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 327 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
Same CX
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 335 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
-> FloatTuple
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 354 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
-> None
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 370 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
Same CX
Done.
bioptim/dynamics/fatigue/fatigue_dynamics.py line 413 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
Same CX
Done.
bioptim/dynamics/fatigue/michaud_fatigue.py line 84 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
-> FloatTuple
Done.
bioptim/dynamics/fatigue/michaud_fatigue.py line 87 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
Tuple[FloatTuple]
Done.
bioptim/dynamics/fatigue/tau_fatigue.py line 60 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
FloatTuple
Done.
bioptim/dynamics/fatigue/tau_fatigue.py line 79 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
Same CX
Done.
bioptim/dynamics/fatigue/tau_fatigue.py line 93 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
controls: CX
-> CX
Done.
bioptim/dynamics/fatigue/tau_fatigue.py line 113 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
Tuple[FloatTuple]
Done.
bioptim/dynamics/fatigue/xia_fatigue.py line 51 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
-> FloatTuple
Done.
bioptim/dynamics/fatigue/xia_fatigue.py line 54 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
Tuple[FloatTuple]
Done.
bioptim/dynamics/fatigue/xia_fatigue.py line 65 at r1 (raw file):
Previously, EveCharbie (Eve Charbonneau) wrote…
target_load: CX
states: CX
-> CX
Done.
EveCharbie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, thanks :)
Reviewed 7 of 7 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @EastWest14)
bioptim/dynamics/fatigue/fatigue_dynamics.py line 98 at r1 (raw file):
Previously, EastWest14 (aprosikhin) wrote…
Done.
Done.
#975
All Submissions:
New Feature Submissions:
black . -l120 --exclude "external/*")?Changes to Core Features:
This change is