Python numpy.intc() Examples
The following are 30
code examples of numpy.intc().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
numpy
, or try the search function
.
Example #1
Source File: pycuda_double_op.py From attention-lvcsr with MIT License | 6 votes |
def make_thunk(self, node, storage_map, _, _2): mod = SourceModule(""" __global__ void my_fct(float * i0, float * o0, int size) { int i = blockIdx.x*blockDim.x + threadIdx.x; if(i<size){ o0[i] = i0[i]*2; } }""") pycuda_fct = mod.get_function("my_fct") inputs = [ storage_map[v] for v in node.inputs] outputs = [ storage_map[v] for v in node.outputs] def thunk(): z = outputs[0] if z[0] is None or z[0].shape!=inputs[0][0].shape: z[0] = cuda.CudaNdarray.zeros(inputs[0][0].shape) grid = (int(numpy.ceil(inputs[0][0].size / 512.)),1) pycuda_fct(inputs[0][0], z[0], numpy.intc(inputs[0][0].size), block=(512,1,1), grid=grid) return thunk
Example #2
Source File: onlineLDA.py From IDEA with MIT License | 6 votes |
def lists_to_matrix(self, WS, DS): """Convert array of word (or topic) and document indices to doc-term array Parameters ----------- (WS, DS) : tuple of two arrays WS[k] contains the kth word in the corpus DS[k] contains the document index for the kth word Returns ------- doc_word : array (D, V) document-term array of counts """ D = max(DS) + 1 V = max(WS) + 1 doc_word = np.empty((D, V), dtype=np.intc) for d in range(D): for v in range(V): doc_word[d, v] = np.count_nonzero(WS[DS == d] == v) return doc_word
Example #3
Source File: core.py From astropy-healpix with BSD 3-Clause "New" or "Revised" License | 6 votes |
def nested_to_ring(nested_index, nside): """ Convert a HEALPix 'nested' index to a HEALPix 'ring' index Parameters ---------- nested_index : int or `~numpy.ndarray` Healpix index using the 'nested' ordering nside : int or `~numpy.ndarray` Number of pixels along the side of each of the 12 top-level HEALPix tiles Returns ------- ring_index : int or `~numpy.ndarray` Healpix index using the 'ring' ordering """ nside = np.asarray(nside, dtype=np.intc) return _core.nested_to_ring(nested_index, nside)
Example #4
Source File: histogram.py From mars with Apache License 2.0 | 6 votes |
def _unsigned_subtract(a, b): """ Subtract two values where a >= b, and produce an unsigned result This is needed when finding the difference between the upper and lower bound of an int16 histogram """ # coerce to a single type signed_to_unsigned = { np.byte: np.ubyte, np.short: np.ushort, np.intc: np.uintc, np.int_: np.uint, np.longlong: np.ulonglong } dt = np.result_type(a, b) try: dt = signed_to_unsigned[dt.type] except KeyError: # pragma: no cover return np.subtract(a, b, dtype=dt) else: # we know the inputs are integers, and we are deliberately casting # signed to unsigned return np.subtract(a, b, casting='unsafe', dtype=dt)
Example #5
Source File: histograms.py From lambda-packs with MIT License | 6 votes |
def _unsigned_subtract(a, b): """ Subtract two values where a >= b, and produce an unsigned result This is needed when finding the difference between the upper and lower bound of an int16 histogram """ # coerce to a single type signed_to_unsigned = { np.byte: np.ubyte, np.short: np.ushort, np.intc: np.uintc, np.int_: np.uint, np.longlong: np.ulonglong } dt = np.result_type(a, b) try: dt = signed_to_unsigned[dt.type] except KeyError: return np.subtract(a, b, dtype=dt) else: # we know the inputs are integers, and we are deliberately casting # signed to unsigned return np.subtract(a, b, casting='unsafe', dtype=dt)
Example #6
Source File: dia.py From lambda-packs with MIT License | 6 votes |
def transpose(self, axes=None, copy=False): if axes is not None: raise ValueError(("Sparse matrices do not support " "an 'axes' parameter because swapping " "dimensions is the only logical permutation.")) num_rows, num_cols = self.shape max_dim = max(self.shape) # flip diagonal offsets offsets = -self.offsets # re-align the data matrix r = np.arange(len(offsets), dtype=np.intc)[:, None] c = np.arange(num_rows, dtype=np.intc) - (offsets % max_dim)[:, None] pad_amount = max(0, max_dim-self.data.shape[1]) data = np.hstack((self.data, np.zeros((self.data.shape[0], pad_amount), dtype=self.data.dtype))) data = data[r, c] return dia_matrix((data, offsets), shape=( num_cols, num_rows), copy=copy)
Example #7
Source File: pycuda_example.py From D-VAE with MIT License | 6 votes |
def perform(self, node, inputs, out): # TODO support broadcast! # TODO assert all input have the same shape z, = out if (z[0] is None or z[0].shape != inputs[0].shape or not z[0].is_c_contiguous()): z[0] = theano.sandbox.cuda.CudaNdarray.zeros(inputs[0].shape) if inputs[0].shape != inputs[1].shape: raise TypeError("PycudaElemwiseSourceModuleOp:" " inputs don't have the same shape!") if inputs[0].size > 512: grid = (int(numpy.ceil(inputs[0].size / 512.)), 1) block = (512, 1, 1) else: grid = (1, 1) block = (inputs[0].shape[0], inputs[0].shape[1], 1) self.pycuda_fct(inputs[0], inputs[1], z[0], numpy.intc(inputs[1].size), block=block, grid=grid)
Example #8
Source File: pycuda_double_op.py From D-VAE with MIT License | 6 votes |
def make_thunk(self, node, storage_map, _, _2): mod = SourceModule(""" __global__ void my_fct(float * i0, float * o0, int size) { int i = blockIdx.x*blockDim.x + threadIdx.x; if(i<size){ o0[i] = i0[i]*2; } }""") pycuda_fct = mod.get_function("my_fct") inputs = [ storage_map[v] for v in node.inputs] outputs = [ storage_map[v] for v in node.outputs] def thunk(): z = outputs[0] if z[0] is None or z[0].shape!=inputs[0][0].shape: z[0] = cuda.CudaNdarray.zeros(inputs[0][0].shape) grid = (int(numpy.ceil(inputs[0][0].size / 512.)),1) pycuda_fct(inputs[0][0], z[0], numpy.intc(inputs[0][0].size), block=(512,1,1), grid=grid) return thunk
Example #9
Source File: convert_ICESat2_zarr.py From read-ICESat-2 with MIT License | 6 votes |
def attributes_encoder(attr): """Custom encoder for copying file attributes in Python 3""" if isinstance(attr, (bytes, bytearray)): return attr.decode('utf-8') if isinstance(attr, (np.int_, np.intc, np.intp, np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, np.uint32, np.uint64)): return int(attr) elif isinstance(attr, (np.float_, np.float16, np.float32, np.float64)): return float(attr) elif isinstance(attr, (np.ndarray)): if not isinstance(attr[0], (object)): return attr.tolist() elif isinstance(attr, (np.bool_)): return bool(attr) elif isinstance(attr, (np.void)): return None else: return attr #-- PURPOSE: help module to describe the optional input parameters
Example #10
Source File: nsidc_icesat2_zarr.py From read-ICESat-2 with MIT License | 6 votes |
def attributes_encoder(attr): """Custom encoder for copying file attributes in Python 3""" if isinstance(attr, (bytes, bytearray)): return attr.decode('utf-8') if isinstance(attr, (np.int_, np.intc, np.intp, np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, np.uint32, np.uint64)): return int(attr) elif isinstance(attr, (np.float_, np.float16, np.float32, np.float64)): return float(attr) elif isinstance(attr, (np.ndarray)): if not isinstance(attr[0], (object)): return attr.tolist() elif isinstance(attr, (np.bool_)): return bool(attr) elif isinstance(attr, (np.void)): return None else: return attr #-- PURPOSE: help module to describe the optional input parameters
Example #11
Source File: compressed.py From Computable with MIT License | 6 votes |
def _mul_sparse_matrix(self, other): M, K1 = self.shape K2, N = other.shape major_axis = self._swap((M,N))[0] indptr = np.empty(major_axis + 1, dtype=np.intc) other = self.__class__(other) # convert to this format fn = getattr(sparsetools, self.format + '_matmat_pass1') fn(M, N, self.indptr, self.indices, other.indptr, other.indices, indptr) nnz = indptr[-1] indices = np.empty(nnz, dtype=np.intc) data = np.empty(nnz, dtype=upcast(self.dtype,other.dtype)) fn = getattr(sparsetools, self.format + '_matmat_pass2') fn(M, N, self.indptr, self.indices, self.data, other.indptr, other.indices, other.data, indptr, indices, data) return self.__class__((data,indices,indptr),shape=(M,N))
Example #12
Source File: lil.py From Computable with MIT License | 6 votes |
def tocsr(self): """ Return Compressed Sparse Row format arrays for this matrix. """ indptr = np.asarray([len(x) for x in self.rows], dtype=np.intc) indptr = np.concatenate((np.array([0], dtype=np.intc), np.cumsum(indptr))) nnz = indptr[-1] indices = [] for x in self.rows: indices.extend(x) indices = np.asarray(indices, dtype=np.intc) data = [] for x in self.data: data.extend(x) data = np.asarray(data, dtype=self.dtype) from .csr import csr_matrix return csr_matrix((data, indices, indptr), shape=self.shape)
Example #13
Source File: histograms.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def _unsigned_subtract(a, b): """ Subtract two values where a >= b, and produce an unsigned result This is needed when finding the difference between the upper and lower bound of an int16 histogram """ # coerce to a single type signed_to_unsigned = { np.byte: np.ubyte, np.short: np.ushort, np.intc: np.uintc, np.int_: np.uint, np.longlong: np.ulonglong } dt = np.result_type(a, b) try: dt = signed_to_unsigned[dt.type] except KeyError: return np.subtract(a, b, dtype=dt) else: # we know the inputs are integers, and we are deliberately casting # signed to unsigned return np.subtract(a, b, casting='unsafe', dtype=dt)
Example #14
Source File: tree.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def _validate_X_predict(self, X, check_input): """Validate X whenever one tries to predict, apply, predict_proba""" if check_input: X = check_array(X, dtype=DTYPE, accept_sparse="csr") if issparse(X) and (X.indices.dtype != np.intc or X.indptr.dtype != np.intc): raise ValueError("No support for np.int64 index based " "sparse matrices") n_features = X.shape[1] if self.n_features_ != n_features: raise ValueError("Number of features of the model must " "match the input. Model n_features is %s and " "input n_features is %s " % (self.n_features_, n_features)) return X
Example #15
Source File: json.py From airflow with Apache License 2.0 | 6 votes |
def _default(obj): """ Convert dates and numpy objects in a json serializable format. """ if isinstance(obj, datetime): return obj.strftime('%Y-%m-%dT%H:%M:%SZ') elif isinstance(obj, date): return obj.strftime('%Y-%m-%d') elif isinstance(obj, (np.int_, np.intc, np.intp, np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, np.uint32, np.uint64)): return int(obj) elif isinstance(obj, np.bool_): return bool(obj) elif isinstance(obj, (np.float_, np.float16, np.float32, np.float64, np.complex_, np.complex64, np.complex128)): return float(obj) raise TypeError(f"Object of type '{obj.__class__.__name__}' is not JSON serializable")
Example #16
Source File: histograms.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def _unsigned_subtract(a, b): """ Subtract two values where a >= b, and produce an unsigned result This is needed when finding the difference between the upper and lower bound of an int16 histogram """ # coerce to a single type signed_to_unsigned = { np.byte: np.ubyte, np.short: np.ushort, np.intc: np.uintc, np.int_: np.uint, np.longlong: np.ulonglong } dt = np.result_type(a, b) try: dt = signed_to_unsigned[dt.type] except KeyError: return np.subtract(a, b, dtype=dt) else: # we know the inputs are integers, and we are deliberately casting # signed to unsigned return np.subtract(a, b, casting='unsafe', dtype=dt)
Example #17
Source File: dia.py From GraphicDesignPatternByPython with MIT License | 6 votes |
def transpose(self, axes=None, copy=False): if axes is not None: raise ValueError(("Sparse matrices do not support " "an 'axes' parameter because swapping " "dimensions is the only logical permutation.")) num_rows, num_cols = self.shape max_dim = max(self.shape) # flip diagonal offsets offsets = -self.offsets # re-align the data matrix r = np.arange(len(offsets), dtype=np.intc)[:, None] c = np.arange(num_rows, dtype=np.intc) - (offsets % max_dim)[:, None] pad_amount = max(0, max_dim-self.data.shape[1]) data = np.hstack((self.data, np.zeros((self.data.shape[0], pad_amount), dtype=self.data.dtype))) data = data[r, c] return dia_matrix((data, offsets), shape=( num_cols, num_rows), copy=copy)
Example #18
Source File: header.py From baseband with GNU General Public License v3.0 | 6 votes |
def set_jds(self, val1, val2): """Parse the time strings contained in val1 and set jd1, jd2""" iterator = np.nditer([val1, None, None, None, None, None, None], op_dtypes=([val1.dtype] + 5 * [np.intc] + [np.double])) try: for val, iy, im, id, ihr, imin, dsec in iterator: timestr = val.item() components = timestr.split() iy[...], im[...], id[...], ihr[...], imin[...], sec = ( int(component) for component in components[:-1]) dsec[...] = sec + float(components[-1]) except Exception: raise ValueError('Time {0} does not match {1} format' .format(timestr, self.name)) self.jd1, self.jd2 = erfa.dtf2d( self.scale.upper().encode('utf8'), *iterator.operands[1:])
Example #19
Source File: utils.py From GuidedLDA with Mozilla Public License 2.0 | 6 votes |
def lists_to_matrix(WS, DS): """Convert array of word (or topic) and document indices to doc-term array Parameters ----------- (WS, DS) : tuple of two arrays WS[k] contains the kth word in the corpus DS[k] contains the document index for the kth word Returns ------- doc_word : array (D, V) document-term array of counts """ D = max(DS) + 1 V = max(WS) + 1 doc_word = np.empty((D, V), dtype=np.intc) for d in range(D): for v in range(V): doc_word[d, v] = np.count_nonzero(WS[DS == d] == v) return doc_word
Example #20
Source File: pycuda_example.py From attention-lvcsr with MIT License | 6 votes |
def perform(self, node, inputs, out): # TODO support broadcast! # TODO assert all input have the same shape z, = out if (z[0] is None or z[0].shape != inputs[0].shape or not z[0].is_c_contiguous()): z[0] = theano.sandbox.cuda.CudaNdarray.zeros(inputs[0].shape) if inputs[0].shape != inputs[1].shape: raise TypeError("PycudaElemwiseSourceModuleOp:" " inputs don't have the same shape!") if inputs[0].size > 512: grid = (int(numpy.ceil(inputs[0].size / 512.)), 1) block = (512, 1, 1) else: grid = (1, 1) block = (inputs[0].shape[0], inputs[0].shape[1], 1) self.pycuda_fct(inputs[0], inputs[1], z[0], numpy.intc(inputs[1].size), block=block, grid=grid)
Example #21
Source File: compressed.py From Computable with MIT License | 6 votes |
def tocoo(self,copy=True): """Return a COOrdinate representation of this matrix When copy=False the index and data arrays are not copied. """ major_dim,minor_dim = self._swap(self.shape) data = self.data minor_indices = self.indices if copy: data = data.copy() minor_indices = minor_indices.copy() major_indices = np.empty(len(minor_indices), dtype=np.intc) sparsetools.expandptr(major_dim,self.indptr,major_indices) row,col = self._swap((major_indices,minor_indices)) from .coo import coo_matrix return coo_matrix((data,(row,col)), self.shape)
Example #22
Source File: histograms.py From recruit with Apache License 2.0 | 5 votes |
def _unsigned_subtract(a, b): """ Subtract two values where a >= b, and produce an unsigned result This is needed when finding the difference between the upper and lower bound of an int16 histogram """ # coerce to a single type signed_to_unsigned = { np.byte: np.ubyte, np.short: np.ushort, np.intc: np.uintc, np.int_: np.uint, np.longlong: np.ulonglong } dt = np.result_type(a, b) try: dt = signed_to_unsigned[dt.type] except KeyError: return np.subtract(a, b, dtype=dt) else: # we know the inputs are integers, and we are deliberately casting # signed to unsigned return np.subtract(a, b, casting='unsafe', dtype=dt)
Example #23
Source File: coo.py From Computable with MIT License | 5 votes |
def tocsr(self): """Return a copy of this matrix in Compressed Sparse Row format Duplicate entries will be summed together. Examples -------- >>> from numpy import array >>> from scipy.sparse import coo_matrix >>> row = array([0,0,1,3,1,0,0]) >>> col = array([0,2,1,3,1,0,0]) >>> data = array([1,1,1,1,1,1,1]) >>> A = coo_matrix( (data,(row,col)), shape=(4,4)).tocsr() >>> A.todense() matrix([[3, 0, 1, 0], [0, 2, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]) """ from .csr import csr_matrix if self.nnz == 0: return csr_matrix(self.shape, dtype=self.dtype) else: M,N = self.shape indptr = np.empty(M + 1, dtype=np.intc) indices = np.empty(self.nnz, dtype=np.intc) data = np.empty(self.nnz, dtype=upcast(self.dtype)) coo_tocsr(M, N, self.nnz, self.row, self.col, self.data, indptr, indices, data) A = csr_matrix((data, indices, indptr), shape=self.shape) A.sum_duplicates() return A
Example #24
Source File: coo.py From Computable with MIT License | 5 votes |
def tocsc(self): """Return a copy of this matrix in Compressed Sparse Column format Duplicate entries will be summed together. Examples -------- >>> from numpy import array >>> from scipy.sparse import coo_matrix >>> row = array([0,0,1,3,1,0,0]) >>> col = array([0,2,1,3,1,0,0]) >>> data = array([1,1,1,1,1,1,1]) >>> A = coo_matrix( (data,(row,col)), shape=(4,4)).tocsc() >>> A.todense() matrix([[3, 0, 1, 0], [0, 2, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]]) """ from .csc import csc_matrix if self.nnz == 0: return csc_matrix(self.shape, dtype=self.dtype) else: M,N = self.shape indptr = np.empty(N + 1, dtype=np.intc) indices = np.empty(self.nnz, dtype=np.intc) data = np.empty(self.nnz, dtype=upcast(self.dtype)) coo_tocsr(N, M, self.nnz, self.col, self.row, self.data, indptr, indices, data) A = csc_matrix((data, indices, indptr), shape=self.shape) A.sum_duplicates() return A
Example #25
Source File: coo.py From Computable with MIT License | 5 votes |
def _check(self): """ Checks data structure for consistency """ nnz = self.nnz # index arrays should have integer data types if self.row.dtype.kind != 'i': warn("row index array has non-integer dtype (%s) " % self.row.dtype.name) if self.col.dtype.kind != 'i': warn("col index array has non-integer dtype (%s) " % self.col.dtype.name) # only support 32-bit ints for now self.row = np.asarray(self.row, dtype=np.intc) self.col = np.asarray(self.col, dtype=np.intc) self.data = to_native(self.data) if nnz > 0: if self.row.max() >= self.shape[0]: raise ValueError('row index exceedes matrix dimensions') if self.col.max() >= self.shape[1]: raise ValueError('column index exceedes matrix dimensions') if self.row.min() < 0: raise ValueError('negative row index found') if self.col.min() < 0: raise ValueError('negative column index found')
Example #26
Source File: test_ctypeslib.py From recruit with Apache License 2.0 | 5 votes |
def test_dtype(self): dt = np.intc p = ndpointer(dtype=dt) assert_(p.from_param(np.array([1], dt))) dt = '<i4' p = ndpointer(dtype=dt) assert_(p.from_param(np.array([1], dt))) dt = np.dtype('>i4') p = ndpointer(dtype=dt) p.from_param(np.array([1], dt)) assert_raises(TypeError, p.from_param, np.array([1], dt.newbyteorder('swap'))) dtnames = ['x', 'y'] dtformats = [np.intc, np.float64] dtdescr = {'names': dtnames, 'formats': dtformats} dt = np.dtype(dtdescr) p = ndpointer(dtype=dt) assert_(p.from_param(np.zeros((10,), dt))) samedt = np.dtype(dtdescr) p = ndpointer(dtype=samedt) assert_(p.from_param(np.zeros((10,), dt))) dt2 = np.dtype(dtdescr, align=True) if dt.itemsize != dt2.itemsize: assert_raises(TypeError, p.from_param, np.zeros((10,), dt2)) else: assert_(p.from_param(np.zeros((10,), dt2)))
Example #27
Source File: test_histograms.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def test_signed_overflow_bounds(self): self.do_signed_overflow_bounds(np.byte) self.do_signed_overflow_bounds(np.short) self.do_signed_overflow_bounds(np.intc) self.do_signed_overflow_bounds(np.int_) self.do_signed_overflow_bounds(np.longlong)
Example #28
Source File: core.py From astropy-healpix with BSD 3-Clause "New" or "Revised" License | 5 votes |
def neighbours(healpix_index, nside, order='ring'): """ Find all the HEALPix pixels that are the neighbours of a HEALPix pixel Parameters ---------- healpix_index : `~numpy.ndarray` Array of HEALPix pixels nside : int Number of pixels along the side of each of the 12 top-level HEALPix tiles order : { 'nested' | 'ring' } Order of HEALPix pixels Returns ------- neigh : `~numpy.ndarray` Array giving the neighbours starting SW and rotating clockwise. This has one extra dimension compared to ``healpix_index`` - the first dimension - which is set to 8. For example if healpix_index has shape (2, 3), ``neigh`` has shape (8, 2, 3). """ _validate_nside(nside) nside = np.asarray(nside, dtype=np.intc) if _validate_order(order) == 'ring': func = _core.neighbours_ring else: # _validate_order(order) == 'nested' func = _core.neighbours_nested return np.stack(func(healpix_index, nside))
Example #29
Source File: csr.py From Computable with MIT License | 5 votes |
def tobsr(self, blocksize=None, copy=True): from .bsr import bsr_matrix if blocksize is None: from .spfuncs import estimate_blocksize return self.tobsr(blocksize=estimate_blocksize(self)) elif blocksize == (1,1): arg1 = (self.data.reshape(-1,1,1),self.indices,self.indptr) return bsr_matrix(arg1, shape=self.shape, copy=copy) else: R,C = blocksize M,N = self.shape if R < 1 or C < 1 or M % R != 0 or N % C != 0: raise ValueError('invalid blocksize %s' % blocksize) blks = csr_count_blocks(M,N,R,C,self.indptr,self.indices) indptr = np.empty(M//R + 1, dtype=np.intc) indices = np.empty(blks, dtype=np.intc) data = np.zeros((blks,R,C), dtype=self.dtype) csr_tobsr(M, N, R, C, self.indptr, self.indices, self.data, indptr, indices, data.ravel()) return bsr_matrix((data,indices,indptr), shape=self.shape) # these functions are used by the parent class (_cs_matrix) # to remove redudancy between csc_matrix and csr_matrix
Example #30
Source File: core.py From astropy-healpix with BSD 3-Clause "New" or "Revised" License | 5 votes |
def bilinear_interpolation_weights(lon, lat, nside, order='ring'): """ Get the four neighbours for each (lon, lat) position and the weight associated with each one for bilinear interpolation. Parameters ---------- lon, lat : :class:`~astropy.units.Quantity` The longitude and latitude values as :class:`~astropy.units.Quantity` instances with angle units. nside : int Number of pixels along the side of each of the 12 top-level HEALPix tiles order : { 'nested' | 'ring' } Order of HEALPix pixels Returns ------- indices : `~numpy.ndarray` 2-D array with shape (4, N) giving the four indices to use for the interpolation weights : `~numpy.ndarray` 2-D array with shape (4, N) giving the four weights to use for the interpolation """ lon = lon.to_value(u.rad) lat = lat.to_value(u.rad) _validate_nside(nside) nside = np.asarray(nside, dtype=np.intc) result = _core.bilinear_interpolation_weights(lon, lat, nside) indices = np.stack(result[:4]) weights = np.stack(result[4:]) if _validate_order(order) == 'nested': indices = ring_to_nested(indices, nside) return indices, weights