예제 #1
0
    def plotSolnAndGrad(self, plt, solVec, title=""):

        plt.set_title(title)
        #   plt.set_xlabel('x',size=14,weight='bold')
        #   plt.set_ylabel('y',size=14,weight='bold')
        plt.set_aspect('equal')
        plt.set_xlim(-0.1, 5.1)
        plt.set_ylim(-0.1, 1.2)
        xy = np.asarray(self.mesh.vertices)
        tci = tri.CubicTriInterpolator(self.mesh.dtri, solVec)
        (Ex, Ey) = tci.gradient(self.mesh.dtri.x, self.mesh.dtri.y)
        E_norm = np.sqrt(Ex**2 + Ey**2)
        vals = plt.tricontourf(self.mesh.dtri, solVec, cmap="jet")
        plt.quiver(self.mesh.dtri.x,
                   self.mesh.dtri.y,
                   -Ex / E_norm,
                   -Ey / E_norm,
                   units='xy',
                   scale=20.,
                   zorder=3,
                   color='blue',
                   width=0.002,
                   headwidth=2.,
                   headlength=2.)
        return vals
예제 #2
0
  def plotMesh(self, plt, title=""):

    plt.set_title("Mesh")
#   plt.set_xlabel('x',size=14,weight='bold')
#   plt.set_ylabel('y',size=14,weight='bold')
    plt.set_aspect('equal');
    plt.set_xlim(-0.1,5.1); plt.set_ylim(-0.1,1.2);
    xy = np.asarray(self.mesh.vertices);
    vals=plt.triplot(xy[:,0],xy[:,1],self.mesh.elements,'b-',linewidth=0.5);
    return vals
예제 #3
0
    def plotSoln(self, plt, solVec, title=""):

        plt.set_title(title)
        #   plt.set_xlabel('x',size=14,weight='bold')
        #   plt.set_ylabel('y',size=14,weight='bold')
        plt.set_aspect('equal')
        plt.set_xlim(-0.1, 5.1)
        plt.set_ylim(-0.1, 1.2)
        xy = np.asarray(self.mesh.vertices)
        if xy.size < 10000:
            plt.triplot(xy[:, 0],
                        xy[:, 1],
                        self.mesh.elements,
                        'b-',
                        linewidth=0.5)
        vals = plt.tricontourf(self.mesh.dtri, solVec, cmap="jet")
        return vals
예제 #4
0
    cv.append(row)
mean = []
for row in cv_data[2]:
    mean.append(math.log10(row))
scaled_cv = []
for val in cv:
    scaled_cv.append(math.log10(val ** 2))

xs = mean
ys = scaled_cv
resolution = 250

neighbours = 16
if neighbours == 0:
    plt.plot(xs, ys, 'k.', markersize=2)
    plt.set_aspect('equal')
    plt.title("Scatter Plot")
else:
    im, extent = nearest_neighbours(xs, ys, resolution, neighbours)
    plt.imshow(im, origin='lower', extent=extent, cmap=cm.bone)
    plt.title("Raw Transcript counts from single-cells")
    plt.xlim(extent[0], extent[1])
    plt.ylim(extent[2], extent[3])
plt.show()


rank_norm_data = pd.read_csv('./data/rna/raw_pagoda.csv', header=None, index_col=False)
mean_express = []
for row in rank_norm_data[0]:
    mean_express.append(math.log10(row))
var = []