• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python mlab.bivariate_normal函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中matplotlib.mlab.bivariate_normal函数的典型用法代码示例。如果您正苦于以下问题:Python bivariate_normal函数的具体用法?Python bivariate_normal怎么用?Python bivariate_normal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了bivariate_normal函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: function

def function(position):
  xg = 3.0 * position[0]
  yg = 3.0 * position[1]
  h1 = bivariate_normal(xg, yg, 1.0, 1.0, 0.0, 0.0)
  h2 = bivariate_normal(xg, yg, 1.5, 0.5, 1, 1)
  h = 10.0 * (h1 - h2)
  return h
开发者ID:FluidityProject,项目名称:fluidity,代码行数:7,代码来源:height.py


示例2: calcAtomGaussians

def calcAtomGaussians(mol,a=0.03,step=0.02,weights=None):
  """
useful things to do with these:
fig.axes[0].imshow(z,cmap=cm.gray,interpolation='bilinear',origin='lower',extent=(0,1,0,1))
fig.axes[0].contour(x,y,z,20,colors='k')

fig=Draw.MolToMPL(m);
contribs=Crippen.rdMolDescriptors._CalcCrippenContribs(m)
logps,mrs=zip(*contribs)
x,y,z=Draw.calcAtomGaussians(m,0.03,step=0.01,weights=logps)
fig.axes[0].imshow(z,cmap=cm.jet,interpolation='bilinear',origin='lower',extent=(0,1,0,1))
fig.axes[0].contour(x,y,z,20,colors='k',alpha=0.5)
fig.savefig('coumlogps.colored.png',bbox_inches='tight')


  """
  import numpy
  from matplotlib import mlab
  x = numpy.arange(0,1,step)
  y = numpy.arange(0,1,step)
  X,Y = numpy.meshgrid(x,y)
  if weights is None:
    weights=[1.]*mol.GetNumAtoms()
  Z = mlab.bivariate_normal(X,Y,a,a,mol._atomPs[0][0], mol._atomPs[0][1])*weights[0]
  for i in range(1,mol.GetNumAtoms()):
    Zp = mlab.bivariate_normal(X,Y,a,a,mol._atomPs[i][0], mol._atomPs[i][1])
    Z += Zp*weights[i]
  return X,Y,Z
开发者ID:ashwin,项目名称:rdkit,代码行数:28,代码来源:__init__.py


示例3: main

def main(args):
    x = np.arange(-3.0, 3.0, 0.025)
    y = np.arange(-3.0, 3.0, 0.025)
    X, Y = np.meshgrid(x, y)
    Z0 = mlab.bivariate_normal(X, Y, 1.0, 4.0, 0.0, 0.0)
    Z1 = mlab.bivariate_normal(X, Y, 4.0, 1.0, 0.0, 0.0)
    Z = Z1 - Z0

    cdict = {
        "red": ((0.0, 0.0, 0.98), (1.0, 1.0, 1.0)),
        "green": ((0.0, 0.0, 0.74), (1.0, 1.0, 1.0)),
        "blue": ((0.0, 0.0, 0.0), (1.0, 1.0, 1.0)),
    }
    _cmap = LinearSegmentedColormap("tmp", cdict)

    plt.imshow(Z >= 0, interpolation="nearest", cmap=_cmap, extent=(-3, 3, -3, 3))
    CS = plt.contour(Z, [0], colors="g", extent=(-3, 3, -3, 3))
    plt.clabel(CS, inline=1, manual=[(-2, 2), (2, 2)], fmt="boundaries")

    CS0 = plt.contour(X, Y, Z0, 4, colors="r")
    plt.clabel(CS0, inline=1, manual=[(0, 0)], fmt="p(x | y = 0)")
    plt.text(0, -2, "f(x) = 0")
    plt.text(0, 2, "f(x) = 0")

    CS1 = plt.contour(X, Y, Z1, 4, colors="b")
    plt.clabel(CS1, inline=1, manual=[(0, 0)], fmt="p(x | y = 1)")
    plt.text(-2, 0, "f(x) = 1")
    plt.text(2, 0, "f(x) = 1")

    plt.show()
