def METHOD_NAME(meas, tol=.1):
    n_iters = 0
    dm_old = 5e12
    dm = 4e12
    mm = np.nanmean(meas, 0)
    while ((dm_old - dm) > tol) and (n_iters < 50):
        dm_old = dm
        mm = np.nanmean(meas, 0)
        d = np.nanmean(meas - mm, 1)
        dm = sum(d ** 2)
        meas = meas - d[:, None]
        n_iters += 1
        print('%s, %s' % (n_iters, dm))
    mm = np.nanmean(meas, 0)
    print('Finished: %d, %f' %( n_iters, dm))
    return mm