xarray.DataArray.qsel.around

DataArray.qsel.around(self, radius, *, boundary=True, invert=False, drop=False, average=True, **sel_kw)[source]

Average data within a specified radius of a specified point.

For instance, consider an ARPES map with dimensions 'kx', 'ky', and 'eV'. Providing 'kx' and 'ky' points will average the data within a cylindrical region centered at that point. The radius of the cylinder is specified by radius.

If different radii are given for kx and ky, the region will be elliptic.

Parameters:
  • radius (float | dict[Hashable, float]) – The radius of the region. If a single number, the same radius is used for all dimensions. If a dictionary, keys must be valid dimension names and the values are the radii for the corresponding dimensions.

  • boundary (bool, default: True) – Whether to consider points on the boundary to be inside the mask. Default is True.

  • invert (bool, default: False) – If True, invert the mask so that points inside are masked and points outside are kept. This is applied after the mask is created.

  • drop (bool, default: False) – If True, drop coordinate labels along dims for which all values are masked. This argument is ignored if average=True.

  • average (bool, default: True) – If True, return the mean value of the data within the region. If False, return the masked data.

  • **sel_kw – The center of the spherical region. Must be a mapping of valid dimension names to coordinate values.

Returns:

DataArray – The mean value of the data within the region if average=True, else the masked data.

Return type:

DataArray

Note

Depending on the radius and dimensions provided, the mask will be hyperellipsoid in the dimensions specified in sel_kw.