added code to compute noise covariances from data