- class graphicle.data.MaskGroup(graphicle.base.MaskBase, MutableMapping[str, graphicle.data.MaskGeneric])[source]
Data structure to compose groups of masks over particle arrays. Can be nested to form complex hierarchies.
New in version 0.1.0.
Changed in version 0.2.6: Changed
bitwise_orandbitwise_andproperties into methods. Added generic type hinting for elements withinMaskGroup.- Parameters:¶
Public members¶
- classmethod from_numpy_structured(arr) MaskGroup[source]
- __getitem__(key) MaskArray | MaskGroup[MaskGeneric][source]
Subscripting for
MaskGroupobject.
- __setitem__(key: str, mask: MaskBase | ndarray[Any, dtype[bool_]])[source]
Add a new MaskArray to the group, with given key.
- __delitem__(key) None[source]
Remove a MaskArray from the group, using given key.
- to_dict() dict[str, ndarray[Any, dtype[bool_]]][source]
Masks nested in a dictionary instead of a
MaskGroup.
-
recursive_drop(key: str =
'latent', ...) MaskGroup[source] Removes masks indexed by
keyat all levels of nesting.
- flatten(...) MaskGroup[MaskArray][source]
Removes nesting such that the
MaskGroupcontains onlyMaskArrayinstances, and no otherMaskGroup.
-
equal_to(other: MaskGroup, check_order: bool =
False) bool[source] Checks whether this instance is identical to
otherMaskGroup, comparing keys at all levels of nesting, and boolean array data at the leaf level.
- __setattr__(name, val)[source]
Method generated by attrs for class MaskGroup.
- pop(...) v, remove specified key and return the corresponding value.[source]
If key is not found, d is returned if given, otherwise KeyError is raised.
- popitem() (k, v), remove and return some (key, value) pair[source]
as a 2-tuple; but raise KeyError if D is empty.
- update([E, ]**F) None. Update D from mapping/iterable E and F.[source]
If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
- setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D[source]
- classmethod __subclasshook__(C)[source]
Abstract classes can override this to customize issubclass().
- classmethod __init_subclass__(*args, **kwargs)[source]
This method is called when a class is subclassed.
Last update:
Jun 27, 2025