#4205: [with patch, needs review] Fix deprecation warnings from numpy 1.2
----------------------------+-----------------------------------------------
Reporter: jason | Owner: was
Type: defect | Status: new
Priority: critical | Milestone: sage-3.1.3
Component: linear algebra | Resolution:
Keywords: |
----------------------------+-----------------------------------------------
Comment (by mabshoff):
With #3498 and numpy-deprecations.patch applied we get some segfaults:
{{{
sage -t -long devel/sage/sage/numerical/optimize.py # Segfault
sage -t -long devel/sage/sage/modules/real_double_vector.pyx # Segfault
sage -t -long devel/sage/sage/modules/complex_double_vector.pyx # Segfault
}}}
We need the following patch to quiet one deprecation warning:
{{{
--- a/sage/numerical/test.py Fri Sep 26 18:15:26 2008 -0500
+++ b/sage/numerical/test.py Sat Sep 27 01:03:08 2008 -0700
@@ -6,7 +6,7 @@
sage: from scipy import optimize
sage: from scipy import special
sage: from scipy import integrate
-sage: from scipy import linsolve
+sage: from scipy.sparse.linalg.dsolve import linsolve
sage: from scipy import interpolate
sage: from scipy import sparse
sage: import arpack
}}}
Various other deprecation warnings which I was too lazy to fix :p
{{{
sage -t -long devel/sage/sage/plot/plot3d/list_plot3d.py
**********************************************************************
File "/scratch/mabshoff/release-
cycle/sage-3.1.3.alpha2/tmp/list_plot3d.py", line 68:
sage: list_plot3d(m, texture='yellow',
interpolation_type='nn',frame_aspect_ratio=[1,1,1/3])
Expected nothing
Got:
doctest:1431: DeprecationWarning: scipy.stats.corrcoef is deprecated;
please update your code to use numpy.corrcoef.
Please note that:
- numpy.corrcoef rowvar argument defaults to true, not false
- numpy.corrcoef bias argument defaults to false, not true
<BLANKLINE>
doctest:1395: DeprecationWarning: scipy.stats.cov is deprecated;
please update your code to use numpy.cov.
Please note that:
- numpy.cov rowvar argument defaults to true, not false
- numpy.cov bias argument defaults to false, not true
<BLANKLINE>
doctest:413: DeprecationWarning: scipy.stats.mean is deprecated;
please update your code to use numpy.mean.
Please note that:
- numpy.mean axis argument defaults to None, not 0
- numpy.mean has a ddof argument to replace bias in a more general
manner.
scipy.stats.mean(a, bias=True) can be replaced by numpy.mean(x,
axis=0, ddof=1).
<BLANKLINE>
**********************************************************************
File "/scratch/mabshoff/release-
cycle/sage-3.1.3.alpha2/tmp/list_plot3d.py", line 74:
sage: list_plot3d(m, texture='yellow',
interpolation_type='spline',frame_aspect_ratio=[1,1,1/3])
Expected nothing
Got:
doctest:760: DeprecationWarning: PyArray_FromDims: use
PyArray_SimpleNew.
doctest:760: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
doctest:837: DeprecationWarning: PyArray_FromDims: use
PyArray_SimpleNew.
doctest:837: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
<BLANKLINE>
**********************************************************************
}}}
Some numerical noise:
{{{
sage -t -long devel/sage/sage/matrix/matrix_double_dense.pyx
**********************************************************************
File "/scratch/mabshoff/release-
cycle/sage-3.1.3.alpha2/tmp/matrix_double_dense.py", line 854:
sage: U*U.transpose()
Expected:
[ 1.0 2.13506512817e-16]
[2.13506512817e-16 1.0]
Got:
[ 1.0 2.66876364757e-16]
[2.66876364757e-16 1.0]
**********************************************************************
File "/scratch/mabshoff/release-
cycle/sage-3.1.3.alpha2/tmp/matrix_double_dense.py", line 859:
sage: V*V.transpose()
Expected:
[ 1.0 2.02230810223e-16 -2.11947972194e-16]
[ 2.02230810223e-16 1.0 7.09339271349e-17]
[-2.11947972194e-16 7.09339271349e-17 1.0]
Got:
[ 1.0 5.94955942151e-17 -1.77117977403e-16]
[ 5.94955942151e-17 1.0 -8.87690528723e-17]
[-1.77117977403e-16 -8.87690528723e-17 1.0]
**********************************************************************
}}}
Some more:
{{{
sage -t -long devel/sage/sage/finance/time_series.pyx
**********************************************************************
File "/scratch/mabshoff/release-
cycle/sage-3.1.3.alpha2/tmp/time_series.py", line 531:
sage: F = v.autoregressive_fit(100)
Expected nothing
Got:
doctest:1: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
**********************************************************************
File "/scratch/mabshoff/release-
cycle/sage-3.1.3.alpha2/tmp/time_series.py", line 569:
sage: F = v[:-1].autoregressive_fit(5); F
Expected:
[1.0019, -0.0524, -0.0643, 0.1323, -0.0539]
Got:
doctest:1: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
[1.0019, -0.0524, -0.0643, 0.1323, -0.0539]
**********************************************************************
File "/scratch/mabshoff/release-
cycle/sage-3.1.3.alpha2/tmp/time_series.py", line 95:
sage: w = v.numpy()
Expected nothing
Got:
doctest:1: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
**********************************************************************
File "/scratch/mabshoff/release-
cycle/sage-3.1.3.alpha2/tmp/time_series.py", line 1487:
sage: bm.hurst_exponent()
Expected:
0.527450972...
Got:
doctest:413: DeprecationWarning: scipy.stats.mean is deprecated;
please update your code to use numpy.mean.
Please note that:
- numpy.mean axis argument defaults to None, not 0
- numpy.mean has a ddof argument to replace bias in a more general
manner.
scipy.stats.mean(a, bias=True) can be replaced by numpy.mean(x,
axis=0, ddof=1).
0.52745097242535754
**********************************************************************
File "/scratch/mabshoff/release-
cycle/sage-3.1.3.alpha2/tmp/time_series.py", line 1494:
sage: fbm =
finance.fractional_brownian_motion_simulation(0.7,0.1,10^5,1)[0]
Expected nothing
Got:
doctest:1: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
**********************************************************************
File "/scratch/mabshoff/release-
cycle/sage-3.1.3.alpha2/tmp/time_series.py", line 1844:
sage: w = v.numpy(copy=False); w
Expected:
array([ 1. , -3. , 4.5, -2. ])
Got:
doctest:1: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
array([ 1. , -3. , 4.5, -2. ])
**********************************************************************
File "/scratch/mabshoff/release-
cycle/sage-3.1.3.alpha2/tmp/time_series.py", line 2154:
sage: w = v.fft(); w
Expected:
[45.0000, -4.5000, 12.3636, -4.5000, 5.3629, -4.5000, 2.5981, -4.5000,
0.7935]
Got:
doctest:1: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
[45.0000, -4.5000, 12.3636, -4.5000, 5.3629, -4.5000, 2.5981, -4.5000,
0.7935]
**********************************************************************
File "/scratch/mabshoff/release-
cycle/sage-3.1.3.alpha2/tmp/time_series.py", line 2206:
sage: v.ifft()
Expected:
[5.1000, -5.6876, 1.4764, -1.0774, 0.4249, -0.1000, -0.2249, 0.6663,
-1.2764, 1.6988]
Got:
doctest:1: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
[5.1000, -5.6876, 1.4764, -1.0774, 0.4249, -0.1000, -0.2249, 0.6663,
-1.2764, 1.6988]
**********************************************************************
File "/scratch/mabshoff/release-
cycle/sage-3.1.3.alpha2/tmp/time_series.py", line 2299:
sage: y =
finance.multifractal_cascade_random_walk_simulation(3700,0.02,0.01,0.01,1000,100)
Expected nothing
Got:
doctest:1: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
**********************************************************************
File "/scratch/mabshoff/release-
cycle/sage-3.1.3.alpha2/tmp/time_series.py", line 2356:
sage: for v in y_out:
s1.append(sum([(v[:-i].autoregressive_forecast(F)-v[-i])**Integer(2) for i
in range(Integer(1),Integer(20))]))
F2 = v[:-len(F)].autoregressive_fit(len(F))
s2.append(sum([(v[:-i].autoregressive_forecast(F2)-v[-i])**Integer(2) for
i in range(Integer(1),Integer(20))]))
Expected nothing
Got:
doctest:3: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
**********************************************************************
}}}
and finally:
{{{
sage -t -long devel/sage/sage/finance/fractal.pyx
**********************************************************************
File "/scratch/mabshoff/release-cycle/sage-3.1.3.alpha2/tmp/fractal.py",
line 66:
sage: sim = finance.stationary_gaussian_simulation(s, N)[0]
Expected nothing
Got:
doctest:1: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
**********************************************************************
File "/scratch/mabshoff/release-cycle/sage-3.1.3.alpha2/tmp/fractal.py",
line 155:
sage: finance.fractional_gaussian_noise_simulation(0.8,1,10,2)
Expected:
[[-0.1157, 0.7025, 0.4949, 0.3324, 0.7110, 0.7248, -0.4048, 0.3103,
-0.3465, 0.2964],
[-0.5981, -0.6932, 0.5947, -0.9995, -0.7726, -0.9070, -1.3538,
-1.2221, -0.0290, 1.0077]]
Got:
doctest:1: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
[[-0.1157, 0.7025, 0.4949, 0.3324, 0.7110, 0.7248, -0.4048, 0.3103,
-0.3465, 0.2964],
[-0.5981, -0.6932, 0.5947, -0.9995, -0.7726, -0.9070, -1.3538,
-1.2221, -0.0290, 1.0077]]
**********************************************************************
File "/scratch/mabshoff/release-cycle/sage-3.1.3.alpha2/tmp/fractal.py",
line 201:
sage: finance.fractional_brownian_motion_simulation(0.8,0.1,8,1)
Expected:
[[-0.0754, 0.1874, 0.2735, 0.5059, 0.6824, 0.6267, 0.6465, 0.6289]]
Got:
doctest:1: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
[[-0.0754, 0.1874, 0.2735, 0.5059, 0.6824, 0.6267, 0.6465, 0.6289]]
**********************************************************************
File "/scratch/mabshoff/release-cycle/sage-3.1.3.alpha2/tmp/fractal.py",
line 237:
sage: a =
finance.multifractal_cascade_random_walk_simulation(3770,0.02,0.01,0.01,10,3)
Expected nothing
Got:
doctest:1: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
**********************************************************************
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4205#comment:3>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---