Exemplo n.º 1
0
def time_change_11D_traj(delta_K, coord):
    t = np.linspace(0, 10000, 10001)
    stein_ss = bb.get_all_ss()
    ssa = stein_ss['E']; ssb = stein_ss['C']
    ic = 0.5*ssa+ssb*0.5
    labels, mu, M, eps = bb.get_stein_params()
    K = np.zeros((11,11))
    for i in range(11):
        for j in range(11):
            if coord == ([i,j]):
                K[i][j] = M[i][j]+delta_K
            else:
                K[i][j] = M[i][j]
    traj = integrate.odeint(time_change_integrand, ic, t, args=(mu, time_change_M))
    print(traj[-1])
    traj_2D = bb.project_to_2D(traj, ssa, ssb)
    return traj_2D
Exemplo n.º 2
0
            count +=1
##############################################plot the histogram
plt.figure(0)
num_bins = 25
n, bins, patches = plt.hist(coeff_list, num_bins, facecolor='blue', alpha=0.5)
plt.xlabel(r'value of coefficients $\alpha_{ij}$',fontsize = 20)
plt.ylabel('number of coefficients',fontsize = 20)
filename = 'figs/histogram.pdf'
plt.savefig(filename)
#coeff[4][2] = 15.11
###################################### original trajectory
plt.figure(1)
ic = (ssa+ssb)*0.5
t = np.linspace(0, 100, 10001)
traj = integrate.odeint(integrand, ic, t, args=(mu, M))
traj_2D = bb.project_to_2D(traj, ssa, ssb)
plt.plot(traj_2D[:,0], traj_2D[:,1],'b',label = 'Old Trajectory')
############################################change matrix M
Delta_M1 = np.array([[0,-2.7],
                     [0,0]])
Delta_M_4_2 = Delta_M1[0][1]/coeff[4][2] #delta M_ab = coeff[i][j]* Delta M[i][j]
M_new = M
M_new[4][2] = M[4][2]- Delta_M_4_2
traj_new = integrate.odeint(integrand, ic, t, args=(mu, M_new))
traj_2D_new = bb.project_to_2D(traj_new, ssa, ssb)
plt.plot(traj_2D_new[:,0], traj_2D_new[:,1],'r',label = 'New Trajectory')
plt.xlabel('SSE',fontsize = 20)
plt.ylabel('SSC',fontsize = 20)
plt.scatter([1,0],[0,1],facecolor = 'g',edgecolor = 'g',s=20)
plt.scatter([.5],[.5],facecolor = 'k',edgecolor = 'k',s=20)
plt.legend(prop={'size': 20})
            z = integrate.odeint(time_change_integrand,
                                 ic,
                                 t,
                                 args=(mu, time_change_M))
            eps = .01
            if np.linalg.norm(z[-1] - ssa) < eps: color = 'purple'
            elif np.linalg.norm(z[-1] - ssb) < eps: color = 'g'

            elif np.linalg.norm(z[-1] - ssA) < eps: color = 'k'
            elif np.linalg.norm(z[-1] - ssB) < eps: color = 'b'
            elif np.linalg.norm(z[-1] - ssD) < eps: color = 'r'
            else:
                print('{}, {}: neither SS'.format(x, y))
                color = 'orange'
                print(z[-1])
                traj_2D = bb.project_to_2D(z, ssa, ssb)
                plt.plot(traj_2D[:, 0],
                         traj_2D[:, 1],
                         'b',
                         label='Old Trajectory')
            phase_dict[(x, y)] = (z[-1], color)
    with open('data/{}'.format(filename), 'wb') as f:
        pickle.dump(phase_dict, f)
        print('... SAVED data to {}'.format(filename))
else:
    with open('data/{}'.format(filename), 'rb') as f:
        phase_dict = pickle.load(f)
        print('... LOADED data from {}'.format(filename))
purples = []
greens = []
blacks = []