pick_regularly

emlib.misc.pick_regularly(seq, numitems, start_idx=0, end_idx=0)[source]

Given a sequence, pick numitems from it at regular intervals

The first and the last items are always included. The behaviour is similar to numpy’s linspace

Parameters:
  • seq (Union[Sequence[TypeVar(T)], ndarray]) – a sequence of items (a list of items or a numpy array)

  • numitems (int) – the number of items to pick from seq

  • start_idx – if given, the index to start picking from

  • end_idx – if given, the index to stop

Return type:

Union[ndarray, list[TypeVar(T)]]

Returns:

a list of the picked items (as a list if the input was a list, or a numpy array if the input was an array)