def plot(subject, data_path, write_dir, scale):
    d = load_train_data(data_path, subject)
    x, y, filename_to_idx = d['x'], d['y'], d['filename_to_idx']
    if scale:
        x, _ = scale_across_time(x=x)

    filenames_grouped_by_hour = cPickle.load(open('filenames.pickle'))
    preictal_hours = copy.deepcopy(filenames_grouped_by_hour[subject]['preictal'])
    interictal_hours = copy.deepcopy(filenames_grouped_by_hour[subject]['interictal'])

    plot_hour_means(x, filename_to_idx, preictal_hours, type='preictal', write_dir=write_dir)
    plot_hour_means(x, filename_to_idx, interictal_hours[:10], type='interictal', write_dir=write_dir)
def plot_examples(subject, data_path, scale):
    d = load_train_data(data_path, subject)
    x, y, filename_to_idx = d["x"], d["y"], d["filename_to_idx"]
    if scale:
        x, _ = scale_across_time(x=x)

    filename = "Dog_1/Dog_1_interictal_segment_0001.mat"
    idx = filename_to_idx[filename]
    print filename_to_idx

    fig = plt.figure()
    fig.suptitle(filename)
    print x[idx].shape
    for i in range(x[idx].shape[0]):
        fig.add_subplot(4, 4, i)
        plt.imshow(x[idx, i, :, :], aspect="auto", origin="lower", interpolation="none")
        plt.colorbar()
    plt.show()