Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:badshah400:lapack2023:Leap15
python-tables
tables-pr862-lowercasefdtype.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File tables-pr862-lowercasefdtype.patch of Package python-tables
From 88668dcf041a52f0da51bee04da3c2f95eb69e41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sun, 24 Jan 2021 16:36:21 +0100 Subject: [PATCH 1/7] Use lowercase float/int as numpy dtype Float64 is gone with numpy 1.20, which causes doctests to fail (https://bugzilla.redhat.com/show_bug.cgi?id=1914335). Similarly all uses of Float32, Int32 should be replaced by float32 and int32. >>> numpy.__version__ '1.19.4' >>> [k for k in numpy.sctypeDict.keys() if str(k).lower().startswith('float')] ['float16', 'Float16', 'float32', 'Float32', 'float64', 'Float64', 'float128', 'Float128', 'float_', 'float'] >>> numpy.__version__ '1.20.0rc2' >>> [k for k in numpy.sctypeDict.keys() if str(k).lower().startswith('float')] ['float16', 'float32', 'float64', 'float128', 'float_', 'float'] --- bench/bsddb-table-bench.py | 10 +++++----- bench/postgres-search-bench.py | 4 ++-- bench/pytables-search-bench.py | 6 +++--- bench/recarray2-test.py | 2 +- bench/shelve-bench.py | 10 +++++----- bench/sqlite-search-bench.py | 4 ++-- tables/atom.py | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) Index: tables-3.6.1/bench/bsddb-table-bench.py =================================================================== --- tables-3.6.1.orig/bench/bsddb-table-bench.py +++ tables-3.6.1/bench/bsddb-table-bench.py @@ -83,11 +83,11 @@ def createFile(filename, totalrows, recs # Get the record object associated with the new table if recsize == "big": isrec = Big() - arr = np.array(np.arange(32), type=np.Float64) - arr2 = np.array(np.arange(32), type=np.Float64) + arr = np.array(np.arange(32), type=np.float64) + arr2 = np.array(np.arange(32), type=np.float64) elif recsize == "medium": isrec = Medium() - arr = np.array(np.arange(2), type=np.Float64) + arr = np.array(np.arange(2), type=np.float64) else: isrec = Small() # print d @@ -107,8 +107,8 @@ def createFile(filename, totalrows, recs #d['TDCcount'] = i % 256 d['ADCcount'] = (i * 256) % (1 << 16) if recsize == "big": - #d.float1 = np.array([i]*32, np.Float64) - #d.float2 = np.array([i**2]*32, np.Float64) + #d.float1 = np.array([i]*32, np.float64) + #d.float2 = np.array([i**2]*32, np.float64) arr[0] = 1.1 d['float1'] = arr arr2[0] = 2.2 Index: tables-3.6.1/bench/postgres-search-bench.py =================================================================== --- tables-3.6.1.orig/bench/postgres-search-bench.py +++ tables-3.6.1/bench/postgres-search-bench.py @@ -15,11 +15,11 @@ def flatten(l): def fill_arrays(start, stop): - col_i = numpy.arange(start, stop, type=numpy.Int32) + col_i = numpy.arange(start, stop, type=numpy.int32) if userandom: col_j = numpy.random.uniform(0, nrows, size=[stop - start]) else: - col_j = numpy.array(col_i, type=numpy.Float64) + col_j = numpy.array(col_i, type=numpy.float64) return col_i, col_j # Generator for ensure pytables benchmark compatibility Index: tables-3.6.1/bench/pytables-search-bench.py =================================================================== --- tables-3.6.1.orig/bench/pytables-search-bench.py +++ tables-3.6.1/bench/pytables-search-bench.py @@ -37,11 +37,11 @@ def create_db(filename, nrows): stop = (j + 1) * step if stop > nrows: stop = nrows - arr_f8 = np.arange(i, stop, type=np.Float64) - arr_i4 = np.arange(i, stop, type=np.Int32) + arr_f8 = np.arange(i, stop, type=np.float64) + arr_i4 = np.arange(i, stop, type=np.int32) if userandom: arr_f8 += np.random.normal(0, stop * scale, shape=[stop - i]) - arr_i4 = np.array(arr_f8, type=np.Int32) + arr_i4 = np.array(arr_f8, type=np.int32) recarr = np.rec.fromarrays([arr_i4, arr_i4, arr_f8, arr_f8]) table.append(recarr) j += 1 Index: tables-3.6.1/bench/recarray2-test.py =================================================================== --- tables-3.6.1.orig/bench/recarray2-test.py +++ tables-3.6.1/bench/recarray2-test.py @@ -22,7 +22,7 @@ delta = 0.000001 # Creation of recarrays objects for test x1 = np.array(np.arange(reclen)) x2 = chararray.array(None, itemsize=7, shape=reclen) -x3 = np.array(np.arange(reclen, reclen * 3, 2), np.Float64) +x3 = np.array(np.arange(reclen, reclen * 3, 2), np.float64) r1 = recarray.fromarrays([x1, x2, x3], names='a,b,c') r2 = recarray2.fromarrays([x1, x2, x3], names='a,b,c') Index: tables-3.6.1/bench/shelve-bench.py =================================================================== --- tables-3.6.1.orig/bench/shelve-bench.py +++ tables-3.6.1/bench/shelve-bench.py @@ -2,7 +2,7 @@ from __future__ import print_function from tables import * -import numpy as NA +import numpy as np import struct import sys import shelve @@ -45,8 +45,8 @@ class Medium(IsDescription): class Big(IsDescription): name = StringCol(itemsize=16) # 16-character String - #float1 = Float64Col(shape=32, dflt=NA.arange(32)) - #float2 = Float64Col(shape=32, dflt=NA.arange(32)) + #float1 = Float64Col(shape=32, dflt=np.arange(32)) + #float2 = Float64Col(shape=32, dflt=np.arange(32)) float1 = Float64Col(shape=32, dflt=range(32)) float2 = Float64Col(shape=32, dflt=[2.2] * 32) ADCcount = Int16Col() # signed short integer @@ -65,8 +65,8 @@ def createFile(filename, totalrows, recs # Get the record object associated with the new table if recsize == "big": d = Big() - arr = NA.array(NA.arange(32), type=NA.Float64) - arr2 = NA.array(NA.arange(32), type=NA.Float64) + arr = np.arange(32, dtype=np.float64) + arr2 = np.arange(32, dtype=np.float64) elif recsize == "medium": d = Medium() else: @@ -87,15 +87,15 @@ def createFile(filename, totalrows, recs #d.TDCcount = i % 256 d.ADCcount = (i * 256) % (1 << 16) if recsize == "big": - #d.float1 = NA.array([i]*32, NA.Float64) - #d.float2 = NA.array([i**2]*32, NA.Float64) + #d.float1 = np.array([i]*32, np.float64) + #d.float2 = np.array([i**2]*32, np.float64) arr[0] = 1.1 d.float1 = arr arr2[0] = 2.2 d.float2 = arr2 pass else: - d.float1 = NA.array([i ** 2] * 2, NA.Float64) + d.float1 = np.array([i ** 2] * 2, np.float64) #d.float1 = float(i) #d.float2 = float(i) d.grid_i = i Index: tables-3.6.1/bench/sqlite-search-bench.py =================================================================== --- tables-3.6.1.orig/bench/sqlite-search-bench.py +++ tables-3.6.1/bench/sqlite-search-bench.py @@ -136,10 +136,10 @@ CREATE INDEX ivar3 ON small(var3); if randomvalues: var3 = np.random.uniform(minimum, maximum, shape=[j - i]) else: - var3 = np.arange(i, j, type=np.Float64) + var3 = np.arange(i, j, type=np.float64) if noise: var3 += np.random.uniform(-3, 3, shape=[j - i]) - var2 = np.array(var3, type=np.Int32) + var2 = np.array(var3, type=np.int32) var1 = np.array(None, shape=[j - i], dtype='s4') if not heavy: for n in range(j - i): Index: tables-3.6.1/tables/atom.py =================================================================== --- tables-3.6.1.orig/tables/atom.py +++ tables-3.6.1/tables/atom.py @@ -338,7 +338,7 @@ class Atom(metaclass=MetaAtom): Traceback (most recent call last): ... ValueError: unknown NumPy scalar type: 'S5' - >>> Atom.from_sctype('Float64') + >>> Atom.from_sctype('float64') Float64Atom(shape=(), dflt=0.0) """ Index: tables-3.6.1/doc/source/cookbook/custom_data_types.rst =================================================================== --- tables-3.6.1.orig/doc/source/cookbook/custom_data_types.rst +++ tables-3.6.1/doc/source/cookbook/custom_data_types.rst @@ -65,9 +65,8 @@ Submitted by Kevin R. Thornton. if __name__ == '__main__': - x = np.array(np.random.rand(100)) - x=np.reshape(x,(50,2)) - x.dtype=[('x',np.float),('y',np.float)] + x = np.random.rand(100).reshape(50,2) + x.dtype = [('x',float), ('y',float)] h5file = tables.open_file('tester.hdf5', 'w') mtab = h5file.createDerivedFromTable(h5file.root, 'random', x) Index: tables-3.6.1/examples/array4.py =================================================================== --- tables-3.6.1.orig/examples/array4.py +++ tables-3.6.1/examples/array4.py @@ -9,7 +9,7 @@ fileh = tables.open_file(file, mode="w") # Get the root group group = fileh.root # Set the type codes to test -dtypes = [np.int8, np.uint8, np.int16, np.int, np.float32, np.float] +dtypes = [np.int8, np.uint8, np.int16, int, np.float32, float] i = 1 for dtype in dtypes: # Create an array of dtype, with incrementally bigger ranges Index: tables-3.6.1/tables/hdf5extension.pyx =================================================================== --- tables-3.6.1.orig/tables/hdf5extension.pyx +++ tables-3.6.1/tables/hdf5extension.pyx @@ -1447,7 +1447,7 @@ cdef class Array(Leaf): chunkshapes = getshape(self.rank, self.dims_chunk) # object arrays should not be read directly into memory - if atom.dtype != numpy.object: + if atom.dtype != object: # Get the fill value dflts = numpy.zeros((), dtype=atom.dtype) fill_data = dflts.data Index: tables-3.6.1/tables/tests/test_vlarray.py =================================================================== --- tables-3.6.1.orig/tables/tests/test_vlarray.py +++ tables-3.6.1/tables/tests/test_vlarray.py @@ -181,7 +181,7 @@ class BasicTestCase(common.TempFileMixin vlarray = self.h5file.get_node("/vlarray1") # Get a numpy array of objects - rows = numpy.array(vlarray[:], dtype=numpy.object) + rows = numpy.array(vlarray[:], dtype=object) for slc in [0, numpy.array(1), 2, numpy.array([3]), [4]]: # Read the rows in slc Index: tables-3.6.1/tables/tests/test_numpy.py =================================================================== --- tables-3.6.1.orig/tables/tests/test_numpy.py +++ tables-3.6.1/tables/tests/test_numpy.py @@ -462,7 +462,6 @@ class TableReadTestCase(common.TempFileM for colname in table.colnames: numcol = table.read(field=colname) typecol = table.coltypes[colname] - #nctypecode = np.typeNA[numcol.dtype.char[0]] nctypecode = np.sctypeDict[numcol.dtype.char[0]] if typecol != "string": if common.verbose: Index: tables-3.6.1/tables/utilsextension.pyx =================================================================== --- tables-3.6.1.orig/tables/utilsextension.pyx +++ tables-3.6.1/tables/utilsextension.pyx @@ -220,7 +220,7 @@ cdef str cstr_to_pystr(const char* cstri import_array() # NaN-aware sorting with NaN as the greatest element -# numpy.isNaN only takes floats, this should work for strings too +# numpy.isnan only takes floats, this should work for strings too cpdef nan_aware_lt(a, b): return a < b or (b != b and a == a) cpdef nan_aware_le(a, b): return a <= b or b != b cpdef nan_aware_gt(a, b): return a > b or (a != a and b == b) Index: tables-3.6.1/examples/tutorial2.py =================================================================== --- tables-3.6.1.orig/examples/tutorial2.py +++ tables-3.6.1/examples/tutorial2.py @@ -62,9 +62,8 @@ for tablename in ("TParticle1", "TPartic particle['lati'] = i particle['longi'] = 10 - i # Detectable errors start here. Play with them! - particle['pressure'] = np.array( - i * np.arange(2 * 3)).reshape((2, 4)) # Incorrect - # particle['pressure'] = array(i*arange(2*3)).reshape((2,3)) # Correct + particle['pressure'] = i * np.arange(2 * 4).reshape(2, 4) # Incorrect + # particle['pressure'] = i * arange(2 * 3).reshape(2, 3) # Correct # End of errors particle['temperature'] = (i ** 2) # Broadcasting # This injects the Record values
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor