Skip to content

Commit eea6d2d

Browse files
authored
Allow newer numpy versions (#697)
* allow newer numpy versions * fix types * Merge branch 'master' of github.com:scalableminds/webknossos-libs into allow-new-numpy * do not use numpy.typing module which was introduced in 1.20 to remain backwards compatible * Merge branch 'master' into allow-new-numpy
1 parent 2c68b98 commit eea6d2d

File tree

5 files changed

+41
-44
lines changed

5 files changed

+41
-44
lines changed

wkcuber/poetry.lock

Lines changed: 31 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wkcuber/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ GitPython = "^3.0.5"
1919
imagecodecs = "^2020.5.30"
2020
natsort = "^6.2.0"
2121
nibabel = "^2.5.1"
22-
numpy = "1.19.5"
22+
numpy = "^1.19.5"
2323
pillow = ">=6.2.1,<9.0.0"
2424
requests = "^2.22.0"
2525
scikit-image = "^0.18.3"

wkcuber/tests/test_metadata.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,20 @@ def test_element_class_conversion(tmp_path: Path) -> None:
3838

3939
refresh_metadata(test_wkw_path)
4040

41-
check_element_class_of_layer(test_wkw_path, "prediction", "float", np.float32)
42-
check_element_class_of_layer(test_wkw_path, "segmentation", "double", np.float64)
43-
check_element_class_of_layer(test_wkw_path, "color", "uint24", np.uint8)
41+
check_element_class_of_layer(
42+
test_wkw_path, "prediction", "float", np.dtype(np.float32)
43+
)
44+
check_element_class_of_layer(
45+
test_wkw_path, "segmentation", "double", np.dtype(np.float64)
46+
)
47+
check_element_class_of_layer(test_wkw_path, "color", "uint24", np.dtype(np.uint8))
4448

4549

4650
def check_element_class_of_layer(
4751
test_wkw_path: Path,
4852
layer_name: str,
4953
expected_element_class: str,
50-
expected_dtype: type,
54+
expected_dtype: np.dtype,
5155
) -> None:
5256
datasource_properties = read_datasource_properties(test_wkw_path)
5357
layer_to_check = None

wkcuber/wkcuber/convert_nifti.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ def convert_nifti(
196196
# Writing wkw compressed requires files of shape (shard_size, shard_size, shard_size)
197197
# Pad data accordingly
198198
padding_offset = shard_size - np.array(cube_data.shape[1:4]) % shard_size
199-
padding_offset = (0, 0, 0)
200199
cube_data = np.pad(
201200
cube_data,
202201
(

wkcuber/wkcuber/convert_raw.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def _raw_chunk_converter(
143143
flip_axes: Optional[Union[int, Tuple[int, ...]]],
144144
) -> None:
145145
logging.info(f"Conversion of {bounding_box.topleft}")
146-
source_data = np.memmap(
146+
source_data: np.memmap = np.memmap(
147147
source_raw_path, dtype=input_dtype, mode="r", shape=(1,) + shape, order=order
148148
)
149149

0 commit comments

Comments
 (0)