[SciPy-Dev] replace print by custom Warnings
josef.pktd at gmail.com
josef.pktd at gmail.com
Wed Apr 27 10:56:43 EDT 2011
should scipy get additional custom warnings instead of print statements ?
eg. InterpolationWarning, OptimizationWarning, ....
Josef
---------- Forwarded message ----------
From: Yaroslav Halchenko <debian at onerussian.com>
Date: Wed, Apr 27, 2011 at 10:45 AM
Subject: Re: [pymvpa] minor bug ?
To: pkg-exppsy-pymvpa at lists.alioth.debian.org
On Wed, 27 Apr 2011, josef.pktd at gmail.com wrote:
> You can just temporarily turn off the warnings in the test, if you add
> test for corner cases.
> That's how Ralf silenced the scipy test suite.
and we silence our tests ;-) but apparently not externals checks
> If there are print statements, then it would be a bug in scipy, but
> these look like "Warnings" where you have control over what happens to
> them.
Ha -- poking in my eyes works at times! Thanks Josef!
Apparently it is indeed numpy warnings so np.seterr(all="ignore") was
effective!
BUT scipy does use straight printouts of warnings, and that is what made me
believe that it was one of them:
$> dpkg -L python-scipy | grep '\.py' | xargs grep -i "print.*warn" | head
/usr/share/pyshared/scipy/signal/signaltools.py: print
"Warning: imaginary part of x ignored."
/usr/share/pyshared/scipy/signal/signaltools.py: print
"Warning: imaginary part of x ignored."
/usr/share/pyshared/scipy/signal/filter_design.py: print
"Warning, order is zero...check input parametegstop."
/usr/share/pyshared/scipy/interpolate/fitpack.py: if
quiet<2:print 'Warning: Setting x[%d][%d]=x[%d][0]'%(i,m,i)
/usr/share/pyshared/scipy/interpolate/fitpack.py: print
"Warning: "+_iermess[ier][0]
/usr/share/pyshared/scipy/interpolate/fitpack.py: print
"Warning: "+_iermess[ier][0]
/usr/share/pyshared/scipy/interpolate/fitpack.py: print
"Warning: the number of zeros exceeds mest"
/usr/share/pyshared/scipy/interpolate/fitpack.py: print
"Warning: "+_iermess2[ierm][0]
/usr/share/pyshared/scipy/integrate/quadpack.py: print
"Warning: " + msg
/usr/share/pyshared/scipy/maxentropy/maxentutils.py:# print
"Warning: could not load the fast FORTRAN library for logsumexp()."
(git)novo:~/proj/scipy[tags/v0.9.0]git
$> git grep -i 'print .*Warning:'
scipy/integrate/quadpack.py: print "Warning: " + msg
scipy/interpolate/fitpack.py: if quiet<2:print
'Warning: Setting x[%d][%d]=x[%d][0]'%(i,m,i)
scipy/interpolate/fitpack.py: print "Warning: "+_iermess[ier][0]
scipy/interpolate/fitpack.py: print "Warning: "+_iermess[ier][0]
scipy/interpolate/fitpack.py: print "Warning: the number of
zeros exceeds mest"
scipy/interpolate/fitpack.py: print "Warning: "+_iermess2[ierm][0]
scipy/maxentropy/maxentutils.py:# print "Warning: could not load
the fast FORTRAN library for logsumexp()."
scipy/maxentropy/maxentutils.py: print "Warning: OverflowError
using numpy.exp(). Using slower Python"\
scipy/optimize/anneal.py: print "Warning: Cooled to %f
at %s but this is not" \
scipy/optimize/anneal.py: print "Warning: Maximum number of
iterations exceeded."
scipy/optimize/optimize.py: print "Warning: Maximum number
of function evaluations has "\
scipy/optimize/optimize.py: print "Warning: Maximum number
of iterations has been exceeded"
scipy/optimize/optimize.py: print "Warning: Desired error
not necessarily achieved" \
scipy/optimize/optimize.py: print "Warning: Maximum number
of iterations has been exceeded"
scipy/optimize/optimize.py: print "Warning: Desired error
not necessarily achieved due to precision loss"
scipy/optimize/optimize.py: print "Warning: Maximum number
of iterations has been exceeded"
scipy/optimize/optimize.py: print "Warning: Maximum number
of iterations has been exceeded"
scipy/optimize/optimize.py: print "Warning: Maximum number
of function evaluations has "\
scipy/optimize/optimize.py: print "Warning: Maximum number
of iterations has been exceeded"
scipy/optimize/optimize.py: print "Warning: Final
optimization did not succeed"
scipy/signal/signaltools.py: print "Warning: imaginary part of
x ignored."
scipy/signal/signaltools.py: print "Warning: imaginary part of
x ignored."
scipy/sparse/linalg/dsolve/umfpack/umfpack.py:
print 'warning: singular matrix'
scipy/sparse/linalg/dsolve/umfpack/umfpack.py:
print 'warning: recomputing symbolic'
scipy/sparse/linalg/dsolve/umfpack/umfpack.py: print
'warning: (almost) singular matrix! '\
scipy/weave/blitz_tools.py: print 'warning: compilation
failed. Executing as python code'
scipy/weave/build_tools.py: #print "warning: build directory
was not part of python path."\
scipy/weave/build_tools.py: print "warning: specified temp_dir
'%s' does not exist " \
scipy/weave/build_tools.py: print "warning:, neither the
module's directory nor the "\
scipy/weave/build_tools.py: print 'WARNING: failed to build
import library for gcc. Linking will fail.'
scipy/weave/catalog.py: print 'warning: default directory is
not write accessible.'
scipy/weave/catalog.py: print 'warning: default directory is
not write accessible.'
scipy/weave/catalog.py: print 'warning: unable to repair
catalog entry\n %s\n in\n %s' % \
scipy/weave/swig2_spec.py: print "WARNING: Multiple SWIG
versions detected. No version was"
--
=------------------------------------------------------------------=
Keep in touch www.onerussian.com
Yaroslav Halchenko www.ohloh.net/accounts/yarikoptic
_______________________________________________
Pkg-ExpPsy-PyMVPA mailing list
Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/pkg-exppsy-pymvpa
More information about the SciPy-Dev
mailing list