proc_array¶
- proc_array(func: callable, arr_in: ndarray, axes: int | tuple[int] = 0, n_jobs: int = None, desc: str = 'Slices', inplace: bool = True, **kwargs) ndarray[source][source]¶
Execute a function in parallel over slices of an array
- Parameters:
func (
callable) – The function to executearr_in (
np.ndarray) – The array to sliceaxes (
int | tuple[int]) – The axes to slice overn_jobs (
int) – The number of jobs to run in paralleldesc (
str) – The description to use for the progress barinplace (
bool) – Whether to modify the input array in place
- Returns:
The output of the function, same shape as the input array
- Return type:
np.ndarray
Examples
>>> def square(x): ... return x ** 2 >>> proc_array(square, np.arange(10)) array([ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81])