6

I'm using scipy.ndimage.zoom and I get this annoying warning:

UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.

I'm not sure what I should get from it, I started using it with SciPy 1.0.0 so I don't believe it really affects me.

I guess calling it UserWarning is a bit questionable given it's not intended for user consumption, but maybe the intended user is the developer importing the library.

I'm using multiprocessing and I get one warning per process, even more annoying.

Is there a sane way to silent it?

cxrodgers
  • 4,317
  • 2
  • 23
  • 29
filippo
  • 5,197
  • 2
  • 21
  • 44

2 Answers2

11

It was easier than I thought, leaving the question for future reference in case anyone needs this.

import warnings
warnings.filterwarnings('ignore', '.*output shape of zoom.*')
filippo
  • 5,197
  • 2
  • 21
  • 44
2

Your proposed solution did not work for me. But what does work is:

  import warnings

  # other nice code

  with warnings.catch_warnings():
       warnings.simplefilter("ignore")
       x = scipy.ndimage.interpolation.zoom(...)
Maikefer
  • 570
  • 1
  • 8
  • 21