mktranstrum / MBAM

Code for the Manifold Boundary Approximation Method
MIT License
14 stars 5 forks source link

Error while running MMR_Plots.py librarsu #3

Open mariocastro73 opened 1 year ago

mariocastro73 commented 1 year ago

I get an error message while running MMR_Plots.py


❯ python MMR_Plots.py Iteration: 2, tau: 0.000015, |v| = 1.000000 Iteration: 3, tau: 0.153958, |v| = 0.999754 Iteration: 4, tau: 0.914626, |v| = 1.000552 Iteration: 5, tau: 1.675293, |v| = 1.001134 Iteration: 6, tau: 2.818968, |v| = 1.001561 Iteration: 7, tau: 3.962643, |v| = 1.001505 Iteration: 8, tau: 5.106318, |v| = 1.001516 Iteration: 9, tau: 6.249993, |v| = 1.001605 Iteration: 10, tau: 7.393668, |v| = 1.001636 Iteration: 11, tau: 8.537343, |v| = 1.001646 Iteration: 12, tau: 9.681018, |v| = 1.001647 Iteration: 13, tau: 11.434460, |v| = 1.001648 Iteration: 14, tau: 12.272422, |v| = 1.001648 Iteration: 15, tau: 13.110384, |v| = 1.001648 Iteration: 16, tau: 16.551312, |v| = 1.001648 capi_return is NULL Call-back cb_f_in_dvodeuserroutines failed. Traceback (most recent call last): File "/home/user/MEGA/repos/MBAM/examples/MMR_Plots.py", line 32, in geo_forward.integrate(25.0) File "/home/user/.local/lib/python3.10/site-packages/mbam/geodesic.py", line 194, in integrate self.step(tmax - self.t) File "/home/user/.local/lib/python3.10/site-packages/mbam/geodesic.py", line 168, in step ode.integrate(self, self.t + dt, step=1) File "/home/user/.local/lib/python3.10/site-packages/scipy/integrate/_ode.py", line 431, in integrate self._y, self.t = mth(self.f, self.jac or (lambda: None), File "/home/user/.local/lib/python3.10/site-packages/scipy/integrate/_ode.py", line 1022, in step r = self.run(args) File "/home/user/.local/lib/python3.10/site-packages/scipy/integrate/_ode.py", line 1007, in run y1, t, istate = self.runner(args) File "/home/user/.local/lib/python3.10/site-packages/mbam/geodesic.py", line 137, in geodesic_rhs a = -np.linalg.solve(g, j.T @ Avv) File "<__array_function__ internals>", line 200, in solve File "/usr/lib/python3.10/site-packages/numpy/linalg/linalg.py", line 386, in solve r = gufunc(a, b, signature=signature, extobj=extobj) File "/usr/lib/python3.10/site-packages/numpy/linalg/linalg.py", line 89, in _raise_linalgerror_singular raise LinAlgError("Singular matrix") numpy.linalg.LinAlgError: Singular matrix

mktranstrum commented 1 year ago

That looks like the FIM becoming near-singular as the geodesic approaches the manifold boundary. We should catch that error and exit gracefully when it occurs. I'll have a chance to look at it later this weekend.

mariocastro73 commented 1 year ago

Thanks. It might be a problem with newer python versions. It seems to work fine for older versions.