expand_grouped_mask

sherpa.astro.utils.expand_grouped_mask()

Expand a mask array to match the ungrouped data.

The mask array size must match the number of groups in the group array.

Parameters:
  • mask (array_like) – The mask array to expand (treated as a boolean array).

  • group (array_like) – The OGIP grouping data: 1 indicates the start of a group and -1 continues the group.

Returns:

full_mask – The mask data (booleans) expanded to match the size of group.

Return type:

array

Examples

>>> mask = [True, False, False, True]
>>> group = [1, -1, 1, 1, -1, 1, -1, -1]
>>> expand_grouped_mask(mask, group)
[True, True, False, False, False, True, True, True]
>>> expand_grouped_mask([True, False], [1, 1])
[True, False]
>>> expand_grouped_mask([1, 0], [1, 1])
[True, False]