uids#

class uids(arr=None)[source]#

Bases: ndarray

Class to specify that integers should be interpreted as UIDs.

For all practical purposes, behaves like a NumPy integer array. However, has additional methods uids.concat() (instance method), ss.uids.cat() (class method), uids.remove(), and uids.intersect() to simplify common UID operations.

Attributes

T

View of the transposed array.

base

Base object if memory is from some other object.

ctypes

An object to simplify the interaction of the array with the ctypes module.

data

Python buffer object pointing to the start of the array's data.

device

dtype

Data-type of the array's elements.

flags

Information about the memory layout of the array.

flat

A 1-D iterator over the array.

imag

The imaginary part of the array.

itemset

itemsize

Length of one array element in bytes.

mT

View of the matrix transposed array.

nbytes

Total bytes consumed by the elements of the array.

ndim

Number of array dimensions.

newbyteorder

ptp

real

The real part of the array.

shape

Tuple of array dimensions.

size

Number of elements in the array.

strides

Tuple of bytes to step in each dimension when traversing an array.

Methods

concat(other, **kw)[source]#

Equivalent to np.concatenate(), but return correct type

classmethod cat(*args, **kw)[source]#

Equivalent to np.concatenate(), but return correct type

remove(other, **kw)[source]#

Remove provided UIDs from current array

intersect(other, **kw)[source]#

Keep only UIDs that are also present in the other array

union(other, **kw)[source]#

Return all UIDs present in both arrays

xor(other, **kw)[source]#

Return UIDs present in only one of the arrays

to_numpy()[source]#

Return a view as a standard NumPy array

unique(return_index=False)[source]#

Return unique UIDs; equivalent to np.unique()