split_into_consecutive_subarrays

mdtools.numpy_helper_functions.split_into_consecutive_subarrays(a, step=1, sort=True, debug=False)[source]

Split an array into its subarrays of consecutive numbers.

Parameters
  • a (array_like) – 1-dimensional array which to split into subarrays of consecutive numbers with stepsize step.

  • step (scalar, optional) – The stepsize defining the contiguous sequence.

  • sort (bool, optional) – Sort a before searching for contiguous sequences.

  • debug (bool, optional) – If True, check the input arguments.

Returns

consecutive_subarrays – List of subarrays, one for each contiguous sequence of numbers with stepsize step in a.

Return type

list