# compute\_proj\_raw raised 'LinAlgError - SVD did not	converge'

**URL:** <https://mne.discourse.group/t/compute-proj-raw-raised-linalgerror-svd-did-not-converge/883>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [November 17, 2014, 11:26pm UTC](https://mne.discourse.group/t/compute-proj-raw-raised-linalgerror-svd-did-not-converge/883 "2014-11-17T23:26:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 17, 2014, 11:26pm UTC](https://mne.discourse.group/t/compute-proj-raw-raised-linalgerror-svd-did-not-converge/883/1 "2014-11-17T23:26:39Z")

</div>

Hello all,

I am attempting to use compute\_proj\_raw (  
[http://martinos.org/mne/stable/generated/mne.compute\_proj\_raw.html?highlight=compute\_proj\_raw#mne.compute\_proj\_raw](http://martinos.org/mne/stable/generated/mne.compute_proj_raw.html?highlight=compute_proj_raw#mne.compute_proj_raw)  
)

However, when I run the program I get the following error:  
[https://gist.github.com/howarth/ae6289878337cb30af84](https://gist.github.com/howarth/ae6289878337cb30af84)

This is from the stable version of mnepython using 'pip install mne' which  
was done a few weeks ago.

Thanks!  
Dan Howarth  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20141117/9ca35bf0/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141117/9ca35bf0/attachment.html)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 18, 2014, 8:21am UTC](https://mne.discourse.group/t/compute-proj-raw-raised-linalgerror-svd-did-not-converge/883/2 "2014-11-18T08:21:01Z")

</div>

hi Dan,

on what data did you apply this function?

how did you install python+numpy+scipy?

Alex

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 18, 2014, 4:18pm UTC](https://mne.discourse.group/t/compute-proj-raw-raised-linalgerror-svd-did-not-converge/883/3 "2014-11-18T16:18:51Z")

</div>

In our lab we take a 'empty room' recording in which we turn on the MEG  
scanner when no one is in the room in order to further characterize the  
noise.

I haven't had a problem in the past with this function, but for some reason  
its not working for some subjects and working for others.

Here's the pipeline of the data:

max filter -\> band pass 1-150 \> notch filter 60, 120 \> then I compute the  
proj

Python was installed on my ubuntu machine. I use virtualenv

I used pip to install everything.

scipy: 0.14.0  
numpy: 1.9.1

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 18, 2014, 4:34pm UTC](https://mne.discourse.group/t/compute-proj-raw-raised-linalgerror-svd-did-not-converge/883/4 "2014-11-18T16:34:11Z")

</div>

Unfortunately this is likely due to a bug in LAPACK:

[https://github.com/scipy/scipy/issues/3868](https://github.com/scipy/scipy/issues/3868)

You could try updating LAPACK, using `python-scipy` and `python-numpy` from  
the Ubuntu repos, or possibly using Anaconda instead of the system Python.  
Although it's ugly, it also works sometimes to just tweak the inputs a tiny  
(seemingly trivial) amount, e.g. by including/excluding one extra time  
point or epoch in calculations.

Eric

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 18, 2014, 7:13pm UTC](https://mne.discourse.group/t/compute-proj-raw-raised-linalgerror-svd-did-not-converge/883/5 "2014-11-18T19:13:10Z")

</div>

I tried using Anaconda but that didn't work out either.

I found something interesting here:  
[http://stackoverflow.com/questions/23533144/numpy-linalg-linalg-linalgerror-svd-did-not-converge](http://stackoverflow.com/questions/23533144/numpy-linalg-linalg-linalgerror-svd-did-not-converge)

Would it be possible that the 'weights' are negative?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 18, 2014, 7:15pm UTC](https://mne.discourse.group/t/compute-proj-raw-raised-linalgerror-svd-did-not-converge/883/6 "2014-11-18T19:15:51Z")

</div>

I should also note that I do not get this problem with the file if I try to  
do the projection before I band pass and notch filter. Could band passing  
and notch filtering before performing the computation result in a situation  
in which the 'weight matrix' (I have no idea what that is reffering to in  
this context) has negatives?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 18, 2014, 8:13pm UTC](https://mne.discourse.group/t/compute-proj-raw-raised-linalgerror-svd-did-not-converge/883/7 "2014-11-18T20:13:01Z")

</div>

There shouldn't be any NaNs in the data (and I thought scipy/numpy checked  
for this anyway), so I'd be surprised if it were the same issue. If you're  
feeling adventurous you could do "import pdb; pdb.pm()" and then use pdb  
commands to debug the issue a little bit. Given that this will probably  
required a bit of back-and-forth, I'd suggest opening an mne-python issue  
so we can interact without burdening the mne-analysis listserv.

Eric

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 18, 2014, 11:29pm UTC](https://mne.discourse.group/t/compute-proj-raw-raised-linalgerror-svd-did-not-converge/883/8 "2014-11-18T23:29:36Z")

</div>

Dan,

it you need put the file somewhere with a script so we can help.

Alex
