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


Python impl.DatasetUtils类代码示例

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


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

示例1: crossings

def crossings(y, value, x=None):
    '''Finds the crossing points where a (poly-)line defined by a 1D y array has the given
    values and return the (linearly) interpolated index or x value if an x array is given 
    '''
    if x is None:
        return _dsutils.crossings(y, value)
    return _dsutils.crossings(x, y, value)
开发者ID:REJN2,项目名称:scisoft-core,代码行数:7,代码来源:jyscisoft.py

示例2: normalise

def normalise(a, allelements=True):
    '''Normalise array so all elements lie between 0 and 1
    Keyword argument:
    allelements -- if True, then normalise for all elements rather than per-element
    '''
    if isinstance(a, _compoundds):
        return _dsutils.norm(a, allelements)
    return _dsutils.norm(a)
开发者ID:REJN2,项目名称:scisoft-core,代码行数:8,代码来源:jyscisoft.py

示例3: centroid

def centroid(weights, coords=None):
    '''Calculate the centroid of an array with its (half) indexes or
    coordinates (list of 1D arrays), if given, and returns it as a list
    '''
    if coords is None:
        return _dsutils.centroid(weights)
    from jycore import toList
    return _dsutils.centroid(weights, toList(coords))
开发者ID:REJN2,项目名称:scisoft-core,代码行数:8,代码来源:jyscisoft.py

示例4: put

 def put(self, indices, values):
     if isinstance(indices, ndarray):
         inds = indices._jdataset()
     else:
         inds = asIterable(indices)
     if isinstance(values, ndarray):
         vals = values._jdataset()
     else:
         vals = asIterable(values)
     _dsutils.put(self.__dataset, inds, vals)
开发者ID:ivanovviacheslav,项目名称:scisoft-core,代码行数:10,代码来源:jycore.py

示例5: append

def append(arr, values, axis=None):
    '''Append values to end of array
    Keyword argument:
    axis -- if None, then append flattened values to flattened array 
    '''
    if not isinstance(values, _ds):
        values = __cvt_jobj(values, dtype=None, copy=False, force=True)
    if axis is None:
        return _dsutils.append(arr.flatten(), values.flatten(), 0)
    return _dsutils.append(arr, values, axis)
开发者ID:ivanovviacheslav,项目名称:scisoft-core,代码行数:10,代码来源:jycore.py

示例6: unravel_index

def unravel_index(indices, dims):
    '''Converts a flat index (or array of them) into a tuple of coordinate arrays
    '''
    if isinstance(indices, (tuple, list)):
        indices = ndarray(buffer=indices)._jdataset()
    if not isinstance(indices, _ds):
        return tuple(_abstractds.getNDPositionFromShape(indices, dims))
    return tuple(_dsutils.calcPositionsFromIndexes(indices, dims))
开发者ID:ivanovviacheslav,项目名称:scisoft-core,代码行数:8,代码来源:jycore.py

示例7: where

def where(condition, x=None, y=None):
    '''Return items from x or y depending on condition'''
    if x and y:
        return _dsutils.select(condition, x, y)
    elif not x and not y:
        return _cmps.nonZero(condition)
    else:
        raise ValueError, "Both x and y must be specified"
开发者ID:REJN2,项目名称:scisoft-core,代码行数:8,代码来源:jycomparisons.py

示例8: logspace

def logspace(start, stop, num=50, endpoint=True, base=10.0):
    '''Create a 1D dataset of values equally spaced on a logarithmic scale'''
    if not endpoint:
        stop = ((num - 1) * stop + start)/num

    if complex(start).imag == 0 and complex(stop).imag == 0:
        dtype = _getdtypefromobj(((start, stop)))
        return _dsutils.logSpace(start, stop, num, base, dtype.value)
    else:
        result = linspace(start, stop, num, endpoint)
        return _maths.power(base, result)
开发者ID:ivanovviacheslav,项目名称:scisoft-core,代码行数:11,代码来源:jycore.py

