Skip to content
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

LinAlgError: SVD did not converge when plotting data (raw.plot()) #8784

Closed
FriederikeScholten opened this issue Jan 25, 2021 · 7 comments
Closed
Milestone

Comments

@FriederikeScholten
Copy link

I am currently going through the tutorials provided by MNE and when I try to use the built-in plot function, I often get an error that the SVD did not converge (see attached picture). Two other colleagues have the same problem (using Spyder & Visual Studio Code). One of them made the experience that it does work sometimes after re-running the cell multiple times. Any idea what the issue might be here?
SVDerror

@agramfort
Copy link
Member

agramfort commented Jan 25, 2021 via email

@FriederikeScholten
Copy link
Author

@agramfort , we used the 'sample' dataset that is used in the tutorial

@agramfort
Copy link
Member

agramfort commented Jan 25, 2021 via email

@larsoner
Copy link
Member

If you're using NumPy with OpenBLAS it could be OpenMathLib/OpenBLAS#3044 which won't be fixed until an OpenBLAS release then NumPy release. Or if you're using NumPy with MKL you could be caught by https://community.intel.com/t5/Intel-Distribution-for-Python/Bug-in-GESDD-but-not-GESVD/m-p/1105241 which has been around for 5 years and stopped getting replies from Intel folks. We can work around either one probably with a from mne.fixes import _safe_svd and using that instead of scipy.linalg.svd, can you give it a try? If it works, it would be awesome if you could open a quick PR for this!

If it does not fix the problem, you could be hitting this issue because you have nan or inf in your projector, and we should add some check for the projector being invalid

@FriederikeScholten
Copy link
Author

This is what the mne.sys_info() gives me:
MNE_sysinfo

@larsoner
Copy link
Member

@FriederikeScholten can you double check that all(np.isfinite(proj['data']['data']).all() for proj in raw.info['projs']) evaluates to True? If it is then you're probably hitting the Intel bug. If you can check your CPU architecture, try out some of the cases I posted in that issue, and tell them you're hitting the issue, too? Maybe more pings/reports will get them to fix it.

And in the meantime, feel free to try using _safe_svd, it should work around the issue

@larsoner larsoner added this to the 0.23 milestone Jan 26, 2021
@FriederikeScholten
Copy link
Author

Thanks for the suggestions. I do not know how (to my knowledge I did not change anything), but the plot function works fine now, also for my colleague. Just to follow up, the code: all(np.isfinite(proj['data']['data']).all() for proj in raw.info['projs']) evaluates True.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants