Ejemplo n.º 1
0
    range(0,35),
    range(34,45)
    ]
]
n=[]
for data_id in range(len(datamatrix)):
    data=np.load(os.path.join(inputdir,datamatrix[data_id]))
    
    n.append(len(data))
if 0:
    data_id=0
    data=np.load(os.path.join(inputdir,datamatrix[data_id]))

    fig=plt.figure(1)
    fig.clf()
    matshow(data,fig)
    clicked=ml.getpts(fig)
    #%%
    values=clicked.x
    values.extend(clicked.y)
    b1=int(floor(min(values)))
    b2=int(ceil(max(values)))

    fig2=plt.figure(2);fig2.clf()
    submatrix=data[range(b1,b2),:]
    submatrix=submatrix[:,range(b1,b2)]
    matshow(submatrix,fig2)

    print "range("+str(b1)+","+str(b2)+")"
#%%
UUID=uuid.uuid4()
Ejemplo n.º 2
0
# compute pairwise distance
D = compute_pairwise_distance(resampled_ground_truth_curve)
ind = listIndices(n, 1)  # get the upper triangular index of the matrix
# compute expect number of interactions
MU = b * pow(D, a)
# simulate from independent poisson distribution
c = np.random.poisson(MU[ind[:, 0], ind[:, 1]])
# construct the pairwise interaction matrix
C = np.zeros([n, n])
C[ind[:, 0], ind[:, 1]] = c  # only the upper triangular part
C = C + C.T  # make the matrix symetric
# save the simulated matrix
np.savetxt("data/simulate_data_" + str(n) + ".csv", C, delimiter=',')

fig1, ax1 = pt.plot_curve(resampled_ground_truth_curve, tn)
pt.plot_pts(resampled_ground_truth_curve, t, ax=ax1, fig=fig1)
fig1.suptitle('Ground Truth Curve', fontsize=18)
fig1.savefig('images/ground_truth_curve.png')

fig2, ax2, m = pt.matshow(1.0 * (C > 0))
fig2.suptitle('Non-Zero Simulated Data', fontsize=18)
fig2.savefig('images/simulated_data_nonzeros.png')

fig3, ax3, m = pt.matshow(C)
fig3.suptitle('Simulated Data', fontsize=18)
fig3.savefig('images/simulated_data.png')

if display_the_result:
    plt.show(block=True
             )  # If you want to display the results uncomment the thing above