Skip to content

Commit

Permalink
Merge pull request #861 from Ipuch/master
Browse files Browse the repository at this point in the history
catching when reading
  • Loading branch information
pariterre authored Mar 15, 2024
2 parents 95fd84e + 6a6f2b0 commit a377e94
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bioptim/dynamics/integrator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from casadi import Function, vertcat, horzcat, collocation_points, tangent, rootfinder, DM, MX, SX, linspace
import numpy as np
from casadi import Function, vertcat, horzcat, collocation_points, tangent, rootfinder, DM, MX, SX, linspace

from ..misc.enums import ControlType, DefectType
from ..models.protocols.biomodel import BioModel
Expand Down Expand Up @@ -170,7 +170,7 @@ def get_u(self, u: np.ndarray, t: float) -> np.ndarray:
The control at a given time
"""

if self.control_type == ControlType.CONSTANT or self.control_type == ControlType.CONSTANT_WITH_LAST_NODE:
if self.control_type in (ControlType.CONSTANT, ControlType.CONSTANT_WITH_LAST_NODE):
return u
elif self.control_type == ControlType.LINEAR_CONTINUOUS:
dt_norm = (t - self.t_span_sym[0]) / self.t_span_sym[1]
Expand Down Expand Up @@ -595,7 +595,7 @@ def get_u(self, u: np.ndarray, t: float | MX | SX) -> np.ndarray:
The control at a given time
"""

if self.control_type == ControlType.CONSTANT or self.control_type == ControlType.CONSTANT_WITH_LAST_NODE:
if self.control_type in (ControlType.CONSTANT, ControlType.CONSTANT_WITH_LAST_NODE):
return super(COLLOCATION, self).get_u(u, t)
else:
raise NotImplementedError(f"{self.control_type} ControlType not implemented yet with COLLOCATION")
Expand Down

0 comments on commit a377e94

Please sign in to comment.