def get_transitions(data_vals, threshold):
    """
    Find the high-to-low and low-to-high state transistions
    """
    pend_len, time_vals, sens_vals = data_vals

    # Find transistion pairs
    trans_pairs = []
    for i in range(1,time_vals.shape[0]):
        if sens_vals[i-1] >= threshold and sens_vals[i] < threshold:
            before_vals= (time_vals[i-1], sens_vals[i-1])
            after_vals = (time_vals[i], sens_vals[i])
            trans_pairs.append((before_vals, after_vals))
    return trans_pairs