#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):
Ok, the latest patch has the following issues left:
{{{
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>
**********************************************************************
}}}
and after fixing the same issue as in the other places, i.e
{{{
cdef ndarray n =
numpy.array(list(self),dtype=numpy.dtype('float64'))
#cdef ndarray n = PyArray_SimpleNewFromData(1, dims, NPY_DOUBLE,
self._values)
if copy:
return n.copy()
else:
return n
}}}
we get
{{{
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 1477:
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 1485:
sage: fbm.hurst_exponent()
Expected:
0.706511951...
Got:
0.52044004048795489
**********************************************************************
File "/scratch/mabshoff/release-
cycle/sage-3.1.3.alpha2/tmp/time_series.py", line 1489:
sage: fbm =
finance.fractional_brownian_motion_simulation(0.2,0.1,10^5,1)[0]
Exception raised:
Traceback (most recent call last):
File "/scratch/mabshoff/release-
cycle/sage-3.1.3.alpha2/local/lib/python2.5/doctest.py", line 1228, in
__run
compileflags, 1) in test.globs
File "<doctest __main__.example_46[8]>", line 1, in <module>
fbm =
finance.fractional_brownian_motion_simulation(RealNumber('0.2'),RealNumber('0.1'),Integer(10)**Integer(5),Integer(1))[Integer(0)]###line
1489:
sage: fbm =
finance.fractional_brownian_motion_simulation(0.2,0.1,10^5,1)[0]
File "fractal.pyx", line 210, in
sage.finance.fractal.fractional_brownian_motion_simulation
(sage/finance/fractal.c:1145)
File "fractal.pyx", line 183, in
sage.finance.fractal.fractional_gaussian_noise_simulation
(sage/finance/fractal.c:1059)
File "fractal.pyx", line 118, in
sage.finance.fractal.stationary_gaussian_simulation
(sage/finance/fractal.c:642)
NotImplementedError: Stationary Gaussian simulation only implemented
when Fourier transform is nonnegative
**********************************************************************
File "/scratch/mabshoff/release-
cycle/sage-3.1.3.alpha2/tmp/time_series.py", line 1490:
sage: fbm.hurst_exponent()
Expected:
0.278997441...
Got:
0.52044004048795489
}}}
and some numerical noise, but this might be related to the stats function:
{{{
sage -t -long devel/sage/sage/finance/fractal.pyx
**********************************************************************
File "/scratch/mabshoff/release-cycle/sage-3.1.3.alpha2/tmp/fractal.py",
line 69:
sage: [sim.autocovariance(i) for i in [0..4]]
Expected:
[0.98665816086255..., 0.69201577095377..., 0.56234006792017...,
0.48647965409871..., 0.43667043322102...]
Got:
[353.87586761938252, 4.1452524114948925, 2.6438582436312341,
-5.3373197046012857, 1.2666878806249871]
**********************************************************************
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:
[[3.0262, -0.9109, 0.8122, -1.0340, -1.6515, -1.6213, -0.9947, 1.2976,
-0.8180, -0.2633],
[-1.5913, -0.6777, 2.7479, 1.5428, -0.0232, -1.4984, -0.9457,
-1.0283, 0.6810, 0.1817]]
**********************************************************************
File "/scratch/mabshoff/release-cycle/sage-3.1.3.alpha2/tmp/fractal.py",
line 161:
sage:
finance.fractional_gaussian_noise_simulation(0.8,1,10,1)[0].sums()
Expected:
[-0.1157, 0.5868, 1.0818, 1.4142, 2.1252, 2.8500, 2.4452, 2.7555,
2.4090, 2.7054]
Got:
[3.0262, 2.1154, 2.9275, 1.8935, 0.2420, -1.3793, -2.3740, -1.0764,
-1.8944, -2.1577]
**********************************************************************
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:
[[0.8560, 0.5983, 0.8280, 0.5356, 0.0685, -0.3901, -0.6715, -0.3045]]
**********************************************************************
File "/scratch/mabshoff/release-cycle/sage-3.1.3.alpha2/tmp/fractal.py",
line 204:
sage: finance.fractional_brownian_motion_simulation(0.8,0.01,8,1)
Expected:
[[-0.0239, 0.0593, 0.0865, 0.1600, 0.2158, 0.1982, 0.2044, 0.1989]]
Got:
[[0.2707, 0.1892, 0.2618, 0.1694, 0.0216, -0.1234, -0.2123, -0.0963]]
**********************************************************************
File "/scratch/mabshoff/release-cycle/sage-3.1.3.alpha2/tmp/fractal.py",
line 206:
sage: finance.fractional_brownian_motion_simulation(0.8,0.01,8,2)
Expected:
[[-0.0167, 0.0342, 0.0261, 0.0856, 0.1735, 0.2541, 0.1409, 0.1692],
[0.0244, -0.0153, 0.0125, -0.0363, 0.0764, 0.1009, 0.1598, 0.2133]]
Got:
[[0.0866, 0.1219, 0.0045, 0.0102, -0.0459, -0.0883, 0.0837, 0.1999],
[0.3499, 0.3886, 0.5201, 0.4895, 0.6820, 0.7656, 0.8753, 0.8654]]
**********************************************************************
File "/scratch/mabshoff/release-cycle/sage-3.1.3.alpha2/tmp/fractal.py",
line 238:
sage: a
Expected:
[[-0.0096, 0.0025, 0.0066, 0.0016, 0.0078, 0.0051, 0.0047, -0.0013,
0.0003, -0.0043],
[0.0003, 0.0035, 0.0257, 0.0358, 0.0377, 0.0563, 0.0661, 0.0746,
0.0749, 0.0689],
[-0.0120, -0.0116, 0.0043, 0.0078, 0.0115, 0.0018, 0.0085, 0.0005,
0.0012, 0.0060]]
Got:
[[-0.0600, -0.0520, -0.0482, -0.0526, -0.0463, -0.0477, -0.0482,
-0.0557, -0.0543, -0.0614],
[0.0072, 0.0114, 0.0220, 0.0274, 0.0295, 0.0422, 0.0495, 0.0550,
0.0553, 0.0459],
[-0.1452, -0.1446, -0.1266, -0.1228, -0.1167, -0.1271, -0.1169,
-0.1227, -0.1220, -0.1199]]
**********************************************************************
File "/scratch/mabshoff/release-cycle/sage-3.1.3.alpha2/tmp/fractal.py",
line 244:
sage: a[0].exp()
Expected:
[0.9905, 1.0025, 1.0067, 1.0016, 1.0078, 1.0051, 1.0047, 0.9987,
1.0003, 0.9957]
Got:
[0.9418, 0.9493, 0.9529, 0.9488, 0.9548, 0.9534, 0.9529, 0.9459,
0.9472, 0.9404]
**********************************************************************
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4205#comment:5>
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
-~----------~----~----~----~------~----~------~--~---