def get_stroke_glide_indices(A_g_hf, fs_a, J, t_max):
    """Get stroke and glide indices from high-pass accelerometer data

    Args
    ----
    A_g_hf: 1-D ndarray
        Animal frame triaxial accelerometer matrix at sampling rate fs_a.

    fs_a: int
        Number of accelerometer samples per second

    J: float
        Frequency threshold for detecting a fluke stroke in m/s^2.  If J is not
        given, fluke strokes will not be located but the rotations signal (pry)
        will be computed.

    t_max: int
        Maximum duration allowable for a fluke stroke in seconds.  A fluke
        stroke is counted whenever there is a cyclic variation in the pitch
        deviation with peak-to-peak magnitude greater than +/-J and consistent
        with a fluke stroke duration of less than t_max seconds, e.g., for
        Mesoplodon choose t_max=4.

    Returns
    -------
    GL: 1-D ndarray
        Matrix containing the start time (first column) and end time (2nd
        column) of any glides (i.e., no zero crossings in t_max or more
        seconds). Times are in seconds.

    Note
    ----
    If no J or t_max is given, J=[], or t_max=[], GL returned as None
    """
    import numpy
    from . import dsp
    if A_g_hf.ndim > 1:
        raise IndexError(
            'A_g_hf multidimensional: Glide index determination requires 1-D acceleration array as input'
            )
    n_max = t_max * fs_a
    zc = dsp.findzc(A_g_hf, J, n_max / 2)
    ind = numpy.where(zc[1:, (0)] - zc[0:-1, (1)] > n_max)[0]
    gl_ind = numpy.vstack([zc[ind, 0] - 1, zc[ind + 1, 1] + 1]).T
    gl_mean_idx = numpy.round(numpy.mean(gl_ind, 1)).astype(int)
    gl_ind = numpy.round(gl_ind).astype(int)
    for i in range(len(gl_mean_idx)):
        col = range(gl_mean_idx[i], gl_ind[i, 0], -1)
        test = numpy.where(numpy.isnan(A_g_hf[col]))[0]
        if test.size != 0:
            gl_mean_idx[i] = numpy.nan
            gl_ind[i, 0] = numpy.nan
            gl_ind[i, 1] = numpy.nan
        else:
            over_J1 = numpy.where(abs(A_g_hf[col]) >= J)[0][0]
            gl_ind[i, 0] = gl_mean_idx[i] - over_J1 + 1
            col = range(gl_mean_idx[i], gl_ind[i, 1])
            over_J2 = numpy.where(abs(A_g_hf[col]) >= J)[0][0]
            gl_ind[i, 1] = gl_mean_idx[i] + over_J2 - 1
    GL = gl_ind
    GL = GL[(numpy.where(GL[:, (1)] - GL[:, (0)] > n_max / 2)[0]), :]
    return GL
