Factor out wavelet code
Smooth wavelet threshold