开发者ID:misaka-10032,项目名称:ML,代码行数:30,代码来源:1-plot.py


示例4: heatmap_with_hexagon_cell

def heatmap_with_hexagon_cell(x,y,timestamp):
	from matplotlib import cm 
	from matplotlib import mlab as ml
	n = 1e5
	#x = y = NP.linspace(-5, 5, 100)
	X, Y = np.meshgrid(x, y)
	Z1 = ml.bivariate_normal(X, Y, 2, 2, 0, 0)
	Z2 = ml.bivariate_normal(X, Y, 4, 1, 1, 1)
	ZD = Z2 - Z1
	x = X.ravel()
	y = Y.ravel()
	z = ZD.ravel()
	gridsize=300
	plt.subplot(111)

	# if 'bins=None', then color of each hexagon corresponds directly to its count
	# 'C' is optional--it maps values to x-y coordinates; if 'C' is None (default) then 
	# the result is a pure 2D histogram 

	plt.hexbin(x, y, C=z, gridsize=gridsize, cmap=cm.jet, bins=None)
	plt.axis([x.min(), x.max(), y.min(), y.max()])
        plt.text(18.9300,72.8200,"ChurchGate",bbox=dict(facecolor='green', alpha=0.5))
        plt.text(19.1833,72.8333,"Malad",bbox=dict(facecolor='green', alpha=0.5))
        plt.text(19.0587,72.8997,"Chembur",bbox=dict(facecolor='green', alpha=0.5))
        plt.text(19.2045,72.8376,"Kandivili",bbox=dict(facecolor='green', alpha=0.5))

	cb = plt.colorbar()
	cb.set_label('mean value')
	plt.show() 
开发者ID:shashanksingh,项目名称:prediction_python,代码行数:29,代码来源:plot_heatmap.py


示例5: test_mask_image_over_under

def test_mask_image_over_under():
    delta = 0.025
    x = y = np.arange(-3.0, 3.0, delta)
    X, Y = np.meshgrid(x, y)
    Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
    Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
    Z = 10*(Z2 - Z1)  # difference of Gaussians

    palette = copy(plt.cm.gray)
    palette.set_over('r', 1.0)
    palette.set_under('g', 1.0)
    palette.set_bad('b', 1.0)
    Zm = ma.masked_where(Z > 1.2, Z)
    fig, (ax1, ax2) = plt.subplots(1, 2)
    im = ax1.imshow(Zm, interpolation='bilinear',
                    cmap=palette,
                    norm=colors.Normalize(vmin=-1.0, vmax=1.0, clip=False),
                    origin='lower', extent=[-3, 3, -3, 3])
    ax1.set_title('Green=low, Red=high, Blue=bad')
    fig.colorbar(im, extend='both', orientation='horizontal',
                 ax=ax1, aspect=10)

    im = ax2.imshow(Zm, interpolation='nearest',
                    cmap=palette,
                    norm=colors.BoundaryNorm([-1, -0.5, -0.2, 0, 0.2, 0.5, 1],
                                             ncolors=256, clip=False),
                    origin='lower', extent=[-3, 3, -3, 3])
    ax2.set_title('With BoundaryNorm')
    fig.colorbar(im, extend='both', spacing='proportional',
                 orientation='horizontal', ax=ax2, aspect=10)
开发者ID:4over7,项目名称:matplotlib,代码行数:30,代码来源:test_image.py


示例6: get_image

def get_image():
    delta = 0.25
    x = y = np.arange(-3.0, 3.0, delta)
    X, Y = np.meshgrid(x, y)
    Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
    Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
    Z = Z2 - Z1  # difference of Gaussians
    return Z
开发者ID:AlexandreAbraham,项目名称:matplotlib,代码行数:8,代码来源:affine_image.py


示例7: get_gauss_kernel

