Skip to content

Commit

Permalink
MIN+RLS Release 1.4.5
Browse files Browse the repository at this point in the history
Upgrade to newer NumPy API and remove deprecation warning (future
proofing).

close #95
  • Loading branch information
luispedro committed Oct 20, 2018
1 parent a8404d5 commit ea2d9ed
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 8 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
@@ -1,3 +1,6 @@
Version 1.4.5 2018-10-20 by luispedro
* Fix deprecation warning with numpy float detection (issue #95)

Version 1.4.4 2017-11-05 by luispedro
* Fix bug in Bernsen thresholding (issue #84)

Expand Down
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -220,6 +220,9 @@ questions.

## Recent Changes

### Version 1.4.5 (Oct 20 2018)
- Upgrade code to newer NumPy API (issue #95)

### Version 1.4.4 (Nov 5 2017)
- Fix bug in Bernsen thresholding (issue #84)

Expand Down
4 changes: 4 additions & 0 deletions docs/source/history.rst
Expand Up @@ -2,6 +2,10 @@
History
=======

Version 1.4.5 (Oct 20 2018)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Upgrade code to newer NumPy API (issue #95)

Version 1.4.4 (Nov 5 2017)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fix bug in Bernsen thresholding (issue #84)
Expand Down
4 changes: 2 additions & 2 deletions mahotas/features/moments.py
@@ -1,4 +1,4 @@
# Copyright (C) 2008-2012, Luis Pedro Coelho <luis@luispedro.org>
# Copyright (C) 2008-2018, Luis Pedro Coelho <luis@luispedro.org>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# License: MIT (see COPYING file)
Expand Down Expand Up @@ -52,7 +52,7 @@ def moments(img, p0, p1, cm=None, convert_to_float=True, normalize=False, normal
'''
if normalise:
normalize = True
if not np.issubdtype(img.dtype, float) and convert_to_float:
if not np.issubdtype(img.dtype, np.floating) and convert_to_float:
img = img.astype(np.float64)
r,c = img.shape
p = np.arange(c, dtype=float)
Expand Down
8 changes: 4 additions & 4 deletions mahotas/internal.py
@@ -1,4 +1,4 @@
# Copyright (C) 2011-2014, Luis Pedro Coelho <luis@luispedro.org>
# Copyright (C) 2011-2018, Luis Pedro Coelho <luis@luispedro.org>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# License: MIT (see COPYING file)
Expand Down Expand Up @@ -109,8 +109,8 @@ def _verify_is_floatingpoint_type(A, function_name):
function_name : str
Used for error messages
'''
if not np.issubdtype(A.dtype, np.float):
raise TypeError('mahotas.%s: This function only accepts floating-point types (passed array of type %s)' % (function_name, A.dtype))
if not np.issubdtype(A.dtype, np.floating):
raise TypeError('mahotas.{}: This function only accepts floating-point types (passed array of type {})'.format(function_name, A.dtype))

def _verify_is_integer_type(A, function_name):
'''
Expand Down Expand Up @@ -164,7 +164,7 @@ def _as_floating_point_array(array):
Returns (possibly a copy) of array as a floating-point array
'''
array = np.asanyarray(array)
if not np.issubdtype(array.dtype, np.float_):
if not np.issubdtype(array.dtype, np.floating):
return array.astype(np.double)
return array

Expand Down
2 changes: 1 addition & 1 deletion mahotas/mahotas_version.py
@@ -1 +1 @@
__version__ = '1.4.4'
__version__ = '1.4.5'
2 changes: 1 addition & 1 deletion mahotas/tests/test_internal.py
Expand Up @@ -122,7 +122,7 @@ def check_int(arr):
def test_as_floating_point_array():
def check_arr(data):
array = _as_floating_point_array(data)
assert np.issubdtype(array.dtype, np.float_)
assert np.issubdtype(array.dtype, np.floating)

yield check_arr, np.arange(8, dtype=np.int8)
yield check_arr, np.arange(8, dtype=np.int16)
Expand Down

0 comments on commit ea2d9ed

Please sign in to comment.