def short_time_haar(x, window_len=4096, window_shift=2048):
    w = list(x[0:len(x) - len(x) % window_shift])
    transformed = []
    for t in range(0, (len(w) - window_len)/window_shift + 1):
        window_haar = haar_transform.haar(w[window_shift * t: window_shift * t + window_len])
        transformed.append(window_haar)
    return scipy.array(transformed)
                    negative[j] = data[i]
                    n_entries[negative[j]] = i + base
                    break
            negative.sort(reverse=True)

    return p_entries, n_entries

if __name__ == '__main__':
    f = open(os.path.join(dir, file_name), 'r')

    # Get just the displacement in the x coordinate
    x = []
    for line in f:
        x.append(float(line.split(',')[6]))

    haar_x = haar_transform.haar(haar_transform.trim_n2(x))
    positive_largest, negative_largest = find_edges(haar_x[len(haar_x)/2:], len(haar_x)/2, 5)

    haar_x1 = smooth(haar_x, 1)
    haar_x2 = smooth(haar_x, 2)
    haar_x3 = smooth(haar_x, 3)
    haar_x4 = smooth(haar_x, 4)

    #Graph it, and save figure as a .png
    graph_accel(x)
    graph_accel(haar_x)
    graph_accel(haar_transform.inverse_haar(haar_x))
    graph_accel(haar_transform.inverse_haar(haar_x1))
    graph_accel(haar_transform.inverse_haar(haar_x2))
    graph_accel(haar_transform.inverse_haar(haar_x3))
    graph_accel(haar_transform.inverse_haar(haar_x4))