def get_gauss_kernel(sigma, size, res):
    """
    return a two dimesional gausian kernel of shape (size*(1/resolution),size*(1/resolution))
    with a std deviation of std
    """
    x,y = ny.mgrid[-size/2:size/2:res,-size/2:size/2:res]
    b=bivariate_normal(x,y,sigma,sigma)
    A=(1/ny.max(b))
    #A=1
    return x,y,A*bivariate_normal(x, y, sigma, sigma)
开发者ID:ohaas,项目名称:cmn,代码行数:10,代码来源:model.py


示例8: __call__

    def __call__(self, inputs):
        from matplotlib.mlab import bivariate_normal
        X = self.get_input('X')
        Y = self.get_input('Y')
        Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
        Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
        # difference of Gaussians
        Z = 10.0 * (Z2 - Z1)

        return Z
开发者ID:MarieLatutu,项目名称:openalea-components,代码行数:10,代码来源:py_pylab.py


示例9: create_plot

def create_plot():
    x = np.linspace(-3.0, 3.0, 30)
    y = np.linspace(-2.0, 2.0, 30)
    X, Y = np.meshgrid(x, y)
    Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
    Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
    Z = 10.0 * (Z2 - Z1)

    fig, ax = plt.subplots()
    CS = ax.contourf(X, Y, Z, 30)
    return fig
开发者ID:Bantalik,项目名称:mpld3,代码行数:11,代码来源:test_contourf.py


示例10: test_image_plot

    def test_image_plot(self):
        delta = 0.025
        x = y = np.arange(-3.0, 3.0, delta)
        X, Y = np.meshgrid(x, y)
        Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
        Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
        Z = Z2 - Z1  # difference of Gaussians

        im = plt.imshow(Z, interpolation='bilinear', cmap=cm.RdYlGn,
                        origin='lower', extent=[-3, 3, -3, 3],
                        vmax=abs(Z).max(), vmin=-abs(Z).max())
        plt.show()
开发者ID:rosswhitfield,项目名称:mantid,代码行数:12,代码来源:MantidPlotMatplotlibTest.py


示例11: test3

def test3():
    N = 1000
    x = (np.linspace(-2.0, 3.0, N))
    y = (np.linspace(-2.0, 2.0, N))

    X, Y = np.meshgrid(x, y)
    X1 = 0.5*(X[:-1,:-1] + X[1:,1:])
    Y1 = 0.5*(Y[:-1,:-1] + Y[1:,1:])

    from matplotlib.mlab import bivariate_normal
    Z1 = bivariate_normal(X1, Y1, 0.1, 0.2, 1.27, 1.11) + 100.*bivariate_normal(X1, Y1, 1.0, 1.0, 0.23, 0.72)


    Z1[Z1>0.9*np.max(Z1)] = +np.inf

    cdict = {'red':   [(0.0,  1.0, 1.0),
                       (1.0,  1.0, 1.0)],

             'green': [(0.0,  0.0, 0.0),
                       (1.0,  0.0, 0.0)],

             'blue':  [(0.0,  0.0, 0.0),
                       (1.0,  0.0, 0.0)],

             'alpha': [(0.0,  0.0, 0.0),
                       (1.0,  1.0, 1.0)],
             }

    # this is a color maps showing how the resukt should look like
    cdictx = {'red':   [(0.0,  1.0, 1.0),
                       (1.0,  1.0, 1.0)],

             'green': [(0.0,  1.0, 1.0),
                       (1.0,  0.0, 0.0)],

             'blue':  [(0.0,  1.0, 1.0),
                       (1.0,  0.0, 0.0)],

             }

    fig = plt.figure()
    ax = fig.add_subplot(1,1,1)
    col = mpl_colors.LinearSegmentedColormap('test', cdict)
    i = ax.pcolorfast(x, y, Z1, cmap = col)
    plt.colorbar(i)

    fig = plt.figure()
    ax = fig.add_subplot(1,1,1)
    col = mpl_colors.LinearSegmentedColormap('testx', cdictx)
    i = ax.pcolorfast(x, y, Z1, cmap = col)
    plt.colorbar(i)

    plt.show()
开发者ID:earnric,项目名称:modules,代码行数:53,代码来源:test.py


