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

Python numerix.zeros函数代码示例

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

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



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

示例1: __init__

 def __init__(self, nmax):
     'buffer up to nmax points'
     self._xa = nx.zeros((nmax,), typecode=nx.Float)
     self._ya = nx.zeros((nmax,), typecode=nx.Float)        
     self._xs = nx.zeros((nmax,), typecode=nx.Float)
     self._ys = nx.zeros((nmax,), typecode=nx.Float)        
     self._ind = 0
     self._nmax = nmax
     self.dataLim = None
     self.callbackd = {}
开发者ID:pv,项目名称:matplotlib-cvs,代码行数:10,代码来源:mlab.py


示例2: movavg

def movavg(x,n):
    'compute the len(n) moving average of x'
    n = int(n)
    N = len(x)
    assert(N>n)
    y = zeros(N-(n-1),Float)
    for i in range(n):
       y += x[i:N-(n-1)+i]
    y /= float(n)
    return y
开发者ID:pv,项目名称:matplotlib-cvs,代码行数:10,代码来源:mlab.py


示例3: symbols

def symbols(epsoutfile):
    y = arange(5)/5.0+0.1
    
    g = pyxgraph(xlimits=(-1, 25), ylimits=(0, 1),           
                 xticks=(0, 24, 2), yticks=(0, 1, 1), key=None) 
    
    for i in xrange(25):
        x = zeros(5)+i   
        g.pyxplot((x, y), style="p", pt=i)   # ``pt=i`` can be omitted
                                             # (then the next symbol is choosen
                                             #  automatically)
    g.pyxsave(epsoutfile)
开发者ID:deprecated,项目名称:pyxgraph,代码行数:12,代码来源:symbols.py


示例4: makeMappingArray

def makeMappingArray(N, data):
    """Create an N-element 1-d lookup table

    data represented by a list of x,y0,y1 mapping correspondences.
    Each element in this list represents how a value between 0 and 1
    (inclusive) represented by x is mapped to a corresponding value
    between 0 and 1 (inclusive). The two values of y are to allow
    for discontinuous mapping functions (say as might be found in a
    sawtooth) where y0 represents the value of y for values of x
    <= to that given, and y1 is the value to be used for x > than
    that given). The list must start with x=0, end with x=1, and
    all values of x must be in increasing order. Values between
    the given mapping points are determined by simple linear interpolation.

    The function returns an array "result" where result[x*(N-1)]
    gives the closest value for values of x between 0 and 1.
    """
    try:
        adata = array(data)
    except:
        raise TypeError("data must be convertable to an array")
    shape = adata.shape
    if len(shape) != 2 and shape[1] != 3:
        raise ValueError("data must be nx3 format")

    x  = adata[:,0]
    y0 = adata[:,1]
    y1 = adata[:,2]

    if x[0] != 0. or x[-1] != 1.0:
        raise ValueError(
           "data mapping points must start with x=0. and end with x=1")
    if sometrue(sort(x)-x):
        raise ValueError(
           "data mapping points must have x in increasing order")
    # begin generation of lookup table
    x = x * (N-1)
    lut = zeros((N,), Float)
    xind = arange(float(N))
    ind = searchsorted(x, xind)[1:-1]

    lut[1:-1] = ( divide(xind[1:-1] - take(x,ind-1),
                         take(x,ind)-take(x,ind-1) )
                  *(take(y0,ind)-take(y1,ind-1)) + take(y1,ind-1))
    lut[0] = y1[0]
    lut[-1] = y0[-1]
    # ensure that the lut is confined to values between 0 and 1 by clipping it
    clip(lut, 0.0, 1.0)
    #lut = where(lut > 1., 1., lut)
    #lut = where(lut < 0., 0., lut)
    return lut
开发者ID:florisvb,项目名称:floris_functions,代码行数:51,代码来源:converting_colornames.py


示例5: zero

def zero(data, *args):
    if isinstance(data, numerix.ndarray):
        return numerix.zeros(data.shape, data.dtype)
    return numerix.zeros(len(data))
开发者ID:dragondjf,项目名称:ov-orange-01,代码行数:4,代码来源:thresholding.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python numexpr.evaluate函数代码示例发布时间:2022-05-27
下一篇:
Python numerix.take函数代码示例发布时间: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