def plot_information_flow(simulation_list): for ind_key in range(len(simulation_list)): print('ind_key = %d' % ind_key) simulation_key = simulation_list[ind_key] (dt, tSim, N, S, p, num_fact, p_fact, dzeta, a_pf, eps, f_russo, cm, a, U, w, tau_1, tau_2, tau_3_A, tau_3_B, g_A, beta, tau, t_0, g, random_seed, p_0, n_p, nSnap, russo2008_mode) = file_handling.load_parameters(simulation_key) retrieved_saved = \ file_handling.load_retrieved_several(n_seeds[ind_key], simulation_key) m_saved, mi_saved, control, shuffled = get_mi(retrieved_saved, retrieved_saved) corrected = np.array(mi_saved)[:, None] - np.array(shuffled) # print((np.array(mi_saved)).shape) # print((np.array(shuffled)).shape) # print(corrected.shape) plt.title('Information flow, shuffled bias estimate') plt.plot(m_saved, corrected, '-o', color=color_s[ind_key], label=r'$g_A$=%.1f, $w$=%.1f' % (g_A, w)) plt.plot(m_saved, shuffled, ':', color=color_s[ind_key], label='bias') # plt.yscale('log', basey=10) plt.ylim([ymin, ymax]) plt.xlabel(r'Shift $\Delta n$') plt.legend(loc='upper right')
def plot_information_flow_apf(simulation_list): g_A_s = np.array([0., 0.5, 1.]) apf_s = np.array([0., 0.05, 0.1, 0.2, 0.4]) n_gA = len(g_A_s) n_apf = len(apf_s) for ind_key in range(len(simulation_list)): print('ind_key = %d' % ind_key) simulation_key = simulation_list[ind_key] (dt, tSim, N, S, p, num_fact, p_fact, dzeta, a_pf, eps, f_russo, cm, a, U, w, tau_1, tau_2, tau_3_A, tau_3_B, g_A, beta, tau, t_0, g, random_seed, p_0, n_p, nSnap, russo2008_mode, muted_prop) = file_handling.load_parameters(simulation_key) retrieved_saved = file_handling.load_retrieved_several( n_seeds[ind_key], simulation_key) m_saved, mi_saved, control, shuffled, auto_corr, auto_corr_shuff = \ get_mi(retrieved_saved, retrieved_saved) auto_corr[1] = 0 corrected = np.array(mi_saved)[:, None] - np.array(shuffled) ind_gA = [i for i in range(len(g_A_s)) if g_A_s[i] == g_A][0] ind_apf = [i for i in range(len(apf_s)) if apf_s[i] == a_pf][0] print((np.array(mi_saved)).shape) print((np.array(shuffled)).shape) print(corrected.shape) plt.figure('Mi') plt.subplot(n_gA // 2 + n_gA % 2, 2, ind_gA + 1) plt.title('g_A=%.1f, w=%.1f' % (g_A, w)) plt.plot(m_saved, corrected, '-o', color=color_s[ind_apf], label=r'$a_{pf}$=%.2f' % a_pf) plt.plot(m_saved, shuffled, ':', color=color_s[ind_apf], label='bias') plt.yscale('log', basey=10) plt.ylim([ymin, ymax]) plt.xlabel(r'Shift $\Delta n$') plt.legend(loc='upper right') plt.figure('Autocor') plt.subplot(n_apf // 2 + n_apf % 2, 2, ind_apf + 1) plt.plot(m_saved, auto_corr, '-o', color=color_s[ind_gA], label=r'$g_A$=%.1f' % g_A) plt.plot(m_saved, auto_corr_shuff, ':', color=color_s[ind_gA]) plt.yscale('log') plt.title(r'$a_{pf}$=%.2f' % a_pf) plt.ylabel('Correlation') plt.xlabel(r'$\Delta n$') plt.figure('Mi') plt.tight_layout() plt.figure('Autocor') plt.legend() plt.tight_layout()
plt.rc('ytick', labelsize=BIGGER_SIZE) # fontsize of the tick labels plt.rc('legend', fontsize=BIGGER_SIZE) # legend fontsize plt.rc('figure', titlesize=HUGE_SIZE) # fontsize of the figure title # simulations = ['a2cc92e57feefe09afa4b7d522648850'] # simulations = ['f30d8a2438252005f6a9190c239c01c1'] simulations = [ 'f35c969f14b35efe505be6e417c03656', '9e0fbd728bd38ee6eb130d85f35faa9a' ] # simulations = ['b18e30bc89dbcb5bc2148fb9c6e0c51d'] # simulations = ['ff9fe40ed43a94577c1cc2fea6453bf0'] n_seeds = 1 key = simulations[0] retrieved = file_handling.load_retrieved_several(n_seeds, key) crossover = file_handling.load_crossover_several(n_seeds, key) trans_time = file_handling.load_transition_time(0, key)[0] (dt, tSim, N, S, p, num_fact, p_fact, dzeta, a_pf, eps, f_russo, cm, a, U, w, tau_1, tau_2, tau_3_A, tau_3_B, g_A, beta, tau, t_0, g, random_seed, p_0, n_p, nSnap, russo2008_mode, kick_prop) = \ file_handling.load_parameters(key) ksi_i_mu, delta__ksi_i_mu__k, J_i_j_k_l, \ C_i_j = file_handling.load_network(key) pair_crossovers = [[] for pair in range(p**2)] previous = [] following = [] crossovers = []
yy = np.arange(0, max_count + 1, 1) XX, YY = np.meshgrid(xx, yy) for cycle in cycle_count: data[cycle_count[cycle], len(cycle)] += 1 plt.pcolor(XX, YY, data, norm=colors.LogNorm(vmin=1, vmax=5e3)) plt.xlim(1, max_cycle) plt.ylim(1, 1000) cbar = plt.colorbar() plt.yscale('log') for ind_key in range(1): print('ind_key = %d' % ind_key) simulation_key = simulations[ind_key] ryom_name = ryom_data[ind_key] retrieved = file_handling.load_retrieved_several(1, simulation_key) plt.subplot(311) plot_cycles(retrieved, simulation_key) plt.title("Latching sequence") retrieved_random = get_eq_random(retrieved, simulation_key) retrieved_markov = get_eq_markov(retrieved, simulation_key) plt.subplot(312) plt.title("Markov sequence") plot_cycles(retrieved_markov, simulation_key) plt.ylabel('Repetitions') plt.subplot(313) plt.title("Random sequence") plot_cycles(retrieved_random, simulation_key)