diff --git a/setup.cfg b/setup.cfg index e7a940c..86ef1e4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -49,7 +49,7 @@ python_requires = >=3.8 # For more information, check out https://semver.org/. install_requires = importlib-metadata; python_version<"3.8" - dolomite-base>=0.2.0 + dolomite-base>=0.3.0 delayedarray>=0.5.0 h5py numpy diff --git a/src/dolomite_matrix/_optimize_storage.py b/src/dolomite_matrix/_optimize_storage.py index aa0b06c..bb2b598 100644 --- a/src/dolomite_matrix/_optimize_storage.py +++ b/src/dolomite_matrix/_optimize_storage.py @@ -242,7 +242,7 @@ def optimize_integer_storage(x, buffer_size: int = 1e8) -> _OptimizedStoragePara elif upper < 2**31 - 1: # Yes, this is deliberate, as integer storage maxes out at 32-bit signed integers. return _OptimizedStorageParameters(type="i4", placeholder=2**31-1, non_zero=attr.non_zero) - return _OptimizedStorageParameters(type="f8", placeholder=numpy.NaN, non_zero=attr.non_zero) + return _OptimizedStorageParameters(type="f8", placeholder=numpy.nan, non_zero=attr.non_zero) else: # If it's infinite, that means that 'x' is of length zero, otherwise @@ -497,7 +497,7 @@ def optimize_float_storage(x, buffer_size: int = 1e8) -> _OptimizedStorageParame placeholder = None if not attr.has_nan: - placeholder = numpy.NaN + placeholder = numpy.nan elif not attr.has_positive_inf: placeholder = numpy.inf elif not attr.has_negative_inf: diff --git a/tests/test_DelayedMask.py b/tests/test_DelayedMask.py index 1f14d74..011c267 100644 --- a/tests/test_DelayedMask.py +++ b/tests/test_DelayedMask.py @@ -32,8 +32,8 @@ def test_DelayedMask_dense(): def test_DelayedMask_dense_NaN(): - y = numpy.array([[1,2,numpy.NaN],[4,5,6]]) - m = dm.DelayedMask(y, numpy.NaN) + y = numpy.array([[1,2,numpy.nan],[4,5,6]]) + m = dm.DelayedMask(y, numpy.nan) block = delayedarray.to_dense_array(m) assert numpy.ma.is_masked(block) assert numpy.ma.is_masked(block[0,2]) diff --git a/tests/test_optimize_storage.py b/tests/test_optimize_storage.py index 5e05cdc..91a6229 100644 --- a/tests/test_optimize_storage.py +++ b/tests/test_optimize_storage.py @@ -270,7 +270,7 @@ def test_optimize_float_storage_dense(): assert opt.type == "f8" assert opt.placeholder is None - y = numpy.array([numpy.NaN,2,3]) + y = numpy.array([numpy.nan,2,3]) opt = optim.optimize_float_storage(y) assert opt.type == "f8" assert opt.placeholder is None @@ -354,33 +354,33 @@ def test_optimize_float_storage_dense_MaskedArray(): assert opt.type == "f8" assert numpy.isnan(opt.placeholder) - y = numpy.ma.MaskedArray([numpy.NaN,2,3], mask=[False, True, False]) + y = numpy.ma.MaskedArray([numpy.nan,2,3], mask=[False, True, False]) opt = optim.optimize_float_storage(y) assert opt.type == "f8" assert opt.placeholder == numpy.inf - y = numpy.ma.MaskedArray([numpy.NaN,2,numpy.inf], mask=[False, True, False]) + y = numpy.ma.MaskedArray([numpy.nan,2,numpy.inf], mask=[False, True, False]) opt = optim.optimize_float_storage(y) assert opt.type == "f8" assert opt.placeholder == -numpy.inf fstats = numpy.finfo(numpy.float64) - y = numpy.ma.MaskedArray([numpy.NaN, 2, numpy.inf, -numpy.inf], mask=[False, True, False, False]) + y = numpy.ma.MaskedArray([numpy.nan, 2, numpy.inf, -numpy.inf], mask=[False, True, False, False]) opt = optim.optimize_float_storage(y) assert opt.type == "f8" assert opt.placeholder == fstats.min - y = numpy.ma.MaskedArray([numpy.NaN, 2, numpy.inf, -numpy.inf, fstats.min], mask=[False, True, False, False, False]) + y = numpy.ma.MaskedArray([numpy.nan, 2, numpy.inf, -numpy.inf, fstats.min], mask=[False, True, False, False, False]) opt = optim.optimize_float_storage(y) assert opt.type == "f8" assert opt.placeholder == fstats.max - y = numpy.ma.MaskedArray([numpy.NaN, 2, numpy.inf, -numpy.inf, fstats.min, fstats.max], mask=[False, True, False, False, False, False]) + y = numpy.ma.MaskedArray([numpy.nan, 2, numpy.inf, -numpy.inf, fstats.min, fstats.max], mask=[False, True, False, False, False, False]) opt = optim.optimize_float_storage(y) assert opt.type == "f8" assert opt.placeholder == 0 - y = numpy.ma.MaskedArray([numpy.NaN, 2, numpy.inf, -numpy.inf, fstats.min, fstats.max, 0], mask=[False, True, False, False, False, False, False]) + y = numpy.ma.MaskedArray([numpy.nan, 2, numpy.inf, -numpy.inf, fstats.min, fstats.max, 0], mask=[False, True, False, False, False, False, False]) opt = optim.optimize_float_storage(y) assert opt.type == "f8" assert opt.placeholder == fstats.min / 2