def METHOD_NAME(data, Delta=100., **kwargs):
    assert Delta > 0.
    med = np.median(data[~np.isnan(data)])
    if not 0 <= med <= 1e+4:
        raise RuntimeError('MBS profile is not well defined: Check for ' +\
        'possible disconnected components in the PDB structure and remove them.')
    # compute median of |distances from median|
    dists = np.abs(data - med)
    mdev = np.median(dists[~np.isnan(dists)])
    # replace entries with 'nan' if outside the "safe"
    # interval (median - Delta*mdev, median + Delta*mdev)
    Delta_mdev = Delta * mdev
    for i, dist in enumerate(dists):
        if np.isnan(dist) or dist>Delta_mdev:
            data[i] = np.nan
    return data 