Example #1
0
def plot_hist(str_name, save_name='dist'):
    data_array = utils.get_data(str_name)
    params = np.squeeze(np.array(data_array['information']))
    ind_array = data_array['params']['epochsInds']
    DKL_YgX_YgT = utils.extract_array(params, 'DKL_YgX_YgT')
    p_ts = utils.extract_array(params, 'pts')
    H_Xgt = utils.extract_array(params, 'H_Xgt')

    f, (axes) = plt.subplots(3, 1)
    #axes = [axes]
    f.subplots_adjust(left=0.14,
                      bottom=0.1,
                      right=.928,
                      top=0.94,
                      wspace=0.13,
                      hspace=0.55)
    colors = LAYERS_COLORS
    line_ani = animation.FuncAnimation(
        f,
        update_bars_num_of_ts,
        len(p_ts),
        repeat=False,
        interval=1,
        blit=False,
        fargs=[p_ts, H_Xgt, DKL_YgX_YgT, axes, ind_array])
    Writer = animation.writers['ffmpeg']
    writer = Writer(fps=50)
    #Save the movie
    line_ani.save(save_name + '_movie.mp4', writer=writer, dpi=250)
    plt.show()
Example #2
0
def plot_hist(str_name, save_name='dist'):
    data_array = utils.get_data(str_name)
    params = np.squeeze(np.array(data_array['information']))
    ind_array = data_array['params']['epochsInds']
    DKL_YgX_YgT = utils.extract_array(params, 'DKL_YgX_YgT')
    p_ts = utils.extract_array(params, 'pts')
    H_Xgt = utils.extract_array(params, 'H_Xgt')

    f, (axes) = plt.subplots(3, 1)
    #axes = [axes]
    f.subplots_adjust(left=0.14, bottom=0.1, right=.928, top=0.94, wspace=0.13, hspace=0.55)
    colors = LAYERS_COLORS
    line_ani = animation.FuncAnimation(f, update_bars_num_of_ts, len(p_ts), repeat=False,
                                       interval=1, blit=False, fargs=[p_ts,H_Xgt,DKL_YgX_YgT, axes,ind_array])
    Writer = animation.writers['ffmpeg']
    writer = Writer(fps=50)
    #Save the movie
    line_ani.save(save_name+'_movie.mp4',writer=writer,dpi=250)
    plt.show()