Python calculate signal to noise ratio