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))
def _getdtypefromobj(jobj): jdtype = _abstractds.getDTypeFromObject(jobj) if jdtype in __jdtype2jytype: return __jdtype2jytype[jdtype] raise ValueError, "Java dataset type unknown"