示例12: testcontour

    def testcontour(self):
        #contour plot test data:
        delta = 0.025
        x = np.arange(-3.0, 3.0, delta)
        y = np.arange(-2.0, 2.0, delta)
        X, Y = np.meshgrid(x, y)
        Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
        Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
        # difference of Gaussians
        Z = 10.0 * (Z2 - Z1)

        plt.contour(X, Y, Z, 20)
开发者ID:QBI-Software,项目名称:Tracking,代码行数:12,代码来源:test_plot.py


示例13: main

def main():
    x = np.linspace(-3.0, 3.0, 30)
    y = np.linspace(-2.0, 2.0, 30)
    X, Y = np.meshgrid(x, y)
    Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
    Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
    Z = 10.0 * (Z2 - Z1)

    fig, ax = plt.subplots()
    CS = ax.contour(X, Y, Z)
    ax.clabel(CS, inline=True, fontsize=10)
    return fig
开发者ID:Ahmed,项目名称:mpld3,代码行数:12,代码来源:test_contour.py


示例14: calcAtomGaussians

def calcAtomGaussians(mol,a=0.03,step=0.02,weights=None):
  import numpy
  from matplotlib import mlab
  x = numpy.arange(0,1,step)
  y = numpy.arange(0,1,step)
  X,Y = numpy.meshgrid(x,y)
  if weights is None:
    weights=[1.]*mol.GetNumAtoms()
  Z = mlab.bivariate_normal(X,Y,a,a,mol._atomPs[0][0], mol._atomPs[0][1])*weights[0]
  for i in range(1,mol.GetNumAtoms()):
    Zp = mlab.bivariate_normal(X,Y,a,a,mol._atomPs[i][0], mol._atomPs[i][1])
    Z += Zp*weights[i]
  return X,Y,Z
开发者ID:nclopezo,项目名称:chembl_beaker,代码行数:13,代码来源:__init__.py


示例15: get_test_data

def get_test_data(delta=0.05):
    from matplotlib.mlab import meshgrid, bivariate_normal
    x = y = npy.arange(-3.0, 3.0, delta)
    X, Y = meshgrid(x,y)

    Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
    Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
    Z = Z2-Z1

    X = X * 10
    Y = Y * 10
    Z = Z * 500
    return X,Y,Z
开发者ID:mcvine,项目名称:sansmodels,代码行数:13,代码来源:test3d.py


示例16: main

def main():
    # Part of the example at 
    # http://matplotlib.sourceforge.net/plot_directive/mpl_examples/pylab_examples/contour_demo.py
    delta = 0.025
    x = numpy.arange(-3.0, 3.0, delta)
    y = numpy.arange(-2.0, 2.0, delta)
    X, Y = numpy.meshgrid(x, y)
    Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
    Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
    Z = 10.0 * (Z2 - Z1)
    pyplot.figure()
    CS = pyplot.contour(X, Y, Z)
    pyplot.show()
开发者ID:ChaiZQ,项目名称:pyinstaller,代码行数:13,代码来源:test_matplotlib.py


示例17: image_demo

def image_demo(fig, ax):
    delta = 0.025
    x = y = np.arange(-3.0, 3.0, delta)
    xx, yy = np.meshgrid(x, y)
    z1 = mlab.bivariate_normal(xx, yy, 1.0, 1.0, 0.0, 0.0)
    z2 = mlab.bivariate_normal(xx, yy, 1.5, 0.5, 1, 1)
    image = z2-z1  # Difference of Gaussians
    img_plot = ax.imshow(image)
    ax.set_title('image')

    fig.tight_layout()
    # `colorbar` should be called after `tight_layout`.
    fig.colorbar(img_plot, ax=ax)
开发者ID:thuyen,项目名称:matplotlib-style-gallery,代码行数:13,代码来源:artist-demo.py


示例18: calcAtomGaussians