示例9: choose

def choose(a, choices, mode='raise'):
    '''Return dataset with items drawn from choices according to conditions'''
    if mode == 'raise':
        rf = True
        cf = False
    else:
        rf = False
        if mode == 'clip':
            cf = True
        elif mode == 'wrap':
            cf = False
        else:
            raise ValueError, "mode is not one of raise, clip or wrap"
    return _dsutils.choose(a, choices, rf, cf)
开发者ID:ivanovviacheslav,项目名称:scisoft-core,代码行数:14,代码来源:jycore.py

示例10: linspace

def linspace(start, stop, num=50, endpoint=True, retstep=False):
    '''Create a 1D dataset from start to stop in given number of steps
    
    Arguments:
    start    -- starting value
    stop     -- stopping value
    num      -- number of steps, defaults to 50
    endpoint -- if True (default), include the stop value
    retstep  -- if False (default), do not include the calculated step value as part of return tuple
    '''
    if not endpoint:
        stop = ((num - 1) * stop + start)/num

    dtype = _getdtypefromobj(((start, stop)))

    if dtype.value < float64.value:
        dtype = float64

    if dtype.value >= complex64.value:
        dtype = complex128

        if type(start) is _types.IntType:
            start = start+0j
        if type(stop) is _types.IntType:
            stop = stop+0j
        rresult = _dsutils.linSpace(start.real, stop.real, num, float64.value)
        iresult = _dsutils.linSpace(start.imag, stop.imag, num, float64.value)
        result = Sciwrap(_complexdoubleds(rresult, iresult))
        del rresult, iresult
    else:
        result = Sciwrap(_dsutils.linSpace(start, stop, num, dtype.value))

    if retstep:
        step = result[1] - result[0]
        return (result, step)
    else:
        return result
开发者ID:ivanovviacheslav,项目名称:scisoft-core,代码行数:37,代码来源:jycore.py

示例11: ravel_multi_index

def ravel_multi_index(multi_index, dims, mode='raise'):
    '''Converts a tuple of coordinate arrays to an array of flat indexes
    '''
    if isinstance(mode, tuple):
        mode = [_prep_mode.get(m, -1) for m in mode]
    else:
        mode = _prep_mode.get(mode, -1)

    if isinstance(multi_index, _ds): # split single array
        multi_index = [ _getslice(multi_index, i) for i in range(multi_index.shape[0]) ]

    single = False
    if isinstance(multi_index[0], int):
        single = True
        multi_index = [ array(m)._jdataset() for m in multi_index ]


    pos = _dsutils.calcIndexesFromPositions(multi_index, dims, mode)
    if single:
        return pos.getObject([])
    return pos
开发者ID:ivanovviacheslav,项目名称:scisoft-core,代码行数:21,代码来源:jycore.py

示例12: nan_to_num

def nan_to_num(a):
    '''Create a copy with infinities replaced by max/min values and NaNs replaced by 0s
    '''
    c = a.copy()
    _dsutils.removeNansAndInfinities(c)
    return c
开发者ID:ivanovviacheslav,项目名称:scisoft-core,代码行数:6,代码来源:jycore.py

示例13: compoundarray

def compoundarray(a, view=True):
    '''Create a compound array from an nd array by grouping last axis items into compound items
    '''
    return _dsutils.createCompoundDatasetFromLastAxis(a, view)
开发者ID:ivanovviacheslav,项目名称:scisoft-core,代码行数:4,代码来源:jycore.py

示例14: rollaxis

def rollaxis(a, axis, start=0):
    return _dsutils.rollAxis(a, axis, start)
开发者ID:ivanovviacheslav,项目名称:scisoft-core,代码行数:2,代码来源:jycore.py

示例15: roll

def roll(a, shift, axis=None):
    return _dsutils.roll(a, shift, axis)
开发者ID:ivanovviacheslav,项目名称:scisoft-core,代码行数:2,代码来源:jycore.py


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