Exemplo n.º 1
0
crossovers = []
C_as = []
C_ad = []
C_ai = []
C_0 = []

for seed in range(n_seeds):
    for ind_cue in range(p):
        for ind_trans in range(3, len(retrieved[seed][ind_cue]) - 1):
            pattA = retrieved[seed][ind_cue][ind_trans]
            pattB = retrieved[seed][ind_cue][ind_trans + 1]
            pair_crossovers[pattA * p + pattB].append(
                crossover[seed][ind_cue][ind_trans + 1])
            crossovers.append(crossover[seed][ind_cue][ind_trans + 1])
            C_as.append(
                correlations.active_same_state(ksi_i_mu[:, pattA],
                                               ksi_i_mu[:, pattB]))
            C_ad.append(
                correlations.active_diff_state(ksi_i_mu[:, pattA],
                                               ksi_i_mu[:, pattB]))
            C_ai.append(
                correlations.active_inactive(ksi_i_mu[:, pattA],
                                             ksi_i_mu[:, pattB]))
            previous.append(pattA)
            following.append(pattB)

plt.figure('Crossover histo')
plt.hist(crossovers, bins=100)

prop_high = np.zeros(p**2)
prop_low = np.zeros(p**2)
means = np.zeros(p**2)
Exemplo n.º 2
0
pair_crossovers = [[] for pair in range(p**2)]

previous = []
following = []
marriage_time = []
C_as = []
C_ad = []
C_ai = []
C_0 = []

for ind_marriage in range(len(simult_ret)):
    pattA = int(simult_ret[ind_marriage][0])
    pattB = int(simult_ret[ind_marriage][1])
    marriage_time.append(simult_ret[ind_marriage][3])
    C_as.append(
        correlations.active_same_state(ksi_i_mu[:, pattA], ksi_i_mu[:, pattB]))
    C_ad.append(
        correlations.active_diff_state(ksi_i_mu[:, pattA], ksi_i_mu[:, pattB]))
    C_ai.append(
        correlations.active_inactive(ksi_i_mu[:, pattA], ksi_i_mu[:, pattB]))
    previous.append(pattA)
    following.append(pattB)

overlaps = file_handling.load_evolution(0, 0, key)
tS = np.array(file_handling.load_time(0, key)[0])
recorded = tS > 0.
trans_time = file_handling.load_transition_time(0, key)[0]

C1C2C0 = correlations.cross_correlations(ksi_i_mu)

plt.close('scatter_cas')
Exemplo n.º 3
0
                    max_m_mu_saved.append(tmp[5])
                    max2_m_mu_saved.append(tmp[6])
                    indTrans += 1
                ind_max_prev = ind_max
        plt.close('all')
        plt.figure(1)
        plt.subplot(311)
        plt.plot(tS[:, None], m_mu_plot)
        plt.title('C1 = ' + str(C1) + ', C2 = ' + str(C2))
        plt.ylabel('overlap')
        plt.xlim(0, tSim)
        plt.subplot(312)
        plt.title(str(retrieved_saved))
        plt.scatter(
            tTrans,
            N * a * correlations.active_same_state(
                ksi_i_mu[:, retrieved_saved], ksi_i_mu[:, outsider_saved]),
            label='C1')
        plt.scatter(
            tTrans,
            N * a * correlations.active_diff_state(
                ksi_i_mu[:, retrieved_saved], ksi_i_mu[:, outsider_saved]),
            label='C2')
        plt.xlim(0, tSim)
        plt.ylim(-1, 21)
        plt.legend()
        plt.subplot(313)
        plt.plot(tS[:, None], m_mu_plot[:, :2])
        plt.xlim(0, tSim)
        plt.tight_layout()
        plt.savefig('scan_corr/C1_' + str(C1) + '_C2_' + str(C2))
lamb = np.array(lamb)

low_cor = lamb < 0.2
l_low_cor = r'$\lambda < 0.2$'
mid_low_cor = np.logical_and(0.2 <= lamb, lamb < 0.6)
l_mid_low_cor = r'$0.2 \leq \lambda < 0.6$'
mid_high_cor = np.logical_and(0.6 <= lamb, lamb < 0.8)
l_mid_high_cor = r'$0.6 \leq \lambda < 0.8$'
high_cor = 0.8 <= lamb
l_high_cor = r'$0.8 \leq \lambda $'

