当前位置: 首页>>代码示例>>Python>>正文


Python numerix.zeros函数代码示例

本文整理汇总了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;未经允许,请勿转载。