keep NaN's for rms, replace with 0's for smoothing