graphicle.data.MaskGroup.flatten(how: 'rise' | 'agg' | 'leaves' = 'rise') MaskGroup[MaskArray][source]

Removes nesting such that the MaskGroup contains only MaskArray instances, and no other MaskGroup.

New in version 0.1.11.

Changed in version 0.2.6: Added how parameter.

Changed in version 0.3.7: Added leaves option for how parameter.

Parameters:
how : {'rise', 'agg', 'leaves'}

Method used to convert into flat MaskGroup. rise recurses through nested levels, raising all contained MaskArray instances to the top level. agg loops over the top level of MaskBase objects, leaving top-level MaskArray objects as-is, but calling the aggregation operation over any MaskGroup. leaves brings the innermosted nested MaskArray instances to the top level, discarding the rest. Default is rise.

Returns:

flat_masks – Flat MaskGroup with only MaskArray instances nested at the top level.

Return type:

MaskGroup


Last update: Jun 27, 2025