Skip to content

Commit

Permalink
misc with test io
Browse files Browse the repository at this point in the history
  • Loading branch information
Henley13 committed May 5, 2020
1 parent 5f02000 commit 65483ba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions bigfish/stack/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def read_image(path, sanity_check=False):
check_array(image,
dtype=[np.uint8, np.uint16, np.uint32,
np.int8, np.int16, np.int32,
np.float32, np.float64,
np.float16, np.float32, np.float64,
bool],
ndim=[2, 3, 4, 5],
allow_nan=False)
Expand Down Expand Up @@ -116,7 +116,7 @@ def read_array(path, sanity_check=False):
check_array(array,
dtype=[np.uint8, np.uint16, np.uint32,
np.int8, np.int16, np.int32, np.int64,
np.float32, np.float64,
np.float16, np.float32, np.float64,
bool],
ndim=[2, 3, 4, 5],
allow_nan=False)
Expand All @@ -130,7 +130,7 @@ def save_image(image, path, extension="tif"):
"""Save an image.
The input image should have between 2 and 5 dimensions, with boolean,
8-bit, 16-bit or 32-bit (unsigned) integer, 32-bit or 64-bit float.
8-bit, 16-bit or 32-bit (unsigned) integer, 16-bit, 32-bit or 64-bit float.
The dimensions should be in the following order: (round, channel, z, y, x).
Expand Down Expand Up @@ -165,7 +165,7 @@ def save_image(image, path, extension="tif"):
check_array(image,
dtype=[np.uint8, np.uint16, np.uint32,
np.int8, np.int16, np.int32,
np.float32, np.float64,
np.float16, np.float32, np.float64,
bool],
ndim=[2, 3, 4, 5],
allow_nan=False)
Expand Down Expand Up @@ -220,8 +220,8 @@ def save_array(array, path):
"""Save an array.
The input array should have between 2 and 5 dimensions, with boolean,
8-bit, 16-bit or 32-bit (unsigned) integer, 64-bit integer, 32-bit or
64-bit float.
8-bit, 16-bit or 32-bit (unsigned) integer, 64-bit integer, 16-bit, 32-bit
or 64-bit float.
Parameters
----------
Expand All @@ -240,10 +240,10 @@ def save_array(array, path):
check_array(array,
dtype=[np.uint8, np.uint16, np.uint32,
np.int8, np.int16, np.int32, np.int64,
np.float32, np.float64,
np.float16, np.float32, np.float64,
bool],
ndim=[2, 3, 4, 5],
allow_nan=False)
allow_nan=True)
if "." in path and "npy" not in path:
path_ = path.split(".")[0]
path = path_ + ".npy"
Expand Down
8 changes: 4 additions & 4 deletions tests/stack/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
@pytest.mark.parametrize("dtype", [
np.uint8, np.uint16, np.uint32,
np.int8, np.int16, np.int32,
np.float32, np.float64, bool])
np.float16, np.float32, np.float64, bool])
@pytest.mark.parametrize("extension", [
"png", "jpg", "jpeg", "tif", "tiff"])
def test_io(shape, dtype, extension):
def test_image(shape, dtype, extension):
# build a temporary directory and save tensors inside
with tempfile.TemporaryDirectory() as tmp_dir:
test = np.zeros(shape, dtype=dtype)
Expand Down Expand Up @@ -68,7 +68,7 @@ def test_io(shape, dtype, extension):
assert test.dtype == tensor.dtype


def test_io_specific():
def test_image_specific():
# build a temporary directory and save tensors inside
with tempfile.TemporaryDirectory() as tmp_dir:
# non-supported image (1 dimension)
Expand Down Expand Up @@ -126,7 +126,7 @@ def test_dv(dtype):
@pytest.mark.parametrize("dtype", [
np.uint8, np.uint16, np.uint32,
np.int8, np.int16, np.int32, np.int64,
np.float32, np.float64, bool])
np.float16, np.float32, np.float64, bool])
def test_npy(shape, dtype):
# build a temporary directory and save tensors inside
with tempfile.TemporaryDirectory() as tmp_dir:
Expand Down

0 comments on commit 65483ba

Please sign in to comment.