Get boolean masks of descents and ascents in the depth data

    Args
    ----
    dive_mask: ndarray
        Boolean mask array over depth data. Cells with `True` are dives and
        cells with `False` are not.
    pitch: ndarray
        Pitch angle in radians
    cutoff: float
        Cutoff frequency at which signal will be filtered
    fs: float
        Sampling frequency
    order: int
        Order of butter filter to apply

    Returns
    -------
    des_mask: ndarray
        Boolean mask of descents in the depth data
    asc_mask: ndarray
        Boolean mask of ascents in the depth data

def get_des_asc2(depths, dive_mask, pitch, cutoff, fs, order=5):
    '''Get boolean masks of descents and ascents in the depth data

    Args
    ----
    dive_mask: ndarray
        Boolean mask array over depth data. Cells with `True` are dives and
        cells with `False` are not.
    pitch: ndarray
        Pitch angle in radians
    cutoff: float
        Cutoff frequency at which signal will be filtered
    fs: float
        Sampling frequency
    order: int
        Order of butter filter to apply

    Returns
    -------
    des_mask: ndarray
        Boolean mask of descents in the depth data
    asc_mask: ndarray
        Boolean mask of ascents in the depth data
    '''
    import numpy

    from . import dsp

    asc_mask = numpy.zeros(len(depths), dtype=bool)
    des_mask = numpy.zeros(len(depths), dtype=bool)

    b, a = dsp.butter_filter(cutoff, fs, order, 'low')
    dfilt = dsp.butter_apply(b, a, depths)

    dp = numpy.hstack([numpy.diff(dfilt), 0])

    asc_mask[dive_mask] = dp[dive_mask] < 0
    des_mask[dive_mask] = dp[dive_mask] > 0

    # Remove descents/ascents withough a corresponding ascent/descent
    des_mask, asc_mask = rm_incomplete_des_asc(des_mask, asc_mask)

    return des_mask, asc_mask