arpes.analysis.mask.polys_to_mask#

arpes.analysis.mask.polys_to_mask(mask_dict, coords, shape, radius=0, *, invert=False)[source]#

Converts a mask definition in terms of the underlying polygon to a True/False mask array.

Uses the coordinates and shape of the target data in order to determine which pixels should be masked.

This process “specializes” a mask to a particular shape, whereas masks given by polygon definitions are general to any data with appropriate dimensions, because waypoints are given in unitful values rather than index values.

Parameters:
  • mask_dict (dict) – dict object to represent mask. dim and polys keys are required.

  • coords (xr.coordinates) – coordinates

  • shape (list[tuple[int, ...]]) – Shape of mask

  • radius (float) – Additional margin on the path in coordinates of points.

  • invert (bool) – if true, flip True/False in mask.

Returns:

The mask.