Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to silence the UserWarning from scipy.ndimage.zoom

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?

like image 931
filippo Avatar asked Dec 17 '17 13:12

filippo


Video Answer


1 Answers

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.*')
like image 147
filippo Avatar answered Sep 27 '22 20:09

filippo