本文整理匯總了Python中org.eclipse.january.dataset.DatasetUtils.calcIndexesFromPositions方法的典型用法代碼示例。如果您正苦於以下問題:Python DatasetUtils.calcIndexesFromPositions方法的具體用法?Python DatasetUtils.calcIndexesFromPositions怎麽用?Python DatasetUtils.calcIndexesFromPositions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.january.dataset.DatasetUtils
的用法示例。
在下文中一共展示了DatasetUtils.calcIndexesFromPositions方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ravel_multi_index
# 需要導入模塊: from org.eclipse.january.dataset import DatasetUtils [as 別名]
# 或者: from org.eclipse.january.dataset.DatasetUtils import calcIndexesFromPositions [as 別名]
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