From c04d211a08f94f9a8f736f94138e913fff4eb036 Mon Sep 17 00:00:00 2001 From: Callan Gray Date: Mon, 28 Oct 2024 13:06:24 +0800 Subject: [PATCH] add n5py complex tests --- include/z5/types/types.hxx | 6 ++++-- src/python/module/z5py/dataset.py | 5 ++++- src/python/test/test_compression.py | 3 ++- src/python/test/test_dataset.py | 9 ++++++--- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/include/z5/types/types.hxx b/include/z5/types/types.hxx index 99d6aead..9c45101b 100644 --- a/include/z5/types/types.hxx +++ b/include/z5/types/types.hxx @@ -57,14 +57,16 @@ namespace types { static DtypeMap & n5ToDtype() { static DtypeMap dtypeMap({{{"int8", int8}, {"int16", int16}, {"int32", int32}, {"int64", int64}, {"uint8", uint8}, {"uint16", uint16}, {"uint32", uint32}, {"uint64", uint64}, - {"float32", float32}, {"float64", float64}}}); + {"float32", float32}, {"float64", float64}, + {"complex64", complex64}, {"complex128", complex128}, {"complex256", complex256}}}); return dtypeMap; } static InverseDtypeMap & dtypeToN5() { static InverseDtypeMap dtypeMap({{{int8 ,"int8"}, {int16, "int16"}, {int32, "int32"}, {int64, "int64"}, {uint8 ,"uint8"}, {uint16, "uint16"}, {uint32,"uint32"}, {uint64, "uint64"}, - {float32,"float32"}, {float64, "float64"}}}); + {float32,"float32"}, {float64, "float64"}, + {complex64,"complex64"}, {complex128, "complex128"}, {complex256, "complex256"}}}); return dtypeMap; } }; diff --git a/src/python/module/z5py/dataset.py b/src/python/module/z5py/dataset.py index 1ab7012a..3b0cb4e9 100644 --- a/src/python/module/z5py/dataset.py +++ b/src/python/module/z5py/dataset.py @@ -31,7 +31,10 @@ class Dataset: np.dtype('int32'): 'int32', np.dtype('int64'): 'int64', np.dtype('float32'): 'float32', - np.dtype('float64'): 'float64'} + np.dtype('float64'): 'float64', + np.dtype('complex64'): 'complex64', + np.dtype('complex128'): 'complex128', + np.dtype('complex256'): 'complex256'} # Compression libraries supported by zarr format compressors_zarr = tuple(comp for comp in COMPRESSORS_ZARR if AVAILABLE_COMPRESSORS[comp]) diff --git a/src/python/test/test_compression.py b/src/python/test/test_compression.py index 65fce962..17fe2561 100644 --- a/src/python/test/test_compression.py +++ b/src/python/test/test_compression.py @@ -15,7 +15,8 @@ def setUp(self): self.dtypes = [ 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', - 'float32', 'float64' + 'float32', 'float64', # 'float128', + 'complex64', 'complex128', # 'complex256', ] def tearDown(self): diff --git a/src/python/test/test_dataset.py b/src/python/test/test_dataset.py index b23434c3..f9eeac1f 100644 --- a/src/python/test/test_dataset.py +++ b/src/python/test/test_dataset.py @@ -16,7 +16,8 @@ def setUp(self): self.base_dtypes = [ 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', - 'float32', 'float64' + 'float32', 'float64', # 'float128', + 'complex64', 'complex128', # 'complex256', ] self.dtypes = tuple( self.base_dtypes + @@ -24,12 +25,14 @@ def setUp(self): [ '