latools/filtering/filters.py
def exclude_downhole(filt, threshold=2):
    """
    Exclude all data after the first excluded portion.

    This makes sense for spot measurements where, because
    of the signal mixing inherent in LA-ICPMS, once a
    contaminant is ablated, it will always be present to
    some degree in signals from further down the ablation
    pit.

    Parameters
    ----------
    filt : boolean array
    threshold : int

    Returns
    -------
    filter : boolean array
    """
    cfilt = filt.copy()

    inds = bool_2_indices(~filt)

    rem = (np.diff(inds) >= threshold)[:, 0]

    if any(rem):
        if inds[rem].shape[0] > 1:
            limit = inds[rem][1, 0]
            cfilt[limit:] = False
    
    return cfilt
def exclude_downhole(filt, threshold=2):
    """
    Exclude all data after the first excluded portion.

    This makes sense for spot measurements where, because
    of the signal mixing inherent in LA-ICPMS, once a
    contaminant is ablated, it will always be present to
    some degree in signals from further down the ablation
    pit.

    Parameters
    ----------
    filt : boolean array
    threshold : int

    Returns
    -------
    filter : boolean array
    """
    cfilt = filt.copy()

    inds = bool_2_indices(~filt)

    rem = (np.diff(inds) >= threshold)[:, 0]

    if any(rem):
        if inds[rem].shape[0] > 1:
            limit = inds[rem][1, 0]
            cfilt[limit:] = False
    
    return cfilt
Exclude all data after the first excluded portion.

    This makes sense for spot measurements where, because
    of the signal mixing inherent in LA-ICPMS, once a
    contaminant is ablated, it will always be present to
    some degree in signals from further down the ablation
    pit.

    Parameters
    ----------
    filt : boolean array
    threshold : int

    Returns
    -------
    filter : boolean array