WrightTools.kit.enforce_mask_shape

WrightTools.kit.enforce_mask_shape(mask, shape)[source]

Reduce a boolean mask to fit a given shape.

Parameters:
  • mask (ndarray with bool dtype) – The mask which is to be reduced

  • shape (tuple of int) – Shape which broadcasts to the mask shape.

Return type:

A boolean mask, collapsed along axes where the shape given has one element.