npy_printoptions

odl.util.utility.npy_printoptions(\*\*extra_opts)[source]

Context manager to temporarily set NumPy print options.

Examples

>>> print(np.array([np.nan, 1.00001]))
[     nan  1.00001]
>>> with npy_printoptions(precision=3):
...     print(np.array([np.nan, 1.00001]))
[ nan   1.]
>>> with npy_printoptions(nanstr='whoah!'):
...     print(np.array([np.nan, 1.00001]))
[  whoah!  1.00001]