implement weight function in fourier moments example