def calcAtomGaussians(mol,a=0.03,step=0.02,weights=None):
  import numpy
  from matplotlib import mlab
  x = numpy.arange(0,1,step)
  y = numpy.arange(0,1,step)
  X,Y = numpy.meshgrid(x,y)
  if weights is None:
    weights=[1.]*mol.GetNumAtoms()
  Z = mlab.bivariate_normal(X,Y,a,a,mol._atomPs[0][0], mol._atomPs[0][1])*weights[0] # this is not bivariate case ... only univariate no mixtures #matplotlib.mlab.bivariate_normal(X, Y, sigmax=1.0, sigmay=1.0, mux=0.0, muy=0.0, sigmaxy=0.0)
  for i in range(1,mol.GetNumAtoms()):
    Zp = mlab.bivariate_normal(X,Y,a,a,mol._atomPs[i][0], mol._atomPs[i][1])
    Z += Zp*weights[i]
  return X,Y,Z
开发者ID:cheminfo,项目名称:RDKitjs,代码行数:13,代码来源:similarityMap_basic_functions.py


示例19: check_abnormal_with_density

def check_abnormal_with_density(meanx, meany, stdx, stdy, target_sz):
    normal_sz = 264
    target_sz = target_sz
    X = np.arange(plot_lim_min, plot_lim_max, 0.1)
    Y = np.arange(plot_lim_min, plot_lim_max, 0.1)

    mX, mY = np.meshgrid(X, Y)
    n1 = mlab.bivariate_normal(mX, mY, 2.15, 0.89, 15.31, -6.5)
    n2 = mlab.bivariate_normal(mX, mY, 3.16, 3.21, 18, -17.5)
    n3 = mlab.bivariate_normal(mX, mY, 1.79, 1, 17.5, -11.3)
    n4 = mlab.bivariate_normal(mX, mY, 3.6, 2.5, 16, -11.4)
    n5 = mlab.bivariate_normal(mX, mY, 3.4, 2.6, 14, -18)
    n6 = mlab.bivariate_normal(mX, mY, 3.65, 4.85, 11, 4.7)
    n7 = mlab.bivariate_normal(mX, mY, 1.85, 1.45, 15.8, -13)
    normal_dist = n1 + n2 + n3 + n4 + n5 + n6 + n7
    target_dist = mlab.bivariate_normal(mX, mY, stdx, stdy, meanx, meany)

    normal_dist = normal_dist*(normal_sz/float(normal_sz+target_sz))
    target_dist = target_dist*(target_sz/float(target_sz+target_sz))

    s = 0
    for x in range(len(X)) :
        for y in range(len(Y)):
            det = target_dist[x,y] - normal_dist[x,y]
            if det > 0:
                s = s + det
    return s
开发者ID:zedoul,项目名称:AnomalyDetection,代码行数:27,代码来源:main.py


示例20: slit_image

    def slit_image(self, y_strength):
        x = numpy.arange(0, self.length*self.length_mult+1, 1.0)
        y = numpy.arange(0, self.width*self.width_mult+1, 1.0)
        X, Y = numpy.meshgrid(x, y)
        ptsource = mlab.bivariate_normal(X, Y, self.FWHM, self.FWHM, len(x)/2.0+(self.object_location-0.5)*self.length, len(y)/2.0)

        sky = numpy.zeros([len(y), len(x)])
        for i in numpy.arange(len(x)/2.0-self.length/2.0, len(x)/2.0+self.length/2.0, 0.1):
            for j in numpy.arange(len(y)/2.0-self.width/2.0, len(y)/2.0+self.width/2.0, 0.1):
                sky += ((numpy.random.randn(1))**2.0)*mlab.bivariate_normal(X, Y, self.FWHM, self.FWHM, i, j)

        #ptsource = mlab.bivariate_normal
        composite = numpy.round(sky) + numpy.round(ptsource*500.0*y_strength)
        return composite
开发者ID:soylentdeen,项目名称:FG_Widget,代码行数:14,代码来源:make_fake_dark.py



注:本文中的matplotlib.mlab.bivariate_normal函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mlab.csv2rec函数代码示例发布时间:2022-05-27
下一篇:
Python mathtext.MathTextParser类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap