Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warnings from skimage.io module in test suite #5337

Closed
grlee77 opened this issue Apr 18, 2021 · 2 comments · Fixed by #6460
Closed

warnings from skimage.io module in test suite #5337

grlee77 opened this issue Apr 18, 2021 · 2 comments · Fixed by #6460
Labels
🔧 type: Maintenance Refactoring and maintenance of internals

Comments

@grlee77
Copy link
Contributor

grlee77 commented Apr 18, 2021

Description

The following test suite warnings were observed for the main branch while working on #5336

skimage/io/tests/test_collection.py::TestImageCollection::test_concatenate
skimage/io/tests/test_collection.py::TestImageCollection::test_concatenate_mismatched_image_shapes
skimage/io/tests/test_collection.py::TestImageCollection::test_getitem
skimage/io/tests/test_collection.py::TestImageCollection::test_multiimage_imagecollection
skimage/io/tests/test_collection.py::TestImageCollection::test_slicing
  /home/lee8rx/my_git/pyir/scikit-image/skimage/io/collection.py:292: ResourceWarning: unclosed file <_io.BufferedReader name='/home/lee8rx/.cache/scikit-image/main/data/brick.png'>
    raise

skimage/io/tests/test_collection.py::TestImageCollection::test_concatenate
skimage/io/tests/test_collection.py::TestImageCollection::test_multiimage_imagecollection
  /home/lee8rx/my_git/pyir/scikit-image/skimage/io/collection.py:292: ResourceWarning: unclosed file <_io.BufferedReader name='/home/lee8rx/.cache/scikit-image/main/data/moon.png'>
    raise

skimage/io/tests/test_collection.py::TestImageCollection::test_concatenate_mismatched_image_shapes
skimage/io/tests/test_collection.py::TestImageCollection::test_getitem
skimage/io/tests/test_collection.py::TestImageCollection::test_slicing
  /home/lee8rx/my_git/pyir/scikit-image/skimage/io/collection.py:292: ResourceWarning: unclosed file <_io.BufferedReader name='/home/lee8rx/.cache/scikit-image/main/data/color.png'>
    raise

skimage/io/tests/test_imageio.py::test_imageio_truncated_jpg
  /home/lee8rx/my_git/pyir/scikit-image/skimage/io/tests/test_imageio.py:41: ResourceWarning: unclosed file <_io.BufferedReader name='/home/lee8rx/.cache/scikit-image/main/data/truncated.jpg'>
    imread(fetch('data/truncated.jpg'))

skimage/io/tests/test_tifffile.py::test_tifffile_kwarg_passthrough
  /home/lee8rx/miniconda3/envs/skimage_dev/lib/python3.8/site-packages/tifffile/tifffile.py:2876: DeprecationWarning: TiffFile: the 'fastij' argument is ignored
    warnings.warn(

skimage/io/tests/test_tifffile.py::test_tifffile_kwarg_passthrough
  /home/lee8rx/miniconda3/envs/skimage_dev/lib/python3.8/site-packages/tifffile/tifffile.py:2876: DeprecationWarning: TiffFile: the 'multifile' argument is ignored
    warnings.warn(

skimage/io/tests/test_tifffile.py::test_tifffile_kwarg_passthrough
  /home/lee8rx/miniconda3/envs/skimage_dev/lib/python3.8/site-packages/tifffile/tifffile.py:2876: DeprecationWarning: TiffFile: the 'multifile_close' argument is ignored
    warnings.warn(
@grlee77 grlee77 added the 🔧 type: Maintenance Refactoring and maintenance of internals label Apr 18, 2021
@mkcor
Copy link
Member

mkcor commented Mar 16, 2022

On current main there are no more ResourceWarnings but the DeprecationWarnings related to TiffFile (version 2022.2.9) in skimage.io have grown to:

scikit-image/skimage/io/tests/test_pil.py::test_imread_separate_channels
  /opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/site-packages/tifffile/tifffile.py:984: DeprecationWarning: <tifffile.TiffWriter.write> data with shape (3, 16, 8) and dtype 'float64' are stored as RGB with separate component planes. Future versions will store such data as MINISBLACK in separate pages by default unless the 'photometric' and 'planarconfig' parameters are specified.
    result = tif.write(data, shape, dtype, **kwargs)

scikit-image/skimage/io/tests/test_tifffile.py::test_tifffile_kwarg_passthrough
  /opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/site-packages/tifffile/tifffile.py:908: DeprecationWarning: <tifffile.TiffFile> the 'fastij' argument is ignored
    with TiffFile(files, **kwargs_file) as tif:

scikit-image/skimage/io/tests/test_tifffile.py::test_tifffile_kwarg_passthrough
  /opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/site-packages/tifffile/tifffile.py:908: DeprecationWarning: <tifffile.TiffFile> the 'multifile' argument is ignored
    with TiffFile(files, **kwargs_file) as tif:

scikit-image/skimage/io/tests/test_tifffile.py::test_tifffile_kwarg_passthrough
  /opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/site-packages/tifffile/tifffile.py:908: DeprecationWarning: <tifffile.TiffFile> the 'multifile_close' argument is ignored
    with TiffFile(files, **kwargs_file) as tif:

scikit-image/skimage/io/tests/test_tifffile.py::TestSave::test_imsave_roundtrip[False-float32-shape1]
scikit-image/skimage/io/tests/test_tifffile.py::TestSave::test_imsave_roundtrip[True-float32-shape1]
  /opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/site-packages/tifffile/tifffile.py:984: DeprecationWarning: <tifffile.TiffWriter.write> data with shape (10, 10, 3) and dtype 'float32' are stored as RGB with contiguous samples. Future versions will store such data as MINISBLACK in separate pages by default unless the 'photometric' parameter is specified.
    result = tif.write(data, shape, dtype, **kwargs)

scikit-image/skimage/io/tests/test_tifffile.py::TestSave::test_imsave_roundtrip[False-float32-shape2]
scikit-image/skimage/io/tests/test_tifffile.py::TestSave::test_imsave_roundtrip[True-float32-shape2]
  /opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/site-packages/tifffile/tifffile.py:984: DeprecationWarning: <tifffile.TiffWriter.write> data with shape (10, 10, 4) and dtype 'float32' are stored as RGB with contiguous samples. Future versions will store such data as MINISBLACK in separate pages by default unless the 'photometric' parameter is specified.
    result = tif.write(data, shape, dtype, **kwargs)

scikit-image/skimage/io/tests/test_tifffile.py::TestSave::test_imsave_roundtrip[False-int16-shape1]
scikit-image/skimage/io/tests/test_tifffile.py::TestSave::test_imsave_roundtrip[True-int16-shape1]
  /opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/site-packages/tifffile/tifffile.py:984: DeprecationWarning: <tifffile.TiffWriter.write> data with shape (10, 10, 3) and dtype 'int16' are stored as RGB with contiguous samples. Future versions will store such data as MINISBLACK in separate pages by default unless the 'photometric' parameter is specified.
    result = tif.write(data, shape, dtype, **kwargs)

scikit-image/skimage/io/tests/test_tifffile.py::TestSave::test_imsave_roundtrip[False-int16-shape2]
scikit-image/skimage/io/tests/test_tifffile.py::TestSave::test_imsave_roundtrip[True-int16-shape2]
  /opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/site-packages/tifffile/tifffile.py:984: DeprecationWarning: <tifffile.TiffWriter.write> data with shape (10, 10, 4) and dtype 'int16' are stored as RGB with contiguous samples. Future versions will store such data as MINISBLACK in separate pages by default unless the 'photometric' parameter is specified.
    result = tif.write(data, shape, dtype, **kwargs)

scikit-image/skimage/io/tests/test_tifffile.py::TestSave::test_imsave_roundtrip[False-float64-shape1]
scikit-image/skimage/io/tests/test_tifffile.py::TestSave::test_imsave_roundtrip[True-float64-shape1]
  /opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/site-packages/tifffile/tifffile.py:984: DeprecationWarning: <tifffile.TiffWriter.write> data with shape (10, 10, 3) and dtype 'float64' are stored as RGB with contiguous samples. Future versions will store such data as MINISBLACK in separate pages by default unless the 'photometric' parameter is specified.
    result = tif.write(data, shape, dtype, **kwargs)

scikit-image/skimage/io/tests/test_tifffile.py::TestSave::test_imsave_roundtrip[False-float64-shape2]
scikit-image/skimage/io/tests/test_tifffile.py::TestSave::test_imsave_roundtrip[True-float64-shape2]
  /opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/site-packages/tifffile/tifffile.py:984: DeprecationWarning: <tifffile.TiffWriter.write> data with shape (10, 10, 4) and dtype 'float64' are stored as RGB with contiguous samples. Future versions will store such data as MINISBLACK in separate pages by default unless the 'photometric' parameter is specified.
    result = tif.write(data, shape, dtype, **kwargs)

@grlee77
Copy link
Contributor Author

grlee77 commented Mar 16, 2022

Thanks @mkcor, to summarize these, it looks like most are of this type.

DeprecationWarning: <tifffile.TiffWriter.write> 
data with shape (3, 16, 8) and dtype 'float64' are stored as RGB with separate component planes.
Future versions will store such data as MINISBLACK in separate pages by default unless the
'photometric' and 'planarconfig' parameters are specified.

We need to decide if we should be adding one of these new kwargs for backwards compatibility or if our policy is just to dispatch to whatever the tifffile defaults are when writing unless the user supplies kwargs. Do other @skimage/core devs more familiar with skimage.io have an opinion here?

The others just look like we are testing with some deprecated kwargs, so we should be able to address that pretty easily in the test suite.:
DeprecationWarning: <tifffile.TiffFile> the 'fastij' argument is ignored
DeprecationWarning: <tifffile.TiffFile> the 'multifile' argument is ignored
DeprecationWarning: <tifffile.TiffFile> the 'multifile_close' argument is ignored

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔧 type: Maintenance Refactoring and maintenance of internals
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants