def find_0_crossings(signal, start_pos, rising_falling=''):
    """
    Find all indices at which the <signal> vector crosses the 0 axis.

    If <rising_falling> is 'rising', report only ascending crossings of the 0 axis
    If <rising_falling> is 'falling', report only descending crossings of the 0 axis
    """
    if rising_falling:
        assert rising_falling in ('rising', 'falling')
    crossings = []
    prev_val = signal[start_pos]
    for i in range(start_pos, len(signal)):
        if rising_falling == 'rising' or not rising_falling:
            if prev_val <= 0 and signal[i] > 0:
                crossings.append(i)
        elif rising_falling == 'falling' or not rising_falling:
            if prev_val >= 0 and signal[i] < 0:
                crossings.append(i)
        prev_val = signal[i]
    return crossings
