Skip to content

Commit

Permalink
ENH all tests now pass with numpy 1.8.0rc1
Browse files Browse the repository at this point in the history
Bottleneck now requires numpy 1.8.
  • Loading branch information
kwgoodman committed Oct 2, 2013
1 parent 3a38e76 commit 9c5038e
Show file tree
Hide file tree
Showing 7 changed files with 13,452 additions and 13,016 deletions.
8 changes: 7 additions & 1 deletion README.rst
Expand Up @@ -2,6 +2,9 @@
Bottleneck
==========

.. warning::
This version of Bottleneck requires NumPy 1.8.

Introduction
============

Expand Down Expand Up @@ -229,10 +232,13 @@ URLs
Install
=======

.. warning::
This version of Bottleneck requires NumPy 1.8.

Requirements:

======================== ====================================================
Bottleneck Python 2.6, 2.7, 3.3; NumPy 1.5.1, 1.6.2, 1.7.1
Bottleneck Python 2.6, 2.7, 3.3; NumPy 1.8
Compile gcc or MinGW
Unit tests nose
======================== ====================================================
Expand Down
5 changes: 5 additions & 0 deletions RELEASE.rst
Expand Up @@ -11,6 +11,11 @@ Bottleneck 0.8.0

*Release date: Not yet released, in development*

This version of Bottleneck requires NumPy 1.8.

**Breaks from 0.7.0**
- This version of Bottleneck requires NumPy 1.8
- nanargmin and nanargmax behave like the corresponding functions in NumPy 1.8

Older versions
==============
Expand Down
10 changes: 7 additions & 3 deletions bottleneck/slow/func.py
@@ -1,4 +1,4 @@

import warnings
import numpy as np

__all__ = ['median', 'nanmedian', 'nansum', 'nanmean', 'nanvar', 'nanstd',
Expand Down Expand Up @@ -111,12 +111,16 @@ def nanmax(arr, axis=None):

def nanargmin(arr, axis=None):
"Slow nanargmin function used for unaccelerated ndim/dtype combinations."
return np.nanargmin(arr, axis=axis)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
return np.nanargmin(arr, axis=axis)


def nanargmax(arr, axis=None):
"Slow nanargmax function used for unaccelerated ndim/dtype combinations."
return np.nanargmax(arr, axis=axis)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
return np.nanargmax(arr, axis=axis)


def rankdata(arr, axis=None):
Expand Down
26,425 changes: 13,426 additions & 12,999 deletions bottleneck/src/func/func.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bottleneck/src/move/move.c
@@ -1,4 +1,4 @@
/* Generated by Cython 0.19.1 on Mon Sep 9 12:58:32 2013 */
/* Generated by Cython 0.19.1 on Wed Oct 2 13:16:47 2013 */

#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
Expand Down
9 changes: 3 additions & 6 deletions bottleneck/src/template/func/nanargmax.py
Expand Up @@ -41,7 +41,7 @@ def NAME_NDIMd_DTYPE_axisAXIS(np.ndarray[np.DTYPE_t, ndim=NDIM] a):
if allnan == 0:
return np.intp(idx)
else:
return NAN
return np.intp(np.iinfo('intp').min)
"""
loop[2] = """\
if nINDEX1 == 0:
Expand All @@ -59,7 +59,7 @@ def NAME_NDIMd_DTYPE_axisAXIS(np.ndarray[np.DTYPE_t, ndim=NDIM] a):
if allnan == 0:
y[INDEXPOP] = idx
else:
raise ValueError(CANNOTCONVERT)
y[INDEXPOP] = np.iinfo('intp').min
return y
"""
loop[3] = """\
Expand All @@ -79,7 +79,7 @@ def NAME_NDIMd_DTYPE_axisAXIS(np.ndarray[np.DTYPE_t, ndim=NDIM] a):
if allnan == 0:
y[INDEXPOP] = idx
else:
raise ValueError(CANNOTCONVERT)
y[INDEXPOP] = np.iinfo('intp').min
return y
"""

Expand Down Expand Up @@ -156,9 +156,6 @@ def NAME_NDIMd_DTYPE_axisAXIS(np.ndarray[np.DTYPE_t, ndim=NDIM] a):

nanargmax['main'] = '''"nanargmax auto-generated from template"
CANNOTCONVERT = "Bottleneck copies NumPy bahavior: "
CANNOTCONVERT += "'cannot convert float NaN to integer'"
def nanargmax(arr, axis=None):
"""
Indices of the maximum values along an axis, ignoring NaNs.
Expand Down
9 changes: 3 additions & 6 deletions bottleneck/src/template/func/nanargmin.py
Expand Up @@ -41,7 +41,7 @@ def NAME_NDIMd_DTYPE_axisAXIS(np.ndarray[np.DTYPE_t, ndim=NDIM] a):
if allnan == 0:
return np.intp(idx)
else:
return NAN
return np.intp(np.iinfo('intp').min)
"""
loop[2] = """\
if nINDEX1 == 0:
Expand All @@ -59,7 +59,7 @@ def NAME_NDIMd_DTYPE_axisAXIS(np.ndarray[np.DTYPE_t, ndim=NDIM] a):
if allnan == 0:
y[INDEXPOP] = idx
else:
raise ValueError(CANNOTCONVERT)
y[INDEXPOP] = np.iinfo('intp').min
return y
"""
loop[3] = """\
Expand All @@ -79,7 +79,7 @@ def NAME_NDIMd_DTYPE_axisAXIS(np.ndarray[np.DTYPE_t, ndim=NDIM] a):
if allnan == 0:
y[INDEXPOP] = idx
else:
raise ValueError(CANNOTCONVERT)
y[INDEXPOP] = np.iinfo('intp').min
return y
"""

Expand Down Expand Up @@ -156,9 +156,6 @@ def NAME_NDIMd_DTYPE_axisAXIS(np.ndarray[np.DTYPE_t, ndim=NDIM] a):

nanargmin['main'] = '''"nanargmin auto-generated from template"
CANNOTCONVERT = "Bottleneck copies NumPy bahavior: "
CANNOTCONVERT += "'cannot convert float NaN to integer'"
def nanargmin(arr, axis=None):
"""
Indices of the minimum values along an axis, ignoring NaNs.
Expand Down

0 comments on commit 9c5038e

Please sign in to comment.