n = 2
w = 'db1'
coeffs = pywt.wavedec2(B,wavelet=w,level=n)
coeffs[0] /= np.abs(coeffs[0]).max()
for detail_level in range(n):
coeffs[detail_level + 1] = [d/np.abs(d).max() for d in coeffs[detail_level + 1]]
arr, coeff_slices = pywt.coeffs_to_array(coeffs)
plt.imshow(arr,cmap='gray',vmin=-0.25,vmax=0.75)
plt.show()