C1C2C0 = correlations.cross_correlations(ksi_i_mu)

ax_order = 'xC1yC2'
if ax_order == 'xC1yC2':
    xx = correlations.active_same_state(ksi_i_mu[:, retrieved_saved],
                                        ksi_i_mu[:, previously_saved])
    yy = correlations.active_diff_state(ksi_i_mu[:, retrieved_saved],
                                        ksi_i_mu[:, previously_saved])
    zz = correlations.active_inactive(ksi_i_mu[:, retrieved_saved],
                                      ksi_i_mu[:, previously_saved])
    XX = C1C2C0[:, 0]
    YY = C1C2C0[:, 1]
else:
    xx = correlations.active_diff_state(ksi_i_mu[:, retrieved_saved],
                                        ksi_i_mu[:, previously_saved])
    yy = correlations.active_same_state(ksi_i_mu[:, retrieved_saved],
                                        ksi_i_mu[:, previously_saved])
    zz = correlations.active_inactive(ksi_i_mu[:, retrieved_saved],
                                      ksi_i_mu[:, previously_saved])
    XX = C1C2C0[:, 1]
    YY = C1C2C0[:, 0]
Exemplo n.º 5
0
    pair_covar_norm = pair_coactivation.copy()
    C1C2C0 = np.zeros(((p * (p - 1)) // 2, 3))
    shared_inact = pair_coactivation.copy()
    cpt = 0

    M = correlations.shared_inactive(ksi_i_mu)

    for patt1 in range(p):
        for patt2 in range(patt1 + 1, p):
            shared_density[cpt] = shared_parents[patt1, patt2]
            pair_coactivation[cpt] = coactivation[patt1, patt2]
            pair_covariance[cpt] = covariance[patt1, patt2]
            pair_coac_norm[cpt] = coactivation_norm[patt1, patt2]
            pair_covar_norm[cpt] = covariance_norm[patt1, patt2]
            C1C2C0[cpt, 0] = \
                correlations.active_same_state(ksi_i_mu[:, patt1],
                                               ksi_i_mu[:, patt2])
            C1C2C0[cpt, 1] = \
                correlations.active_diff_state(ksi_i_mu[:, patt1],
                                               ksi_i_mu[:, patt2])
            C1C2C0[cpt, 2] = \
                correlations.active_inactive(ksi_i_mu[:, patt1],
                                             ksi_i_mu[:, patt2])
            shared_inact[cpt] = M[patt1, patt2]
            cpt += 1

    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]

    jitterx = 0.15 * (rd.rand((p * (p - 1) // 2)) + ind_gA)
    jittery = np.max(coactivation) * (0.05 * rd.rand((p * (p - 1) // 2)))
    # plt.figure('Shared parents')
plt.figure('evolution')
trans_time = file_handling.load_transition_time(0, key)[ind_cue]
retrieved = file_handling.load_retrieved(0, key)[ind_cue]
plt.plot(tSnap, overlap)
for ind_trans in range(len(trans_time)):
    plt.text(trans_time[ind_trans], 0.8, str(retrieved[ind_trans]))

plt.figure('Scatter')
C0, C1, C2 = [], [], []
for ind_trans in range(len(valid_transitions)):
    pair = valid_transitions[ind_trans]
    if pair[0] != -1:
        pattA = ksi_i_mu[:, pair[0]]
        pattB = ksi_i_mu[:, pair[1]]
        C0.append(correlations.active_inactive(pattA, pattB))
        C1.append(correlations.active_same_state(pattA, pattB))
        C2.append(correlations.active_diff_state(pattA, pattB))
        if correlations.active_same_state(pattA, pattB) > 0.8:
            print(pair[0], pair[1])

plt.scatter(C1, C0, color='b')

C0, C1, C2 = [], [], []
for ind_trans in range(len(invalid_transitions)):
    pair = invalid_transitions[ind_trans]
    if pair[0] != -1:
        pattA = ksi_i_mu[:, pair[0]]
        pattB = ksi_i_mu[:, pair[1]]
        C0.append(correlations.active_inactive(pattA, pattB))
        C1.append(correlations.active_same_state(pattA, pattB))
        C2.append(correlations.active_diff_state(pattA, pattB))