circle

utilipy.data_utils.circle(*x: Union[numpy.array, Sequence], x0: Union[float, Sequence] = 0.0, radius: Union[float, Sequence] = 1.0, as_ind: bool = False) → numpy.array[source]

Circular selection of data in many dimensions.

Elliptical selection with fixed radius:

np.sum((x[i] - x0[i]) / radius)^2) < 1^2

where the summation is over the dimensions.

Parameters
xarray_like

shape (m x (n, 1)) values along each dimension

x0array_like, optional

scalar or (m, 1) array the center position of each x, [default 0.] can broadcast a scalar to apply to all

radiusfloat, optional

the radius

Returns
selarray_like of bool

bool array selecting data within circle if as_ind is True, then array_like of indices

Other Parameters
as_indbool or “flatten”, optional

(default False) whether to return a boolean array, or array of indices.

Raises
ValueError

if as_ind is “flatten” and cannot be flattened (len > 1)