[SciPy-User] Disable singular matrix warning

Carlos Baptista carlossbaptista at gmail.com
Mon Aug 13 08:33:16 EDT 2012


Thank you very much Ralf. That did the trick!

On 13 August 2012 08:15, Ralf Gommers <ralf.gommers at gmail.com> wrote:

>
>
> On Mon, Aug 13, 2012 at 4:06 AM, Carlos Baptista <
> carlossbaptista at gmail.com> wrote:
>
>> I had not tried it before. But I did it just now and it did not work
>> unfortunately.
>>
>> That's because sparse/linalg/dsolve/umfpack/umfpack.py contains:
>
>           if econd > self.maxCond:
>               print 'warning: (almost) singular matrix! '\
>                     + '(estimated cond. number: %.2e)' % econd
>
> We have to change that to use the warnings module. For now all you can do
> is comment out those 3 lines in your installed version of scipy.
>
> Ralf
>
>
>> On 12 August 2012 23:47, Paweł Kwaśniewski <pawel.kw at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> Have you tried the simplest example from
>>> http://docs.python.org/library/warnings.html
>>>
>>> import warnings
>>>
>>>
>>> with warnings.catch_warnings():
>>>     warnings.simplefilter("ignore")
>>>
>>> And then your function call?
>>>
>>> Cheers,
>>>
>>> Paweł
>>>
>>>
>>> 2012/8/12 Carlos Baptista <carlossbaptista at gmail.com>
>>>
>>>>  Hello there,
>>>>
>>>> I am fairly new to Python. As a self-test I re-programmed an old MATLAB
>>>> assignment in Python using NumPy, SciPy and Matplotlib. At a certain point
>>>> I am getting the following warning:
>>>>
>>>> warning: (almost) singular matrix! (estimated cond. number: 1.87e+14)
>>>>
>>>> This result is however expected and therefore I would like to disable
>>>> this warning. I am getting this warning from:
>>>>
>>>> scipy.sparse.linalg.spsolve(A,b)
>>>>
>>>> where A has a large condition number.
>>>>
>>>> I have already tried the following to no avail:
>>>>
>>>> ========================
>>>>
>>>> import warnings
>>>>
>>>>
>>>> with warnings.catch_warnings():
>>>>
>>>>     warnings.filterwarnings("ignore",category=Warning)
>>>>
>>>>     from poisson import solvePoisson
>>>>
>>>>
>>>> ========================
>>>>
>>>>
>>>> where solvePoisson is the function (located in poisson.py) in which the
>>>> above solve statement is executed.
>>>>
>>>>
>>>> How can I disable this singular matrix warning?
>>>>
>>>>
>>>>
>>>> With kind regards,
>>>>
>>>> Carlos
>>>>
>>>> _______________________________________________
>>>> SciPy-User mailing list
>>>> SciPy-User at scipy.org
>>>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>>>
>>>>
>>>
>>> _______________________________________________
>>> SciPy-User mailing list
>>> SciPy-User at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>>
>>>
>>
>>
>> --
>> met de vriendelijke groeten van / with kind regards,
>>
>> Carlos Fernando Baptista
>>
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
>>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>


-- 
met de vriendelijke groeten van / with kind regards,

Carlos Fernando Baptista
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20120813/f7014e37/attachment.html>


More information about the SciPy-User mailing list