|
30 | 30 |
|
31 | 31 | from .config import Config
|
32 | 32 | from .shapes import Shape
|
33 |
| -from .singularity_detection import SingularityDetection |
| 33 | +from .singularity_detection import SingularityDetection, SingularityDetectionException |
34 | 34 | from .sympy_helpers import _custom_simplify_expr, _is_zero
|
35 | 35 |
|
36 | 36 |
|
@@ -195,12 +195,15 @@ def generate_propagator_solver(self):
|
195 | 195 | if sympy.I in sympy.preorder_traversal(P):
|
196 | 196 | raise PropagatorGenerationException("The imaginary unit was found in the propagator matrix. This can happen if the dynamical system that was passed to ode-toolbox is unstable, i.e. one or more state variables will diverge to minus or positive infinity.")
|
197 | 197 |
|
198 |
| - condition = SingularityDetection.find_singularities(P, self.A_) |
199 |
| - if condition: |
200 |
| - logging.warning("Under certain conditions, the propagator matrix is singular (contains infinities).") |
201 |
| - logging.warning("List of all conditions that result in a singular propagator:") |
202 |
| - for cond in condition: |
203 |
| - logging.warning("\t" + r" ∧ ".join([str(k) + " = " + str(v) for k, v in cond.items()])) |
| 198 | + try: |
| 199 | + condition = SingularityDetection.find_singularities(P, self.A_) |
| 200 | + if condition: |
| 201 | + logging.warning("Under certain conditions, the propagator matrix is singular (contains infinities).") |
| 202 | + logging.warning("List of all conditions that result in a singular propagator:") |
| 203 | + for cond in condition: |
| 204 | + logging.warning("\t" + r" ∧ ".join([str(k) + " = " + str(v) for k, v in cond.items()])) |
| 205 | + except SingularityDetectionException: |
| 206 | + logging.warning("Could not check the propagator matrix for singularities.") |
204 | 207 |
|
205 | 208 | logging.debug("System of equations:")
|
206 | 209 | logging.debug("x = " + str(self.x_))
|
|
0 commit comments