-
class graphicle.data.MaskArray(graphicle.base.MaskBase, graphicle.base.ArrayBase)[source]
Boolean mask over Graphicle data structures.
Changed in version 0.2.0: Added internal numpy interfaces for greater interoperability.
- Parameters:
- data : sequence[bool]
Boolean values consituting the mask.
Examples
Instantiating, copying, updating by index, and comparison:
>>> import graphicle as gcl
>>> mask1 = gcl.MaskArray([True, True, False])
>>> mask2 = mask1.copy()
>>> mask2[1] = False
>>> mask2
MaskArray(data=array([ True, False, False]))
>>> mask1 == mask2
MaskArray(data=array([ True, False, True]))
>>> mask1 != mask2
MaskArray(data=array([False, True, False]))
Public members
-
__array__() → ndarray[Any, dtype[bool_]][source]
Numpy array representation of the data.
-
__iter__() → Iterator[bool][source]
Iterator exposing contained data as Python native.
-
copy() → MaskArray[source]
Copies the underlying data into a new MaskArray instance.
-
__repr__() → str[source]
Return repr(self).
-
__getitem__(key) → MaskArray[source]
-
__setitem__(key, val)[source]
-
__or__(other: MaskBase | ndarray[Any, dtype[bool_]]) → MaskArray[source]
Return self|value.
-
__eq__(other: MaskBase | ndarray[Any, dtype[bool_]]) → MaskArray[source]
Equality comparison.
-
__ne__(other: MaskBase | ndarray[Any, dtype[bool_]]) → MaskArray[source]
Return self!=value.
-
__bool__() → bool[source]
Truthy returns False if no elements, True otherwise.
-
property data : ndarray[Any, dtype[bool_]][source]
Numpy representation of the boolean mask.
-
serialize() → tuple[bool, ...][source]
Provides a serialized version of the underlying data.
-
__setattr__(name, val)[source]
Method generated by attrs for class MaskArray.
-
MaskArray(...)[source]
Method generated by attrs for class MaskArray.
-
dtype : dtype[source]
-
index(value, ...) → integer -- return first index of value.[source]
Raises ValueError if the value is not present.
-
count(value) → integer -- return number of occurrences of value[source]
-
classmethod __subclasshook__(C)[source]
Abstract classes can override this to customize issubclass().
-
MaskArray =
<bound method GenericAlias of <class 'collections.abc.Iterable'>>[source]
-
__lt__(other)[source]
Return self<value.
-
__le__(other)[source]
Return self<=value.
-
__gt__(other)[source]
Return self>value.
-
__ge__(other)[source]
Return self>=value.
-
__ror__(other)[source]
Return value|self.
Last update:
Jun 27, 2025