def show_both_cell( self, c, cell_id):
X1part = self.X1part
X2part = self.X2part
y = self.y
cell = self.cell
X1_ylim = self.X1_ylim
X2_ylim = self.X2_ylim
cmethod = self.cmethod
X3_int = X2part[ np.where(y==c)[0],:]
X3_vel = X1part[ np.where(y==c)[0],:]
cell3 = cell[ np.where(y==c)[0]]
km = getattr(cluster, cmethod)(**cparam_d)
y3 = km.fit_predict( X3_int)
# redefine based on cell_id
X3_int = X3_int[ np.where(cell3==cell_id)[0],:]
X3_vel = X3_vel[ np.where(cell3==cell_id)[0],:]
y3 = y3[np.where(cell3==cell_id)[0]]
n_0 = X3_int[ np.where( y3==0)[0]].shape[0]
n_1 = X3_int[ np.where( y3==1)[0]].shape[0]
plt.figure(figsize=(9,4))
plt.subplot(1,2,1)
if n_0 > 0: sns.tsplot( X3_int[ np.where( y3==0)[0],:], color="blue")
if n_1 > 0: sns.tsplot( X3_int[ np.where( y3==1)[0],:], color="green")
plt.ylim(X2_ylim)
plt.title("Cluster{0}:Intensity {1}:{2}".format(c, n_0, n_1))
#plt.show()
plt.subplot(1,2,2)
#print("Velocity")
if n_0 > 0: sns.tsplot( X3_vel[ np.where( y3==0)[0],:], color="blue")
if n_1 > 0: sns.tsplot( X3_vel[ np.where( y3==1)[0],:], color="green")
plt.ylim(X1_ylim)
plt.title("Cluster{0}:Velocity {1}:{2}".format(c, n_0, n_1))
plt.show()
评论列表
文章目录